FortuneN / FineCodeCoverage

Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too)
https://marketplace.visualstudio.com/items?itemName=FortuneNgwenya.FineCodeCoverage
Other
522 stars 40 forks source link

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

Closed rodchenkov closed 1 year ago

rodchenkov commented 1 year ago

Installed product versions

Description

It was an issue with coverlet https://github.com/coverlet-coverage/coverlet/issues/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 https://github.com/coverlet-coverage/coverlet/issues/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.

LukeOwlclaw commented 1 year ago

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" />