.NET: Microsoft Technologies based on the .NET software framework. Runtime: An environment required to run apps that aren't compiled to machine language.
Hi @Bevan Thomas ,
Thanks for reaching out.
Looking at this more closely, the exception code 0xc0000374 usually indicates heap corruption, meaning memory was likely misused earlier and Windows only detected it later. When the crash appears in ntdll.dll, it often means the operating system noticed the corrupted memory there rather than it being the original source.
What stands out to me is that the problem only happens in the 32-bit build, while the 64-bit version runs without crashing, and it occurs during unmanaged-to-managed calls. With that in mind, I’d lean toward reviewing the interop boundary between native and managed code, since small differences in memory layout can show up only in x86.
Some areas that might be worth checking include struct layouts, pointer representations, and calling conventions. Also, if unmanaged code stores a pointer to a managed delegate, it’s possible the delegate could be collected by the garbage collector unless a reference is kept on the managed side.
Since heap corruption is usually detected after the actual problem occurs, enabling Page Heap with gflags can help catch invalid memory writes closer to the source. Microsoft documents this approach here:
https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/enable-page-heap
https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/gflags-and-pageheap
If you found my response helpful or informative in any way, I would greatly appreciate it if you could follow this guidance provide feedback.
Thank you.