coverlet-coverage / coverlet

Cross platform code coverage for .NET
MIT License
2.98k stars 385 forks source link

Please add support for "Full PDB" format #1003

Closed pkrukp closed 2 months ago

pkrukp commented 3 years ago

Currently only Portable PDB format is supported (even though Mono.Cecil should support both). Because of this, collecting coverage from .NET Framework projects is not possible (they use Full PDB by default).

See #1001 for details.

MarcoRossignoli commented 3 years ago

collecting coverage from .NET Framework projects is not possible

Clarification, it's possible for .NET Framework project only changing the debugging information to portable pdb

image

pkrukp commented 3 years ago

Hmm some additional data. Maybe the problem lies in the coverlet.console and/or the dotnet global tool?

Details

I can collect coverage from Full PDB from UT.

For Application coverage, I have installed coverlet as global tool, as instructed in the Coverlet's Readme.md: dotnet tool install --global coverlet.console. It looks like it has old version:

>dotnet tool list -g
Package Id                             Version      Commands
-------------------------------------------------------------------
coverlet.console                       1.7.2        coverlet

That version can't collect coverage from Full PDB it seems. After I have downloaded latest coverlet.console.3.0.2.nupkg I was able to collect coverage, although there are also some warnings about PDB:

>dotnet ..\coverlet.console.3.0.2.nupkg\tools\net5.0\any\coverlet.console.dll bin\Debug --target bin\Debug\consoleFramework.exe
BadImageFormatException during MetadataReaderProvider.FromPortablePdbStream in InstrumentationHelper.PortablePdbHasLocalSource, unable to check if module has got local source.
Hello there

Calculating coverage result...
  Generating report 'C:\Users\pkruk\Downloads\coverlet\consoleFramework\coverage.json'
+------------------+------+--------+--------+
| Module           | Line | Branch | Method |
+------------------+------+--------+--------+
| consoleFramework | 100% | 100%   | 100%   |
+------------------+------+--------+--------+

+---------+------+--------+--------+
|         | Line | Branch | Method |
+---------+------+--------+--------+
| Total   | 100% | 100%   | 100%   |
+---------+------+--------+--------+
| Average | 100% | 100%   | 100%   |
+---------+------+--------+--------+

coverage.json lists all 3 lines of this program :) and they are covered

Summary

github-actions[bot] commented 12 months ago

This issue is stale because it has been open for 3 months with no activity.

github-actions[bot] commented 2 months ago

This issue was closed because it has been inactive for 9 months since being marked as stale.