Catching errors globally

  • Thread starter Thread starter Phil Jones
  • Start date Start date
P

Phil Jones

Is there a way of setting a master error handler for an assembly?

What I mean is being able to somehow assign a procedure to catch any
unhandled exceptions for an entire app (in my case a WinForms app) so that
they can either be logged, or handled gracefully.

Thanks everyone!
===
Phil
 
Phil,

One way is to add a handler to Application.ThreadException event. This way
you could intercept all unhandled exceptions happening on the UI thread.

Alexander
 
Cool - these are two very useful suggestions.

Thanks Alexander and Pat - I can see where I might use both of these for
different goals.

Many thanks
===
Phil
 
Back
Top