Skip to content

CoreLib's coverage measurement is broken #1285

Closed
@ViktorHofer

Description

@ViktorHofer

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority:0Critical to the releaseblocking-usersIssue is blocking some userstracking-external-issueThe issue is caused by external problem - nothing we can do to fix it directly

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions