question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CoreLib's coverage measurement is broken

See original GitHub issue

After 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

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:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
stephentoubcommented, Feb 1, 2022

Thank you for working on the fixes, @MarcoRossignoli.

1reaction
MarcoRossignolicommented, Jan 31, 2022

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found