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

Data collector did not generate coverage.cobertura.xml #301

Closed
rodchenkov opened this issue Oct 30, 2022 · 1 comment
Closed

Data collector did not generate coverage.cobertura.xml #301

rodchenkov opened this issue Oct 30, 2022 · 1 comment

Comments

@rodchenkov
Copy link

Installed product versions

  • Visual Studio: 2022 Professional
  • This extension: 1.1.187

Description

It was an issue with coverlet coverlet-coverage/coverlet#1390 and in version 3.2.0 it is solved
I see that you have dependency on it's previous version and looks like simple update will solve issue with FineCodeCoverage, because now I'm getting same error in Visual Studio, while during CI/CD all works fine

Steps to recreate

  1. Create simple project same as decried here TypeLoadException error (DependencyInjection) with latest EFCore coverlet-coverage/coverlet#1390
  2. Use VS 2022 with installed extension
  3. Run tests
  4. Tests run successfully while FineCodeCoverage empty and shows error in logs

Current behavior

Tests run successfully while FineCodeCoverage empty and shows error in logs

Expected behavior

Tests run successfully and FineCodeCoverage shows coverage report

Side Notes

I think that we just need to update coverlet.collector lib to latest version (now it is 3.2.0) and everything will be solved.

tonyhallett added a commit that referenced this issue Oct 31, 2022
update coverlet to latest version fix #301
@LukeOwlclaw
Copy link

LukeOwlclaw commented Feb 6, 2023

I faced this problem using version 3.2.0:

Data collector 'XPlat code coverage' message: [coverlet]System.TypeLoadException: Could not load type 'Microsoft.Extensions.DependencyInjection.ServiceCollection' from assembly 'Microsoft.Extensions.DependencyInjection, Version=6.0.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 132.

If anyone needs a quick fix:
Add to test project:

<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants