Skip to content

[.NET] DotNetDiver.GetObject throws "Loading this assembly would produce a different grant set from other instances." #9

Description

@theXappy

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions