Skip to content

[BUG] 6.0.1 requires dotnetsdk 8 but doesn't say thatΒ #1625

Closed

Description

@drdamour

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

  1. Bertk commented on Feb 21, 2024

    @Bertk
    Collaborator

    Thank you for reporting.

    I used the coverlet HelloWord example and the test was executed successfully.

    image

    The .NET SDK 8.0 was installed.

  2. SeWieland commented on Feb 21, 2024

    @SeWieland

    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.

  3. added
    bugSomething isn't working
    and removed
    untriagedTo be investigated
    on Feb 21, 2024
  4. andreycha commented on Feb 21, 2024

    @andreycha

    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 #1626 require at least new minor version.

  5. Bertk commented on Feb 21, 2024

    @Bertk
    Collaborator

    Sorry, I missed the to update the version.

    @MarcoRossignoli @daveMueller We should update the version to 6.1.0.

  6. SeWieland commented on Feb 21, 2024

    @SeWieland

    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

  7. andreycha commented on Feb 21, 2024

    @andreycha

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

  8. Bertk commented on Feb 21, 2024

    @Bertk
    Collaborator

    @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
  9. MarcoRossignoli commented on Feb 21, 2024

    @MarcoRossignoli
    Collaborator

    @MarcoRossignoli @daveMueller We should update the version to 6.1.0.

    Why? we bump the patch we will bump the minor if we ship a new feature and a major if we do breaking change.

  10. Bertk commented on Feb 21, 2024

    @Bertk
    Collaborator

    @MarcoRossignoli coverlet 6.0.1 is a bugfix version but requires a .NET 8.0 SDK.

    semver 2.0 has this paragraph

    What should I do if I update my own dependencies without changing the public API?

    That would be considered compatible since it does not affect the public API. Software that explicitly depends on the same dependencies as your package should have their own dependency specifications and the author will notice any conflicts. Determining whether the change is a patch level or minor level modification depends on whether you updated your dependencies in order to fix a bug or introduce new functionality. We would usually expect additional code for the latter instance, in which case it’s obviously a minor level increment.

  11. MarcoRossignoli commented on Feb 21, 2024

    @MarcoRossignoli
    Collaborator

    but requires a .NET 8.0 SDK.

    Why? we ship for
    image

    so we're good for .NET Framework and every project with tfm >= 6.0

  12. SeWieland commented on Feb 21, 2024

    @SeWieland

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

  13. 21 remaining items

  14. daveMueller commented on Mar 13, 2024

    @daveMueller
    Collaborator

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

  15. unpinned this issue on Mar 13, 2024
  16. added a commit that references this issue on Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SolvedThe issue is solved and can be closedblocking-usersIssue is blocking some usersbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions