Skip to content

Commit 06ce08a

Browse files
committed
Update .NET versions and project configurations
- Set `NetCurrent` to `net9.0` and `NetMinimum` to `net8.0` in `Directory.Build.props`. - Updated SDK version in `global.json` to `9.0.203`. - Changed target frameworks in `coverlet.collector.csproj`, `coverlet.console.csproj`, `coverlet.core.csproj`, and `coverlet.msbuild.tasks.csproj` to support multiple frameworks. - Modified `CoverletToolsPath` in `Directory.Build.targets` to include `netstandard2.0`. - Updated coverage file naming in `Msbuild.cs` to reflect the build target framework.
1 parent 0a2024d commit 06ce08a

30 files changed

+231
-165
lines changed

Diff for: Directory.Build.props

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<Project>
33
<PropertyGroup>
44
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
5+
<NetCurrent>net9.0</NetCurrent>
6+
<NetMinimum>net8.0</NetMinimum>
7+
<FullFrameworkTFM>net472</FullFrameworkTFM>
58
<!-- enforce CamelCase case string-->
69
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
710
<!-- SourceLink Setup -->
@@ -39,12 +42,12 @@
3942
</ItemGroup>
4043

4144
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT' ">
42-
<VSTestResultsDirectory>$(RepoRoot)artifacts/testresults/$(Configuration.ToLowerInvariant())</VSTestResultsDirectory>
45+
<VSTestResultsDirectory>$(RepoRoot)artifacts/reports/$(Configuration.ToLowerInvariant())</VSTestResultsDirectory>
4346
<VSTestLogger>@(VSTestLogger)</VSTestLogger>
4447
</PropertyGroup>
4548

4649
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
47-
<VSTestResultsDirectory>$(RepoRoot)artifacts\testresults\$(Configuration.ToLowerInvariant())</VSTestResultsDirectory>
50+
<VSTestResultsDirectory>$(RepoRoot)artifacts\reports\$(Configuration.ToLowerInvariant())</VSTestResultsDirectory>
4851
<VSTestLogger>@(VSTestLogger)</VSTestLogger>
4952
</PropertyGroup>
5053

Diff for: Directory.Packages.props

+9-16
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,23 @@
88
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.7.115" />
99
</ItemGroup>
1010
<PropertyGroup>
11-
<MicrosoftBuildVersion>17.13.9</MicrosoftBuildVersion>
12-
<MicrosoftCodeAnalysisVersion>4.12.0</MicrosoftCodeAnalysisVersion>
11+
<MicrosoftBuildVersion>17.11.4</MicrosoftBuildVersion>
12+
<MicrosoftCodeAnalysisVersion>4.13.0</MicrosoftCodeAnalysisVersion>
1313
<!-- Test Platform, .NET Test SDK and Object Model -->
1414
<MicrosoftNETTestSdkVersion>17.13.0</MicrosoftNETTestSdkVersion>
1515
<NugetPackageVersion>6.13.2</NugetPackageVersion>
1616
<XunitV3Version>2.0.0</XunitV3Version>
1717
<XunitRunnerVisualstudioVersion>3.0.2</XunitRunnerVisualstudioVersion>
18+
<SystemCollectionsImmutableVersion>6.0.0</SystemCollectionsImmutableVersion>
19+
<SystemMemoryVersion>4.5.5</SystemMemoryVersion>
20+
<MicrosoftBclAsyncInterfacesVersion>8.0.0</MicrosoftBclAsyncInterfacesVersion>
1821
</PropertyGroup>
1922
<ItemGroup>
2023
<PackageVersion Include="DotNetConfig" Version="1.2.0" />
2124
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
2225
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildVersion)" />
2326
<PackageVersion Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildVersion)" />
24-
<PackageVersion Include="Microsoft.Build.Locator" Version="1.7.8" />
27+
<PackageVersion Include="Microsoft.Build.Locator" Version="1.9.1" />
2528
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="$(MicrosoftCodeAnalysisVersion)" />
2629
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="8.0.2" />
2730
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
@@ -30,16 +33,6 @@
3033
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" />
3134
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkVersion)" />
3235
<PackageVersion Include="Microsoft.TestPlatform.ObjectModel" Version="$(MicrosoftNETTestSdkVersion)" />
33-
<!-- Microsoft.TestPlatform.ObjectModel has a dependency to NuGet.Frameworks with specific version -->
34-
<!-- https://github.com/microsoft/vstest/blob/9a0c41811637edf4afe0e265e08fdd1cb18109ed/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj#L36-->
35-
<!-- wrong configuration will create "build\coverlet.msbuild.targets(72,5): error : Unable to read beyond the end of the stream." -->
36-
<!--
37-
vstest 17.5 version /scripts/build/TestPlatform.Dependencies.props
38-
https://github.com/microsoft/vstest/blob/81f87947b316a4faf2bcb5b8c8fa1591baafcc39/scripts/build/TestPlatform.Dependencies.props#L57
39-
vstest 17.8 version
40-
NuGetFrameworksVersion is defined here https://github.com/microsoft/vstest/blob/9a0c41811637edf4afe0e265e08fdd1cb18109ed/eng/Versions.props#L94C1-L94C1
41-
-->
42-
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
4336
<PackageVersion Include="NuGet.Frameworks" Version="$(NugetPackageVersion)" />
4437
<PackageVersion Include="NuGet.Packaging" Version="$(NugetPackageVersion)" />
4538
<PackageVersion Include="NuGet.Versioning" Version="$(NugetPackageVersion)" />
@@ -58,14 +51,14 @@
5851
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
5952
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
6053
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
61-
<PackageVersion Include="System.Memory" Version="4.6.0" />
54+
<PackageVersion Include="System.Memory" Version="4.6.3" />
6255
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
6356
<PackageVersion Include="System.Reflection.Metadata" Version="8.0.1" />
64-
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.0" />
57+
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.2" />
6558
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="6.0.5" />
6659
<PackageVersion Include="System.Text.Encoding.CodePages" Version="8.0.0" />
6760
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
6861
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
69-
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.6.0" />
62+
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.6.3" />
7063
</ItemGroup>
7164
</Project>

Diff for: README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ Coverlet supports only SDK-style projects https://docs.microsoft.com/en-us/visua
4444
```bash
4545
dotnet add package coverlet.collector
4646
```
47-
48-
N.B. You **MUST** add package only to test projects and if you create xunit test projects (`dotnet new xunit`) you'll find the reference already present in `csproj` file because Coverlet is the default coverage tool for every .NET Core and >= .NET 6 applications, you've only to update to last version if needed. Do not add `coverlet.collector` and `coverlet.msbuild` package in a test project.
47+
> [!NOTE]
48+
> You **MUST** add package only to test projects and if you create xunit test projects (`dotnet new xunit`) you will find the reference already present in `csproj` file because Coverlet is the default coverage tool for every .NET Core and >= *.NET 8* applications, you've only to update to last version if needed. Add `coverlet.collector` *OR* `coverlet.msbuild` package in a test project.
4949
5050
### Usage (coverlet.collector)
5151

@@ -61,11 +61,11 @@ See [documentation](Documentation/VSTestIntegration.md) for advanced usage.
6161

6262
#### Requirements (coverlet.collector)
6363

64-
* _You need to be running .NET 6.0 SDK v6.0.316 or newer_
65-
* _You need to reference version 17.5.0 and above of Microsoft.NET.Test.Sdk_
64+
* _You need to be running .NET 8.0 SDK v8.0.112 or newer_
65+
* _You need to reference version 17.12.0 and above of Microsoft.NET.Test.Sdk_
6666

6767
```xml
68-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
68+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
6969
```
7070

7171
### MSBuild Integration (suffers of possible [known issue](https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/KnownIssues.md#1-vstest-stops-process-execution-earlydotnet-test))
@@ -120,7 +120,7 @@ See [documentation](Documentation/GlobalTool.md) for advanced usage.
120120

121121
.NET global tools rely on a .NET Core runtime installed on your machine https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools#what-could-go-wrong
122122

123-
.NET Coverlet global tool requires _.NET Core 2.2 and above_
123+
.NET Coverlet global tool requires _.NET 8.0 or above_
124124

125125
## How It Works
126126

Diff for: eng/build.yml

+12-6
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ steps:
44
version: 6.0.428
55
displayName: Install .NET Core SDK 6.0.428
66

7+
- task: UseDotNet@2
8+
inputs:
9+
version: 8.0.114
10+
displayName: Install .NET Core SDK 8.0.114
11+
712
- task: UseDotNet@2
813
inputs:
914
useGlobalJson: true
10-
displayName: Install .NET Core SDK 8.0.113
15+
displayName: Install .NET Core SDK 9.0.202
1116

1217
# create artifact/package folder
1318
- pwsh: |
@@ -25,11 +30,12 @@ steps:
2530
displayName: Pack
2631

2732
- script: |
28-
dotnet test test/coverlet.core.tests/coverlet.core.tests.csproj -c $(BuildConfiguration) --no-build -bl:test.core.binlog /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.projectsample]*" /p:ExcludeByAttribute="GeneratedCodeAttribute" -- --results-directory "$(Build.SourcesDirectory)/artifacts/Reports" --report-xunit-trx --report-xunit-trx-filename "coverlet.core.tests.trx" --diagnostic --diagnostic-output-directory "$(Build.SourcesDirectory)/artifacts/log/$(buildConfiguration)" --diagnostic-output-fileprefix "coverlet.core.tests"
29-
dotnet test test/coverlet.core.coverage.tests/coverlet.core.coverage.tests.csproj -c $(BuildConfiguration) --no-build -bl:test.core.coverage.binlog /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.projectsample]*" /p:ExcludeByAttribute="GeneratedCodeAttribute" -- --results-directory "$(Build.SourcesDirectory)/artifacts/Reports" --report-xunit-trx --report-xunit-trx-filename "coverlet.core.coverage.tests.trx" --diagnostic --diagnostic-output-directory "$(Build.SourcesDirectory)/artifacts/log/$(buildConfiguration)" --diagnostic-output-fileprefix "coverlet.core.coverage.tests"
30-
dotnet test test/coverlet.msbuild.tasks.tests/coverlet.msbuild.tasks.tests.csproj -c $(BuildConfiguration) --no-build -bl:test.msbuild.binlog --results-directory:"$(Build.SourcesDirectory)\artifacts\Reports" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.xunit.extensions]*%2c[coverlet.tests.projectsample]*%2c[testgen_]*" /p:ExcludeByAttribute="GeneratedCodeAttribute" --diag:"$(Build.SourcesDirectory)\artifacts\log\$(buildConfiguration)\coverlet.msbuild.test.diag.log;tracelevel=verbose"
31-
dotnet test test/coverlet.collector.tests/coverlet.collector.tests.csproj -c $(BuildConfiguration) --no-build -bl:test.collector.binlog /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.projectsample]*" /p:ExcludeByAttribute="GeneratedCodeAttribute" --diag:"$(Build.SourcesDirectory)/artifacts/log/$(buildConfiguration)/coverlet.collector.test.diag.log;tracelevel=verbose"
32-
dotnet test test/coverlet.integration.tests/coverlet.integration.tests.csproj -c $(BuildConfiguration) --no-build -bl:test.integration.binlog -- --results-directory "$(Build.SourcesDirectory)/artifacts/Reports" --report-xunit-trx --report-xunit-trx-filename "coverlet.integration.tests.trx" --diagnostic --diagnostic-output-directory "$(Build.SourcesDirectory)/artifacts/log/$(buildConfiguration)" --diagnostic-output-fileprefix "coverlet.integration.tests"
33+
dotnet test test/coverlet.core.tests/coverlet.core.tests.csproj -c $(BuildConfiguration) --no-build -bl:test.core.binlog /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.projectsample]*" /p:ExcludeByAttribute="GeneratedCodeAttribute" --diag:"$(Build.SourcesDirectory)/artifacts/log/coverlet.core.test.diag.$(BuildConfiguration.log;tracelevel=verbose"
34+
dotnet test test/coverlet.core.coverage.tests/coverlet.core.coverage.tests.csproj -c $(BuildConfiguration) --no-build -bl:test.core.coverage.binlog /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.projectsample]*" /p:ExcludeByAttribute="GeneratedCodeAttribute" --diag:"$(Build.SourcesDirectory)/artifacts/log/coverlet.core.coverage.test.diag.$(BuildConfiguration.log;tracelevel=verbose"
35+
dotnet test test/coverlet.msbuild.tasks.tests\coverlet.msbuild.tasks.tests.csproj -c $(BuildConfiguration) --no-build -bl:test.msbuild.tasks.binlog /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.projectsample]*" /p:ExcludeByAttribute="GeneratedCodeAttribute" --diag:"$(Build.SourcesDirectory)/artifacts/log/coverlet.collector.tests.diag.$(buildConfiguration).log;tracelevel=verbose"
36+
dotnet test test/coverlet.collector.tests/coverlet.collector.tests.csproj -c $(BuildConfiguration) --no-build -bl:test.collector.binlog /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.projectsample]*" /p:ExcludeByAttribute="GeneratedCodeAttribute" --diag:"$(Build.SourcesDirectory)/artifacts/log/coverlet.collector.test.diag.$(buildConfiguration).log;tracelevel=verbose"
37+
dotnet test test/coverlet.integration.tests/coverlet.integration.tests.csproj -c $(BuildConfiguration) -f net8.0 --no-build -bl:test.integration.binlog --diag:"$(Build.SourcesDirectory)/artifacts/log/coverlet.integration.tests.diag.net8.0.$(buildConfiguration).log;tracelevel=verbose"
38+
dotnet test test/coverlet.integration.tests/coverlet.integration.tests.csproj -c $(BuildConfiguration) -f net9.0 --no-build -bl:test.integration.binlog --diag:"$(Build.SourcesDirectory)/artifacts/log/coverlet.integration.tests.diag.net9.0.$(buildConfiguration).log;tracelevel=verbose"
3339
displayName: Run unit tests with coverage
3440
env:
3541
MSBUILDDISABLENODEREUSE: 1

Diff for: eng/publish-coverlet-result-files.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ steps:
3434
condition: always()
3535
inputs:
3636
SourceFolder: '$(Build.SourcesDirectory)'
37-
Contents: '**/*.binlog'
37+
Contents: '*.binlog'
38+
TargetFolder: '$(Build.SourcesDirectory)/artifacts/TestLogs'
39+
40+
- task: CopyFiles@2
41+
displayName: Copy DeterministicBuild binlog files
42+
condition: always()
43+
inputs:
44+
SourceFolder: '$(Build.SourcesDirectory)'
45+
Contents: 'test\coverlet.integration.determisticbuild\*.binlog'
3846
TargetFolder: '$(Build.SourcesDirectory)/artifacts/TestLogs'
3947

4048
- task: PublishPipelineArtifact@1

Diff for: global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "8.0.407"
3+
"version": "9.0.203"
44
}
55
}

Diff for: src/coverlet.collector/coverlet.collector.csproj

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>netstandard2.0</TargetFramework>
3+
<TargetFrameworks>$(NetMinimum);netstandard2.0</TargetFrameworks>
44
<AssemblyTitle>coverlet.collector</AssemblyTitle>
55
<DevelopmentDependency>true</DevelopmentDependency>
66
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
@@ -40,8 +40,11 @@
4040
<ItemGroup>
4141
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" />
4242
<PackageReference Include="NuGet.Frameworks" />
43+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
44+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
4345
</ItemGroup>
4446

47+
4548
<ItemGroup>
4649
<None Include="$(MSBuildThisFileDirectory)..\..\_assets\coverlet-icon.png" Pack="true" PackagePath="\" />
4750
<None Include="..\..\Documentation\VSTestIntegration.md" Link="VSTestIntegration.md" Pack="true" PackagePath="\">

Diff for: src/coverlet.console/coverlet.console.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFrameworks>$(NetMinimum)</TargetFrameworks>
66
<ToolCommandName>coverlet</ToolCommandName>
77
<PackAsTool>true</PackAsTool>
88
<AssemblyTitle>coverlet.console</AssemblyTitle>
@@ -25,6 +25,7 @@
2525

2626
<ItemGroup>
2727
<PackageReference Include="System.CommandLine" />
28+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
2829
</ItemGroup>
2930

3031
<ItemGroup>

Diff for: src/coverlet.core/Coverage.cs

+17-8
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
using System.IO;
77
using System.Linq;
88
using System.Runtime.Serialization;
9+
using System.Text.Json;
10+
using System.Text.Json.Nodes;
911
using Coverlet.Core.Abstractions;
1012
using Coverlet.Core.Helpers;
1113
using Coverlet.Core.Instrumentation;
12-
using Newtonsoft.Json;
13-
using Newtonsoft.Json.Linq;
1414

1515
namespace Coverlet.Core
1616
{
@@ -60,6 +60,14 @@ internal class Coverage
6060

6161
public string Identifier { get; }
6262

63+
readonly JsonSerializerOptions _options = new()
64+
{
65+
PropertyNameCaseInsensitive = true,
66+
DictionaryKeyPolicy = JsonNamingPolicy.CamelCase,
67+
IncludeFields = true,
68+
WriteIndented = true
69+
};
70+
6371
public Coverage(string moduleOrDirectory,
6472
CoverageParameters parameters,
6573
ILogger logger,
@@ -313,7 +321,7 @@ public CoverageResult GetCoverageResult()
313321
{
314322
_logger.LogInformation($"MergeWith: '{_parameters.MergeWith}'.");
315323
string json = _fileSystem.ReadAllText(_parameters.MergeWith);
316-
coverageResult.Merge(JsonConvert.DeserializeObject<Modules>(json));
324+
coverageResult.Merge(JsonSerializer.Deserialize<Modules>(json, _options));
317325
}
318326
else
319327
{
@@ -366,8 +374,8 @@ private void CalculateCoverage()
366374
var documents = result.Documents.Values.ToList();
367375
if (_parameters.UseSourceLink && result.SourceLink != null)
368376
{
369-
JToken jObject = JObject.Parse(result.SourceLink)["documents"];
370-
Dictionary<string, string> sourceLinkDocuments = JsonConvert.DeserializeObject<Dictionary<string, string>>(jObject.ToString());
377+
JsonNode jObject = JsonNode.Parse(result.SourceLink)["documents"];
378+
Dictionary<string, string> sourceLinkDocuments = JsonSerializer.Deserialize<Dictionary<string, string>>(jObject.ToString());
371379
foreach (Document document in documents)
372380
{
373381
document.Path = GetSourceLinkUrl(sourceLinkDocuments, document.Path);
@@ -480,9 +488,9 @@ internal string GetSourceLinkUrl(Dictionary<string, string> sourceLinkDocuments,
480488
{
481489
string key = sourceLinkDocument.Key;
482490
if (Path.GetFileName(key) != "*") continue;
483-
491+
#pragma warning disable IDE0057
484492
IReadOnlyList<SourceRootMapping> rootMapping = _sourceRootTranslator.ResolvePathRoot(key.Substring(0, key.Length - 1));
485-
493+
#pragma warning restore IDE0057
486494
foreach (string keyMapping in rootMapping is null ? [key] : new List<string>(rootMapping.Select(m => m.OriginalPath)))
487495
{
488496
string directoryDocument = Path.GetDirectoryName(document);
@@ -494,8 +502,9 @@ internal string GetSourceLinkUrl(Dictionary<string, string> sourceLinkDocuments,
494502
{
495503
if (!directoryDocument.StartsWith(sourceLinkRoot + Path.DirectorySeparatorChar))
496504
continue;
497-
505+
#pragma warning disable IDE0057
498506
relativePath = directoryDocument.Substring(sourceLinkRoot.Length + 1);
507+
#pragma warning restore IDE0057
499508
}
500509

501510
if (relativePathOfBestMatch.Length == 0)

Diff for: src/coverlet.core/CoverageResult.cs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Collections.Generic;
55
using System.Linq;
6+
using System.Text.Json.Serialization;
67
using Coverlet.Core.Enums;
78
using Coverlet.Core.Instrumentation;
89

@@ -22,6 +23,7 @@ internal class Branches : List<BranchInfo> { }
2223

2324
internal class Method
2425
{
26+
[JsonConstructor]
2527
internal Method()
2628
{
2729
Lines = [];

Diff for: src/coverlet.core/Exceptions.cs

-8
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,17 @@
55

66
namespace Coverlet.Core.Exceptions
77
{
8-
[Serializable]
98
public class CoverletException : Exception
109
{
1110
public CoverletException() { }
1211
public CoverletException(string message) : base(message) { }
1312
public CoverletException(string message, System.Exception inner) : base(message, inner) { }
14-
protected CoverletException(
15-
System.Runtime.Serialization.SerializationInfo info,
16-
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
1713
}
1814

19-
[Serializable]
2015
internal class CecilAssemblyResolutionException : CoverletException
2116
{
2217
public CecilAssemblyResolutionException() { }
2318
public CecilAssemblyResolutionException(string message) : base(message) { }
2419
public CecilAssemblyResolutionException(string message, System.Exception inner) : base(message, inner) { }
25-
protected CecilAssemblyResolutionException(
26-
System.Runtime.Serialization.SerializationInfo info,
27-
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
2820
}
2921
}

0 commit comments

Comments
 (0)