Generating .NET crash dumps automatically

Note that creating a minidump from inside the “failing” process (or even thread) itself is not trivial or might not be accurate (also MiniDumpWriteDump function’s Remarks).

Besides, if your process is in such anger that you might need to write a crash dump, the whole situation is typically so hosed, that even attempting to create a crash dump could cause another crash (situations like hangs aside – but those might be even harder to “catch” from within the current process).

The “best” thing you can do, if you cannot install separate applications on your client’s systems, is to start an external process (which could also fail in critical situations!) and let that create a crashdump from your current process (see Superassert.NET from John Robbins). You could even go so far, as to put the external binary into your app resources, extract it from there on startup (as to minimize failure in critical situtations) to disk (if you dare).

Leave a Comment