As Hans Passant pointed out, the primary MDA for such cases would be <gcUnmanagedToManaged>
. However, this MDA makes the program run very slow. Actually, the program becomes unusable (it takes "forever" to draw the program interface), thus it won't work in production. Visually this MDA is as slow as GCStress.
Other useful MDAs (work must faster):
<callbackOnCollectedDelegate />
<invalidOverlappedToPinvoke />
<overlappedFreeError />
To learn more about available MDAs and their detailed description, refer to the MSDN article Diagnosing Errors with Managed Debugging Assistants.
A good article on how to set MDAs for a program is Managed Debugging Assistants in .NET 2.0.
And finally, how to activate MDAs in the system, see Stack Overflow question .NET/C#: How to set debugging environment variable COMPLUS_HeapVerify?.