RemoteNET
RemoteNET copied to clipboard
[.NET] DotNetDiver.GetObject throws "Loading this assembly would produce a different grant set from other instances."
In some cases, a call to DotNetDiver.GetObject throws a FileLoadException when inspecting the instance retrieved from the heap.
The FileLoadException's message is:
"Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)"
Stack Trace:
This exception was originally thrown at this call stack:
System.RuntimeType.RuntimeTypeCache.RuntimeTypeCache(System.RuntimeType)
System.RuntimeType.Cache.get()
System.RuntimeType.FullName.get()
ScubaDiver.DotNetDiver.GetObject(ulong, bool, string, int?) in DotNetDiver.cs
Example target: J𝚎tBrains dotP𝚎𝚎k 2024.1.4 Build 241.0.20240623.154825 built on 2024-06-23
How to reproduce:
Use RemoteNetSpy.
Look an instance of J𝚎tBrains.R𝚎Sharper.ExternalSources.ILViewer.Actions.ViewIlCodeActionHandler in the heap.
Once found, try to freeze it.
Guesses? This might be happening because the target had 2 domains: A default one and a custom one. Our diver was running in the default domain so perhapse the dumped object was in the custom one and that cause this error. I'd not the DLL that failed to load is a legitimate one by the app.