invalidGCHandleCookie MDA

The invalidGCHandleCookie managed debugging assistant (MDA) is activated when a conversion from an invalid IntPtr cookie to a GCHandle is attempted.


Undefined behavior such as access violations and memory corruption while attempting to use or retrieve a GCHandle from an IntPtr.


The cookie is probably invalid because it was not originally created from a GCHandle, represents a GCHandle that has already been freed, is a cookie to a GCHandle in a different application domain, or was marshaled to native code as a GCHandle but passed back into the CLR as an IntPtr, where a cast was attempted.


Specify a valid IntPtr cookie for the GCHandle.

Effect on the Runtime

When this MDA is enabled, the debugger is no longer able to trace the roots back to their objects because the cookie values passed back are different from the ones returned when the MDA is not enabled.


The invalid IntPtr cookie value is reported.


    <invalidGCHandleCookie />  

See Also

Diagnosing Errors with Managed Debugging Assistants