coverlet icon indicating copy to clipboard operation
coverlet copied to clipboard

Please add support for "Full PDB" format

Open pkrukp opened this issue 4 years ago • 3 comments

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.

pkrukp avatar Nov 26 '20 15:11 pkrukp

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

MarcoRossignoli avatar Nov 26 '20 15:11 MarcoRossignoli

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

  • publish/update coverlet used for dotnet global tool
  • why BadImageFormatException is thrown?

pkrukp avatar Feb 09 '21 13:02 pkrukp

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

github-actions[bot] avatar Oct 08 '23 01:10 github-actions[bot]