Trouble debugging Rhino crashes using complex GH script

Having quite a bit of trouble trying to debug Rhino crashes as a result of unholy things that I’m doing in Grasshopper (a lot of flow control, custom classes, selective expire, event listening, etc).

If I fire up Grasshopper in a debug session I get no kind of exception on crash, it just fails hard. This last time, I had VS open (not attached) and the JIT debugger offered me the opportunity to attach to VS, and I got this cryptic message:

Unhandled exception at 0x00007FFFD0DB843B (ntdll.dll) in Rhino.exe: 0xC0000374: A heap has been corrupted (parameters: 0x00007FFFD0E1C6E0). occurred

This tends to happen on adding geometry to the document and I think is related to custom classes that are created and mutated in a C# component at runtime (tree access). I’m wondering if wrapping the C# code into a proper custom component would be worth the work, not sure if there are memory leaks in the C# component environment?

Any tips on how to get more information on this crash would be appreciated. I’d provide more information but I don’t know where to start.

Thanks,
Marc

FYI, I created a manual dump file and am currently uploading it to www.rhino3d.com/upload – should be there shortly.

Some further info – since I see that other crash reports involving this file are related to display – this is happening in Shaded mode – haven’t tested other modes thoroughly.

Cheers,
Marc