Writing MiniDumps in C#

After creating my previous post (MiniDump support in .NET4), I tried to figure out how to write minidumps (MiniDumpWriteDump) without needing unmanaged code. I could not find any example… so I wrote one (which also works for x86 and x64/IA64).
Here is the example:
MiniDumpWriteDump direct from C# for x86 and x64/IA64.

7 Responses to “Writing MiniDumps in C#”

  1. Hefe Says:

    Hay, Jochen! I retrieve your article and codes about STACKWALKER from codeproject.com. And I encounted some problems when i tried to wrap your code as a dll, i have no idea about the solution, if you see these words, please send me a email, and i’ll post you the sceenshots, thanks!

  2. Marc Sherman Says:

    Hi Jochen,

    For native code, many people recommend that the faulting process simply signal another process to generate the dump. But in the case of .NET exceptions, I would think that the data structures of the faulting process would not be corrupt and it would be okay to write the dump in process. What’s your opinion?

    thanks,
    Marc

  3. jkalmbach Says:

    This is a hard question… in general it is always safer to write the dump out-of-process, especially for stack-overflows… but as you said: this is at least true for unmanaged code. I generate (in-process) minidumps for managed code since several months without any problems (except that it does not support source-lines…)
    So: I can’t answer your question…

    MS would say: Please use WER (Windows Error Reporting)! Then you don’t have to care about this, because the dump is written out-of-process.

  4. Hefe Says:

    Hi, Jochen, Would you like to tell me about your email address, i wanna communicate with you about some details about the STACKWALKER, thanks

    with regards, hefe

  5. nico Says:

    Hi Jochen,

    Do you think minidumps are better solution than simply logging the error ?
    What information can we have with a minidumps that we can’t have with a logging solution ?

  6. jkalmbach Says:

    If you have a mixed-mode app, then you can’t log the exeption. Also you never get line-infos (except if you redistribute the PDB, which is not a good idea).
    The main advantages is “line-numbers”…

  7. Jochen Kalmbach’s Blog » Blog Archive » Source-Indexing (TFS) und Smbols-Store Says:

    […] einzige was Du bekommst ist ein Dump-File (z.B. entweder via WER oder durch eigenes schreiben von MiniDumpWriteDump). Jetzt beginnt für Dich das […]

Leave a Reply