coverlet: [BUG] 6.0.1 requires dotnetsdk 8 but doesn't say that

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 https://github.com/coverlet-coverage/coverlet/pull/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…

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 13
  • Comments: 24

Commits related to this issue

Most upvoted comments

@daveMueller

It is working now. Tested with image: mcr.microsoft.com/dotnet/sdk:6.0 and coverlet.collector --version 6.0.2-preview.8.g892d86e16b

When do you expect to have a new version released with the issue solved?

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.0

dotnet 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.

We now have a new official release 6.0.2 that can be consumed from nuget.org.

hope we see a release soon

Have same issue. We’re using .NET 6 SDK and have coverlet.collector referenced as 6.0.*. Having such a breaking change in a patch version is quite a surprise. Changes described in https://github.com/coverlet-coverage/coverlet/pull/1626 require at least new minor version.

Hi guys, we finally merged everything we broke with the last release. We would really appreciate if someone could give it a try. Here is how to consume the nightly: https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/ConsumeNightlyBuild.md

@Bertk would it be also possible to release 6.0.2 with reverted changes?

@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

    <PackageReference Include="System.Reflection.Metadata" VersionOverride="8.0.0" />
    <PackageReference Include="System.Collections.Immutable" VersionOverride="8.0.0" />
image

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.