MS Unhandled ExceptionHandler still being called after our own

A

Arnie

Folks,

Why does the MS unhandled exception handler get called when we have
registered our own if we call Application.Exit() from our own handler??

We are developing application using .Net 2.0 (beta). We have defined our own
unhandled exception handling policy and would like to use only the policy we
have defined. However when we register our unhandled exception handler with
..NET, following happens - Our exception handler routine, gets called (which
is desired behavior) After our exception handler completes, Microsoft's
default exception handler gets called which displays dialog and has options
to send report to Microsoft (this is not desired behavior) Also to prevent
this, we do not want to set special value in registry ( e.g.
DbgJITDebugLaunchSetting ) which applies to all .NET applications on that
machine because it can not be limited to only a particular application.

We would like following behavior from .NET framework -

1> The Microsoft default unhandled exception handler should be called only
if the application does not register a unhandled exception handler Or if the
registered unhandled exception handler fails for some reason.

OR

2> Ability to disable Microsoft's default exception handler for particular
application.T



More details....



Yes, I am calling Application.Exit when
UnhandledExceptionEventArgs.IsTerminationg is true in my unhandled exception
handler. I also placed a break point on the application.Exit call and made
sure it is called, but still the Microsoft dialog shows up after my
unhandled exception returns !

Any hint will be appriciated.

The Microsoft's unhandled Exception dialog is shown when the application
will be terminated as a result of the unhandled exception
(UnhandledExceptionEventArgs.IsTerminationg is true ), if the application is
not terminating we get desired behavior.

I have tried all possible values in Application.SetUnhandledExceptionMode
but still the same undesired behavior when application is terminating as a
result
 
A

Arnie

The same thing happens.

A colleague points out ...


"It looks like we are not the only one hitting this problem. I found
following in Jeffrey Richter's "Applied Microsoft .NET framework
programming" book, publisher is "Microsoft press", page 438 , he says
"Currently when an unhandled exception occurs, the CLR examines the
bottom-most byte of the DbgJITDebugLaunchSetting registry value.If this byte
contains 0 or 2, the user is presented with the CLR's dialog box or the
debugger just starts running - this happens even if the application has
registered a callback method with AppDomain's UnhandledException event. In
the future, I'd like to see the CLR consider an exception unhandled only if
no method is registered with AppDomain's UnhandledException event.""





-jeff
 
A

Arnie

Thanks Daniel.

We are hoping to avoid the registry key since it turns things off for the
machine.
We are trying to do it for a specific app.

-jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top