First some background: I have a multi-threaded WinForms application that is doing interop to native dlls. This application crashes sometimes with unhandled exception and we
I highly recommend that you use the OS minidump generation instead of your own. This is for several reasons:
ThreadException
or UnhandledException
is started, the exception stack has already been unwound. Generating a minidump at that point will just point you to the handler, not the source of the exception.If your app is in the field, use WER. If you're doing in-house testing, use ProcDump. You can also just copy the minidump file while the Error Reporting dialog is active.
P.S. There are some exceptional conditions - most notably when doing p/Invoke - where neither ThreadException
nor UnhandledException
will work.
P.P.S. If you have a debuggable scenario, then try turning on the Managed Debugging Assistants relating to p/Invoke.