Description
Describe the bug
After upgrading from 6.0.0 to 6.0.1 the tests fail with errors initializing Coverlet
To Reproduce
Updated from 6.0.0 to 6.0.1.
Project being tested targets netstandard2.0. Only external reference is Newtonsoft.Json 13.0.3
Test project targets 4.7.2 and has the following references:
<PackageReference Include="coverlet.msbuild" Version="6.0.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="Nunit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="WireMock.Net" Version="1.5.40" />
Expected behavior
Tests to run without crashing
Actual behavior
System.TypeInitializationException : The type initializer for 'Coverlet.Core.Instrumentation.Tracker.OutSystems.Auditing_cbebb53f-99cc-461e-8124-db81357fd8a1' threw an exception.
----> System.IO.FileNotFoundException : Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Stack Trace:
at Coverlet.Core.Instrumentation.Tracker.OutSystems.Auditing_cbebb53f-99cc-461e-8124-db81357fd8a1.RecordHit(Int32 )
at Auditing.Tests.AuditConfigTests.AuditConfigRequestTimeoutTest() in D:\a\1\s\tests\UnitTests\Auditing.Tests\AuditConfigTests.cs:line 12
--FileNotFoundException
at Coverlet.Core.Instrumentation.Tracker.OutSystems.Auditing_cbebb53f-99cc-461e-8124-db81357fd8a1..cctor()
Configuration (please complete the following information):
Please provide more information on your .NET configuration:
* Which coverlet package and version was used? 6.0.1
* Which version of .NET is the code running on? 4.7.2
* What OS and version, and what distro if applicable? Windows 2022 (Azure CI agent windows-latest)
* What is the architecture (x64, x86, ARM, ARM64)?
* Do you know whether it is specific to that configuration? Don't know
Additional context
Current command being used to execute the tests:
dotnet test D:\a\1\s\tests\UnitTests\Auditing.Tests --configuration Release --no-restore --no-build --logger trx --framework net472 /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:ExcludeByFile=**/GitVersionInformation.* /p:CoverletOutput=D:\a\TestResults\coverage.net472.1.xml
Currently I'm not able to switch execution mode to the --collect version due to the test CI templates being shared by all our or organizational repositories. So cannot test with the --collect:"XPlat Code Coverage" option