Unhandled Exceptions - Revisited

S

Simon Tamman

I posted a while back in regards to an exception not being caught which was
seriously freaking me out.
I thought it was pretty common knowledge that:

AppDomain.CurrentDomain.UnhandledException+=new
UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

Should catch unhandled exceptions.
However, according to:

http://www.codinghorror.com/blog/archives/000201.html

(read the comments, particulary the one from the guy at the CLR team)
It doesn't (or at least, isn't supposed to).

The fact that it did in 1.0 and 1.1 was a bug and it never was supposed to.
Does this mean that there is no "catch all" ability in the .NET Framework?
 
G

Guest

The AppDomain UnhandledExceptionEventHandler is NOT an "exception handler".
It is an event that tells you your AppDomain is about to unwind due to an
unhandled exception, giving you an opportunity to clean up and do any logging.
This might seem like frustrating behavior (the AppDomain blowing up on an
unhandled exception) but it prevents your app from getting into a comatose
state like in .NET 1.1 where it could still be running but act like it had
just had a lobotomy.

Peter
 

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