Closed Qonfused closed 1 year ago
Note that this workaround requires disposing of the DataTarget instance before the ClrRuntime, as the ClrRuntime will call each helper class's Dispose
methods. This workaround sets the _dispose
property to True to mark the class as disposed, which skips the subsequent calls that would call the problematic Dispose()
method.
Edit: Refer to commits 6170685..cd81390
for the applied changes.
The WindowsProcessDataReader's dispose method attempts to kill the snapshot process without waiting for process exit. As a result, a Win32Exception is thrown (as we don't have the correct privileges to force an exit without yielding first) which will repeatedly spam any subscribed Trace listeners (as a
Trace.Write
is called internally).This seems to be called when invoking either the
DataTarget.Dispose()
orClrRuntime.Dispose()
methods. You can observe this behavior in Loupe Desktop when injecting RemoteNET into the MTGO client, which will trace this error on Diver startup and when pinning objects, etc.Unfortunately, we can't (and shouldn't) unsubscribe Trace listeners as this may negatively affect Gibraltar logging on the MTGO client, which makes extensive use of
Trace.Write
calls to inform state changes.This is a regression from https://github.com/microsoft/clrmd/pull/926 that we'll need to work around by reimplementing the dispose method w/ the use of reflection.