Application.ThreadException not getting called

I am using .NET 2.0 SDK Beta and trying to trap thread exceptions in order to handle 'unhandled' exceptions and log them. I am running the following line in my Main method:

Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

The method simply does a MessageBox.Show in order to indicate that it was called. However, it never does get called, instead throwing whatever exception is throw (I have hardcoded one to be thrown). Am I doing something wrong? Additional step, perhaps?

Thanks!
athomas4219Asked:
Who is Participating?
 
eternal_21Commented:
This will not catch exceptions that are thrown from the application's main thread.  To do this, you must wrap your Application.Run statement in a try...catch block.
0
 
athomas4219Author Commented:
What exceptions will that catch? Exceptions thrown by any OTHER threads?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.