Repository navigation
Description
Describe the bug
Had a build tied to 6.* for a version using sdk 6 and it failed with
Data collector 'XPlat code coverage' message: [coverlet]System.TypeLoadException: Could not load type 'Microsoft.Extensions.DependencyInjection.ServiceCollection' from assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
at Coverlet.Collector.DataCollection.CoverletCoverageCollector.GetDefaultServiceCollection(TestPlatformEqtTrace eqtTrace, TestPlatformLogger logger, String testModule)
at Coverlet.Collector.DataCollection.CoverletCoverageCollector.OnSessionStart(Object sender, SessionStartEventArgs sessionStartEventArgs) in /_/src/coverlet.collector/DataCollection/CoverletCoverageCollector.cs:line 135.
To Reproduce
build with dotnet6
Expected behavior
Expect coverlet to run and report successfully
Actual behavior
fails to generate report
Configuration (please complete the following information):
Please provide more information on your .NET configuration:
* Which coverlet package and version was used?
* reproduceable with 6.0.1
* Which version of .NET is the code running on?
* 6.0.x (tried a few versions...all reproduced)
* What OS and version, and what distro if applicable?
* window 10 and linux ubuntu (whatever azdo is using now a days)
* What is the architecture (x64, x86, ARM, ARM64)?
* x64
* Do you know whether it is specific to that configuration?
* seems not to be
Additional context
the changes in this PR #1601 seems to force having dotnet 8 installed so that thinks like System.Text.Json will load the 8.0 version from the shared framework.
β Please also read Known Issues
doesn't appear to be any
overall, seems like mistake to break backwards compatability between 6.0.0 and 6.0.1 like this...doesn't seem to match semver...but maybe that was your intent? understand 6 is EOL at end of year so we should be moving to 8 sdk soon...
Activity
Bertk commentedon Feb 21, 2024
Thank you for reporting.
I used the coverlet HelloWord example and the test was executed successfully.
The .NET SDK 8.0 was installed.
SeWieland commentedon Feb 21, 2024
Same problem here.. All our CI pipelines are failing because we are adding coverlet.collector dynamically to our test solutions via dotnet add package.
@Bertk the hello world example still uses
PackageReference Include="coverlet.collector" Version="6.0.0" >=> Version 6.0.0dotnet add package will install version 6.0.1 (a patch update that must not contain breaking changes according to SemVer) and this package does not include any dependency to system.text.json at all.
andreycha commentedon Feb 21, 2024
Have same issue. We're using .NET 6 SDK and have
coverlet.collectorreferenced as6.0.*. Having such a breaking change in a patch version is quite a surprise. Changes described in #1626 require at least new minor version.Bertk commentedon Feb 21, 2024
Sorry, I missed the to update the version.
@MarcoRossignoli @daveMueller We should update the version to
6.1.0.SeWieland commentedon Feb 21, 2024
Another idea: "SuppressDependenciesWhenPacking" is set on the collector - effectively hiding all dependencies. Would it be possible to pack these two required package references as dependencies instead or something similar?
The breaking behaviour could thus probably be reverted for .NET < 8
andreycha commentedon Feb 21, 2024
@Bertk would it be also possible to release 6.0.2 with reverted changes?
Bertk commentedon Feb 21, 2024
@SeWieland Thank you for the hint but coverlet.collector package has no dependencies. The dilemma is the support for framework net6.0, net7.0 and net8.0 and this works with the latest packages for
MarcoRossignoli commentedon Feb 21, 2024
Why? we bump the patch we will bump the minor if we ship a new feature and a major if we do breaking change.
Bertk commentedon Feb 21, 2024
@MarcoRossignoli coverlet 6.0.1 is a bugfix version but requires a .NET 8.0 SDK.
semver 2.0 has this paragraph
MarcoRossignoli commentedon Feb 21, 2024
Why? we ship for

so we're good for .NET Framework and every project with tfm >= 6.0
SeWieland commentedon Feb 21, 2024
IMHO if there is support for .NET 6.0 it now has dependencies. If I have to pin other packages to a specific version for coverlet to be compatible, that package is a depdendency... Therefore, right now my workaround is to pin coverlet to v6.0.0 in all .NET 6 projects.
21 remaining items
daveMueller commentedon Mar 13, 2024
We now have a new official release
6.0.2that can be consumed from nuget.org.Bump coverlet.collector from 3.1.2 to 6.0.4 (#6)
chore(csharp): Bump coverlet.collector from 6.0.0 to 6.0.4 (#3314)
chore(csharp): Bump coverlet.collector from 6.0.0 to 6.0.4 (#3532)
Merge with ADBC 21 (#87)
Bump coverlet.console from 6.0.0 to 6.0.4 (#11)
Merged PR 16220: Update dependency coverlet.collector to v6
Bump coverlet.collector from 6.0.0 to 6.0.4 (#105)
Bump coverlet.collector from 6.0.0 to 6.0.4 (#9)
Bump coverlet.collector from 6.0.0 to 6.0.4 (#9)
Bump coverlet.collector from 6.0.0 to 10.0.1 (#54)
Bump coverlet.collector from 6.0.0 to 10.0.1 (#46)
Bump coverlet.msbuild from 6.0.0 to 10.1.0 (#7768)