Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsandfoxes committed Jan 11, 2024
2 parents eef61d6 + bb71eaf commit f2dc7a2
Show file tree
Hide file tree
Showing 16 changed files with 255 additions and 29 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
run: dotnet build Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-restore --nologo -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true

- name: Test
run: dotnet test Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" /p:CollectCoverage=true
run: dotnet test Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage"

- name: Upload code coverage
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
*.userprefs
*.user
*opencover.xml
*cobertura.xml
codecov.sh
lcov.info
bin/
obj/
**/coverage/*.xml
**/coverage/*.json
.DS_Store
Thumbs.db
**/BenchmarkDotNet.Artifacts/*.log
Expand Down
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,16 @@ Also note `/Directory.Build.targets` contains some [convention based rules](http

## Solution Filters

Most contributors will rarely need to load Sentry.sln. The repository contains various solution filters that will be more practical for day to day tasks.
_TLDR;_ when working with the the Sentry codebase, you should use the solution filters (not the solutions).

_Full explanation:_

The `Sentry.sln` solution contains all of the projects required to build Sentry, it's integrations and samples for every platform. However the repository contains various solution filters that will be more practical for day to day tasks.

These solution filters get generated automatically by `/scripts/generate-solution-filters.ps1` so, although you can certainly create your own solution filters and manage these how you wish, don't try to modify any of the `*.slnf` files that are committed to source control. Instead, changes to these can be made by modifying `/scripts/generate-solution-filters-config.yml` and re-running the script that generates these.

Also note that script generates a `.generated.NoMobile.sln` solution, which is an identical copy of `Sentry.sln`. Again, we don't recommend opening this directly. It exists as a round about way to conditionally set build properties in certain solution filters. You should instead use those solution filters (e.g. `SentryNoMobile.slnf`) when working in the Sentry codebase.

## API changes approval process

This repository uses [Verify](https://github.com/VerifyTests/Verify) to store the public API diffs in snapshot files.
Expand Down
58 changes: 58 additions & 0 deletions CodeCoverage.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Configuration>
<CodeCoverage>

<!--
Includes/Excludes:
Empty "Include" clauses imply all; empty "Exclude" clauses imply none.
Each element in the list is a regular expression (ECMAScript syntax). See /visualstudio/ide/using-regular-expressions-in-visual-studio.
An item must first match at least one entry in the include list to be included.
Included items must then not match any entries in the exclude list to remain included.
-->

<Attributes>
<Exclude>
<Attribute>^System\.Diagnostics\.DebuggerHiddenAttribute$</Attribute>
<Attribute>^System\.Diagnostics\.DebuggerNonUserCodeAttribute$</Attribute>
<Attribute>^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$</Attribute>
<Attribute>^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$</Attribute>
</Exclude>
</Attributes>

<!-- Match the path of the source files in which each method is defined: -->
<Sources>
<Exclude>
<Source>.*\\benchmarks\\.*</Source>
<Source>.*\\modules\\.*</Source>
<Source>.*\\samples\\.*</Source>
<Source>.*\\test\\.*</Source>
</Exclude>
</Sources>

<!-- We recommend you do not change the following values: -->

<!-- Set this to True to collect coverage information for functions marked with the "SecuritySafeCritical" attribute. Instead of writing directly into a memory location from such functions, code coverage inserts a probe that redirects to another function, which in turns writes into memory. -->
<UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
<!-- When set to True, collects coverage information from child processes that are launched with low-level ACLs, for example, UWP apps. -->
<AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
<!-- When set to True, collects coverage information from child processes that are launched by test or production code. -->
<CollectFromChildProcesses>True</CollectFromChildProcesses>
<!-- When set to True, restarts the IIS process and collects coverage information from it. -->
<CollectAspDotNet>False</CollectAspDotNet>
<!-- When set to True, static native instrumentation will be enabled. -->
<EnableStaticNativeInstrumentation>True</EnableStaticNativeInstrumentation>
<!-- When set to True, dynamic native instrumentation will be enabled. -->
<EnableDynamicNativeInstrumentation>True</EnableDynamicNativeInstrumentation>
<!-- When set to True, instrumented binaries on disk are removed and original files are restored. -->
<EnableStaticNativeInstrumentationRestore>True</EnableStaticNativeInstrumentationRestore>

</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<NoWarn>$(NoWarn);CS8002</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(SolutionName)' == 'Sentry.NoMobile'">
<PropertyGroup Condition="'$(SolutionName)' == '.generated.NoMobile'">
<NO_MOBILE>true</NO_MOBILE>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion SentryAspNetCore.slnf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"solution": {
"path": "Sentry.NoMobile.sln",
"path": ".generated.NoMobile.sln",
"projects": [
"samples\\Sentry.Samples.AspNetCore.Basic\\Sentry.Samples.AspNetCore.Basic.csproj",
"samples\\Sentry.Samples.AspNetCore.Blazor.Server\\Sentry.Samples.AspNetCore.Blazor.Server.csproj",
Expand Down
2 changes: 1 addition & 1 deletion SentryCore.slnf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"solution": {
"path": "Sentry.NoMobile.sln",
"path": ".generated.NoMobile.sln",
"projects": [
"benchmarks\\Sentry.Benchmarks\\Sentry.Benchmarks.csproj",
"samples\\Sentry.Samples.Console.Basic\\Sentry.Samples.Console.Basic.csproj",
Expand Down
2 changes: 1 addition & 1 deletion SentryDiagnosticSource.slnf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"solution": {
"path": "Sentry.NoMobile.sln",
"path": ".generated.NoMobile.sln",
"projects": [
"src\\Sentry.DiagnosticSource\\Sentry.DiagnosticSource.csproj",
"src\\Sentry.Extensions.Logging\\Sentry.Extensions.Logging.csproj",
Expand Down
2 changes: 1 addition & 1 deletion SentryNoMobile.slnf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"solution": {
"path": "Sentry.NoMobile.sln",
"path": ".generated.NoMobile.sln",
"projects": [
"benchmarks\\Sentry.Benchmarks\\Sentry.Benchmarks.csproj",
"samples\\Sentry.Samples.AspNetCore.Basic\\Sentry.Samples.AspNetCore.Basic.csproj",
Expand Down
10 changes: 5 additions & 5 deletions scripts/generate-solution-filters-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ coreSolution: Sentry.sln
# copies of Sentry.sln that are used to set certain build
# properties when using solution filters that are based on these
buildSolutions:
- Sentry.NoMobile.sln
- .generated.NoMobile.sln

groupConfigs:
allProjects:
Expand Down Expand Up @@ -83,7 +83,7 @@ filterConfigs:
- "test/**/*.csproj"

- outputPath: SentryAspNetCore.slnf
solution: Sentry.NoMobile.sln
solution: .generated.NoMobile.sln
include:
patterns:
- "**/*AspNetCore*.csproj"
Expand All @@ -109,7 +109,7 @@ filterConfigs:
- "**/Sentry.Tests.csproj"

- outputPath: SentryCore.slnf
solution: Sentry.NoMobile.sln
solution: .generated.NoMobile.sln
include:
patterns:
- "**/Sentry.Benchmarks.csproj"
Expand All @@ -123,7 +123,7 @@ filterConfigs:
- "**/Sentry.Tests.csproj"

- outputPath: SentryDiagnosticSource.slnf
solution: Sentry.NoMobile.sln
solution: .generated.NoMobile.sln
include:
patterns:
- "**/*DiagnosticSource*.csproj"
Expand Down Expand Up @@ -155,7 +155,7 @@ filterConfigs:
- "test/MauiTestUtils/**/*.csproj"

- outputPath: SentryNoMobile.slnf
solution: Sentry.NoMobile.sln
solution: .generated.NoMobile.sln
include:
groups:
- "allProjects"
Expand Down
17 changes: 2 additions & 15 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,16 @@
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.2" />
<PackageReference Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="19.2.29" />
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>


<!-- Configuration for Coverlet code coverage -->
<PropertyGroup Condition="'$(CollectCoverage)' == 'true'">
<Exclude>[Sentry.Protocol.Test*]*,[xunit.*]*,[System.*]*,[Microsoft.*]*,[Sentry.Test*]*</Exclude>
<CoverletOutput>./coverage/</CoverletOutput>
<CoverletOutputFormat>opencover</CoverletOutputFormat>
<!-- Deterministic report not supported by openCover reporter -->
<DeterministicReport>false</DeterministicReport>
</PropertyGroup>

<!-- only non-platform-specific projects should include these packages -->
<ItemGroup Condition="'$(TargetPlatformIdentifier)'==''">
<PackageReference Include="Verify.Xunit" Version="20.0.0" />
<PackageReference Include="Verify.DiffPlex" Version="2.2.1" />
<PackageReference Include="PublicApiGenerator" Version="11.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" PrivateAssets="All" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" PrivateAssets="All" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="coverlet.collector" Version="6.0.0" />
</ItemGroup>

<!-- these are needed because the versions that are brought in transitively have vulnerability warnings -->
Expand Down
44 changes: 44 additions & 0 deletions test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,50 @@ namespace Sentry
public Timing(Sentry.IHub hub, string key, Sentry.MeasurementUnit.Duration unit = 3, System.Collections.Generic.IDictionary<string, string>? tags = null) { }
public void Dispose() { }
}
public class Transaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext
{
public Transaction(Sentry.ITransactionTracer tracer) { }
public Transaction(string name, string operation) { }
public Transaction(string name, string operation, Sentry.TransactionNameSource nameSource) { }
public System.Collections.Generic.IReadOnlyCollection<Sentry.Breadcrumb> Breadcrumbs { get; }
public Sentry.Contexts Contexts { get; set; }
public string? Description { get; set; }
public string? Distribution { get; set; }
public System.DateTimeOffset? EndTimestamp { get; }
public string? Environment { get; set; }
public Sentry.SentryId EventId { get; }
public System.Collections.Generic.IReadOnlyDictionary<string, object?> Extra { get; }
public System.Collections.Generic.IReadOnlyList<string> Fingerprint { get; set; }
public bool IsFinished { get; }
public bool? IsParentSampled { get; set; }
public bool? IsSampled { get; }
public Sentry.SentryLevel? Level { get; set; }
public System.Collections.Generic.IReadOnlyDictionary<string, Sentry.Protocol.Measurement> Measurements { get; }
public string Name { get; }
public Sentry.TransactionNameSource NameSource { get; }
public string Operation { get; }
public Sentry.SpanId? ParentSpanId { get; }
public string? Platform { get; set; }
public string? Release { get; set; }
public Sentry.Request Request { get; set; }
public double? SampleRate { get; }
public Sentry.SdkVersion Sdk { get; }
public Sentry.SpanId SpanId { get; }
public System.Collections.Generic.IReadOnlyCollection<Sentry.SentrySpan> Spans { get; }
public System.DateTimeOffset StartTimestamp { get; }
public Sentry.SpanStatus? Status { get; }
public System.Collections.Generic.IReadOnlyDictionary<string, string> Tags { get; }
public Sentry.SentryId TraceId { get; }
public Sentry.SentryUser User { get; set; }
public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb) { }
public Sentry.SentryTraceHeader GetTraceHeader() { }
public void SetExtra(string key, object? value) { }
public void SetMeasurement(string name, Sentry.Protocol.Measurement measurement) { }
public void SetTag(string key, string value) { }
public void UnsetTag(string key) { }
public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { }
public static Sentry.Transaction FromJson(System.Text.Json.JsonElement json) { }
}
public class TransactionContext : Sentry.SpanContext, Sentry.ITransactionContext, Sentry.Protocol.ITraceContext
{
public TransactionContext(string name, string operation, Sentry.SpanId? spanId = default, Sentry.SpanId? parentSpanId = default, Sentry.SentryId? traceId = default, string? description = "", Sentry.SpanStatus? status = default, bool? isSampled = default, bool? isParentSampled = default, Sentry.TransactionNameSource nameSource = 0) { }
Expand Down
44 changes: 44 additions & 0 deletions test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,50 @@ namespace Sentry
public Timing(Sentry.IHub hub, string key, Sentry.MeasurementUnit.Duration unit = 3, System.Collections.Generic.IDictionary<string, string>? tags = null) { }
public void Dispose() { }
}
public class Transaction : Sentry.IEventLike, Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.ITransactionContext, Sentry.ITransactionData, Sentry.Protocol.ITraceContext
{
public Transaction(Sentry.ITransactionTracer tracer) { }
public Transaction(string name, string operation) { }
public Transaction(string name, string operation, Sentry.TransactionNameSource nameSource) { }
public System.Collections.Generic.IReadOnlyCollection<Sentry.Breadcrumb> Breadcrumbs { get; }
public Sentry.Contexts Contexts { get; set; }
public string? Description { get; set; }
public string? Distribution { get; set; }
public System.DateTimeOffset? EndTimestamp { get; }
public string? Environment { get; set; }
public Sentry.SentryId EventId { get; }
public System.Collections.Generic.IReadOnlyDictionary<string, object?> Extra { get; }
public System.Collections.Generic.IReadOnlyList<string> Fingerprint { get; set; }
public bool IsFinished { get; }
public bool? IsParentSampled { get; set; }
public bool? IsSampled { get; }
public Sentry.SentryLevel? Level { get; set; }
public System.Collections.Generic.IReadOnlyDictionary<string, Sentry.Protocol.Measurement> Measurements { get; }
public string Name { get; }
public Sentry.TransactionNameSource NameSource { get; }
public string Operation { get; }
public Sentry.SpanId? ParentSpanId { get; }
public string? Platform { get; set; }
public string? Release { get; set; }
public Sentry.Request Request { get; set; }
public double? SampleRate { get; }
public Sentry.SdkVersion Sdk { get; }
public Sentry.SpanId SpanId { get; }
public System.Collections.Generic.IReadOnlyCollection<Sentry.SentrySpan> Spans { get; }
public System.DateTimeOffset StartTimestamp { get; }
public Sentry.SpanStatus? Status { get; }
public System.Collections.Generic.IReadOnlyDictionary<string, string> Tags { get; }
public Sentry.SentryId TraceId { get; }
public Sentry.SentryUser User { get; set; }
public void AddBreadcrumb(Sentry.Breadcrumb breadcrumb) { }
public Sentry.SentryTraceHeader GetTraceHeader() { }
public void SetExtra(string key, object? value) { }
public void SetMeasurement(string name, Sentry.Protocol.Measurement measurement) { }
public void SetTag(string key, string value) { }
public void UnsetTag(string key) { }
public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? logger) { }
public static Sentry.Transaction FromJson(System.Text.Json.JsonElement json) { }
}
public class TransactionContext : Sentry.SpanContext, Sentry.ITransactionContext, Sentry.Protocol.ITraceContext
{
public TransactionContext(string name, string operation, Sentry.SpanId? spanId = default, Sentry.SpanId? parentSpanId = default, Sentry.SentryId? traceId = default, string? description = "", Sentry.SpanStatus? status = default, bool? isSampled = default, bool? isParentSampled = default, Sentry.TransactionNameSource nameSource = 0) { }
Expand Down

0 comments on commit f2dc7a2

Please sign in to comment.