Skip to content

Commit 24df60d

Browse files
Fix Coverlet (#3019)
* Replaced Coverlet with Microsoft.CodeCoverage * Update Directory.Build.props * Changed from microsoft.codecoverage to coverlet.collector
1 parent 1f71379 commit 24df60d

File tree

4 files changed

+62
-18
lines changed

4 files changed

+62
-18
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ jobs:
114114
run: dotnet build Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-restore --nologo -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true
115115

116116
- name: Test
117-
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
117+
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"
118118

119119
- name: Upload code coverage
120120
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
*.userprefs
66
*.user
77
*opencover.xml
8+
*cobertura.xml
89
codecov.sh
910
lcov.info
1011
bin/
1112
obj/
12-
**/coverage/*.xml
13-
**/coverage/*.json
1413
.DS_Store
1514
Thumbs.db
1615
**/BenchmarkDotNet.Artifacts/*.log

CodeCoverage.runsettings

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RunSettings>
3+
<DataCollectionRunSettings>
4+
<DataCollectors>
5+
<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">
6+
<Configuration>
7+
<CodeCoverage>
8+
9+
<!--
10+
Includes/Excludes:
11+
Empty "Include" clauses imply all; empty "Exclude" clauses imply none.
12+
Each element in the list is a regular expression (ECMAScript syntax). See /visualstudio/ide/using-regular-expressions-in-visual-studio.
13+
An item must first match at least one entry in the include list to be included.
14+
Included items must then not match any entries in the exclude list to remain included.
15+
-->
16+
17+
<Attributes>
18+
<Exclude>
19+
<Attribute>^System\.Diagnostics\.DebuggerHiddenAttribute$</Attribute>
20+
<Attribute>^System\.Diagnostics\.DebuggerNonUserCodeAttribute$</Attribute>
21+
<Attribute>^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$</Attribute>
22+
<Attribute>^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$</Attribute>
23+
</Exclude>
24+
</Attributes>
25+
26+
<!-- Match the path of the source files in which each method is defined: -->
27+
<Sources>
28+
<Exclude>
29+
<Source>.*\\benchmarks\\.*</Source>
30+
<Source>.*\\modules\\.*</Source>
31+
<Source>.*\\samples\\.*</Source>
32+
<Source>.*\\test\\.*</Source>
33+
</Exclude>
34+
</Sources>
35+
36+
<!-- We recommend you do not change the following values: -->
37+
38+
<!-- 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. -->
39+
<UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
40+
<!-- When set to True, collects coverage information from child processes that are launched with low-level ACLs, for example, UWP apps. -->
41+
<AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
42+
<!-- When set to True, collects coverage information from child processes that are launched by test or production code. -->
43+
<CollectFromChildProcesses>True</CollectFromChildProcesses>
44+
<!-- When set to True, restarts the IIS process and collects coverage information from it. -->
45+
<CollectAspDotNet>False</CollectAspDotNet>
46+
<!-- When set to True, static native instrumentation will be enabled. -->
47+
<EnableStaticNativeInstrumentation>True</EnableStaticNativeInstrumentation>
48+
<!-- When set to True, dynamic native instrumentation will be enabled. -->
49+
<EnableDynamicNativeInstrumentation>True</EnableDynamicNativeInstrumentation>
50+
<!-- When set to True, instrumented binaries on disk are removed and original files are restored. -->
51+
<EnableStaticNativeInstrumentationRestore>True</EnableStaticNativeInstrumentationRestore>
52+
53+
</CodeCoverage>
54+
</Configuration>
55+
</DataCollector>
56+
</DataCollectors>
57+
</DataCollectionRunSettings>
58+
</RunSettings>

test/Directory.Build.props

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,29 +52,16 @@
5252
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
5353
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.2" />
5454
<PackageReference Include="TestableIO.System.IO.Abstractions.TestingHelpers" Version="19.2.29" />
55-
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
56-
<PrivateAssets>all</PrivateAssets>
57-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
58-
</PackageReference>
5955
</ItemGroup>
6056

61-
62-
<!-- Configuration for Coverlet code coverage -->
63-
<PropertyGroup Condition="'$(CollectCoverage)' == 'true'">
64-
<Exclude>[Sentry.Protocol.Test*]*,[xunit.*]*,[System.*]*,[Microsoft.*]*,[Sentry.Test*]*</Exclude>
65-
<CoverletOutput>./coverage/</CoverletOutput>
66-
<CoverletOutputFormat>opencover</CoverletOutputFormat>
67-
<!-- Deterministic report not supported by openCover reporter -->
68-
<DeterministicReport>false</DeterministicReport>
69-
</PropertyGroup>
70-
7157
<!-- only non-platform-specific projects should include these packages -->
7258
<ItemGroup Condition="'$(TargetPlatformIdentifier)'==''">
7359
<PackageReference Include="Verify.Xunit" Version="20.0.0" />
7460
<PackageReference Include="Verify.DiffPlex" Version="2.2.1" />
7561
<PackageReference Include="PublicApiGenerator" Version="11.0.0" />
76-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" PrivateAssets="All" />
7762
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" PrivateAssets="All" />
63+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
64+
<PackageReference Include="coverlet.collector" Version="6.0.0" />
7865
</ItemGroup>
7966

8067
<!-- these are needed because the versions that are brought in transitively have vulnerability warnings -->

0 commit comments

Comments
 (0)