Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using .NET 6 (with .NET 8 installed) picking wrong version of System.Text.Json [BUG] #1639

Closed
clinington opened this issue Mar 7, 2024 · 5 comments · Fixed by #1637
Closed
Labels
duplicate This issue or pull request already exists

Comments

@clinington
Copy link

Describe the bug
So I have both sdks installed, i have a global json pinning the version to 6.0.419.

The version of coverlet.collector is 6.0.1.

Running:

dotnet test --configuration Release --filter Category!=Manual --logger trx --collect:"XPlat Code Coverage;Format=opencover,cobertura"

gets this result:

Data collector 'XPlat code coverage' message: [coverlet]System.IO.FileLoadException: Could not load file or assembly 'System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)

However, if you switch coverlet.collector to version 6.0.0 and run the same command again then the issue goes away - assuming that it has something to do with the switch from newtonsoft to system.text.json

❗ Please also read Known Issues

@github-actions github-actions bot added the untriaged To be investigated label Mar 7, 2024
@niravmsoni
Copy link

Faced the same issue in one of our pipeline after updating the package to the latest version. After downgrading it to 6.0.0, it works for me. Thanks for the workaround @clinington

@patelriki13
Copy link

patelriki13 commented Mar 8, 2024

Same issue for me... downgraded to version 6.0.0 and working fine.

@clinington
Copy link
Author

Yeah - that was my fix - then went to .net8 and bumped back up again.

However, the there's a security vulnerability with the newtonsoft package that is used by version 6.0.0 so it's not a great workaround...

@daveMueller daveMueller added duplicate This issue or pull request already exists and removed untriaged To be investigated labels Mar 10, 2024
@daveMueller
Copy link
Collaborator

Yes this is a duplicate of #1625. We already fixed this in #1637. You can try it out by consuming our nightly: https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/ConsumeNightlyBuild.md

@daveMueller
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants