I've got a bug that is really difficult for me to track. It's one of those that only occurs when the debugger isnt connected :)
I've pinvoked MiniDumpWriteDump() and that works really well for creating .dmp files that I can debug after the fact.
however, I'm doing something like
try
{
foo();
}
catch(Exception)
{
CreateMiniDump()
}
this works great, however I dont get the callstack that is desired. I'd really prefer to have the callstack (with all the member variables) at the point where the exception was thrown.
is this possible? Is there a mechanism to get first dibs on the exception? such that I can create a minidump and preserve the callstack, etc?
In .NET 4 and up you can subscribe to the FirstChanceException event.