I used to know and use the event
Application.ThreadException +=
new System.Threading.ThreadExceptionEventHandler(
Application_ThreadException);
I just learned that this is not necessarily going to catch all unhandled exceptions, it will only catch all unhandled exception that occur in the UI thread.
If you really want to handle all unhandled exceptions then you need to broaden your scope and implement the domain unhandled exception event as follows.
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(
CurrentDomain_UnhandledException);
I used to know about both events but didn't really know the difference until I learned about them from my TA (Kevin).
Go to this blog for more details
Have fun catching exceptions.
No comments:
Post a Comment