Closed pkrukp closed 2 months 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
Hmm some additional data. Maybe the problem lies in the coverlet.console and/or the dotnet global tool?
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
This issue is stale because it has been open for 3 months with no activity.
This issue was closed because it has been inactive for 9 months since being marked as stale.
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.