CoreLib's coverage measurement is broken
See original GitHub issueAfter figuring out why CoreLib doesn’t write the result file when being instrumented by coverlet and working around the issue, I noticed that the WriteLog
and WriteHits
methods in the ModuleTrackerTemplate
throw:
Unhandled exception. System.TypeLoadException: Could not load type 'System.Diagnostics.Process' from assembly 'System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'.
at Coverlet.Core.Instrumentation.Tracker.System.Private.CoreLib_19e73ecb-b988-441a-913d-54373b41abc8.WriteLog(String)
at Coverlet.Core.Instrumentation.Tracker.System.Private.CoreLib_19e73ecb-b988-441a-913d-54373b41abc8.UnloadModule(Object, EventArgs)
at System.AppContext.OnProcessExit() in C:\git\runtime3\src\libraries\System.Private.CoreLib\src\System\AppContext.cs:line 88
- https://github.com/coverlet-coverage/coverlet/blob/df968b862687aeb9ac86ae47938da04d95c10452/src/coverlet.core/Instrumentation/ModuleTrackerTemplate.cs#L176
- https://github.com/coverlet-coverage/coverlet/blob/df968b862687aeb9ac86ae47938da04d95c10452/src/coverlet.core/Instrumentation/ModuleTrackerTemplate.cs#L200
That’s because CoreLib doesn’t have access to the Process type and even though those code paths aren’t running by default, they are in the IL and hence the types are tried to be resolved. To unblock dotnet/runtime it would be great if these code paths that rely on Process
could be changed to not include the process id.
cc @stephentoub
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Code coverage of System.Private.CoreLib is broken · Issue #51058
CoreLib code coverage measurement is broken because the following negative path is hit during coverlet's CanInstrument() check: ...
Read more >Releases · coverlet-coverage/coverlet
-Fix CoreLib's coverage measurement is broken #1286 -Fix UnloadModule injection 1291 · Diff between 3.1.1 and 3.1.2. Assets 5.
Read more >[C#] Bump coverlet.collector from 1.2.0 to 6.0.0 in /csharp
... -Fix CoreLib's coverage measurement is broken <a href="https://redirect.github.com/coverlet-coverage/coverlet/pull/1286";>#1286</a> -Fix ...
Read more >[pitch] Swift Benchmarking Infrastructure - Package Manager
Storage of baseline data. This is currently broken in swift-corelibs-xctest and even if fixed doesn't support cross-platform development that ...
Read more >scalac-scoverage-plugin
scalac-scoverage-plugin. scoverage is a free Apache licensed code coverage tool for scala that offers statement and branch coverage. scoverage is available ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for working on the fixes, @MarcoRossignoli.
We’ll ship nightly build at midnight, would be great is someone tomorrow give it a try to check if this first issue is solved https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/ConsumeNightlyBuild.md