Creating an error handler for my application

  • Thread starter Thread starter Mathieu Brüning
  • Start date Start date
M

Mathieu Brüning

Hi all,

i'm trying to write an exception handler for my application, so in case an
exception occurs anywhere in my application, the exception has to be
catched.

At this moment i'm doing it via the following code:
Application.ThreadException += new
System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

But this doesn't work for me. If an exception is being thrown, it isn't
catched by the ThreadException event and a exception is being displayed.

Could someone please help me with this problem?

Thanks in advance,

Mathieu
 
Mathieu,

The ThreadException event on the Application class is only fired for
exceptions that take place on the main UI thread. If the exception occurs
on a thread other than the main UI thread, you need to use the app domain
unhandled exception handler.

Hope this helps.
 
Back
Top