Re: how can I create minidumps of second chance exceptions in .NET 1.1 managed code?
- From: Uri Dor <tablul@xxxxxxxxxxxxxxxxx>
- Date: Wed, 03 Aug 2005 10:02:56 +0200
Thanks, Oleg,
I tried your suggestion, but it has a problem:
Using the configuration like you suggested sends the exception to the JIT debugger which is registered in a system-wide manner, and I don't want to register there.
When my app crashes, I want to catch that crash, create a dump and show a friendly message to the user. If I did that through the JIT debugger, I would be showing my message even when other applications crash.
That's why I'm running my app by using ADPlus.
Just to be sure, you wrote:
"From my experience, ADPlus (as well as other unmanaged debuggers) is usually good in catching 2nd chance managed exceptions."
Did you really mean *managed* in that sentence, or *unmanaged* ?
BTW, I understand that your suggestion comes from the "details" in the unhandled exception window, but I couldn't find any MSDN documentation of that "system.windows.forms" tag - is there any such documentation? maybe it has more attributes that could help.
Thanks Uri
Oleg Starodumov wrote:
I've written a test Windows Forms (.NET 1.1) app, with the following event: private void Form1_Load(object sender, System.EventArgs e) { int i = 0; int j = 9 / i; /* I WANNA DUMP HERE :-) */ } And I want to produce a minidump of the second-chance exception that occurs (I don't want the 1st chance - every 3rd party control I use produces at least 2 of those whenever the app is run).
If I could do this, I'd have my users run my app this way every time (I'll hide the debugger windows, etc. and I believe performance won't be degraded by this as long as a 2nd chance exception isn't met) and when they get a crash, I could get a dump file. That said, my preference would be for solutions that don't require changing registry keys, but for now any solution goes for the sake of discussion and learning.
I guess it should be somehow possible to do this, because the VS.NET 2003 IDE debugger stops on the remarked line.
I tried using ADPlus, but it appears that it can't catch 2nd chance managed exceptions, because the .NET CLR catches them (And writing a AppDomain.UnhandledException handler swallows them).
From my experience, ADPlus (as well as other unmanaged debuggers) is usually good in catching 2nd chance managed exceptions. The problem is with WinForms applications, which catch/swallow unhandled exceptions thrown from event handlers. This behavior can be changed in the application's .config file. Something like:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.windows.forms jitDebugging="true" /> </configuration>
With this enabled, you can even employ the unmanaged JIT debugger (e.g. Dr.Watson) to produce the crash dump if you call SetUnhandledExceptionFilter via interop and set the filter pointer to zero (though it in turn will not allow managed debuggers to receive second chance managed exceptions in normal debugging sessions).
Oleg
.
- Follow-Ups:
- Re: how can I create minidumps of second chance exceptions in .NET 1.1 managed code?
- From: Oleg Starodumov
- Re: how can I create minidumps of second chance exceptions in .NET 1.1 managed code?
- References:
- Prev by Date: Re: how can I create minidumps of second chance exceptions in .NET 1.1 managed code?
- Next by Date: debugger doesn't stop at breakpoint while debugging SQLCLR functio
- Previous by thread: Re: how can I create minidumps of second chance exceptions in .NET 1.1 managed code?
- Next by thread: Re: how can I create minidumps of second chance exceptions in .NET 1.1 managed code?
- Index(es):
Relevant Pages
|