PC Review


Reply
Thread Tools Rate Thread

Catching errors globally

 
 
Phil Jones
Guest
Posts: n/a
 
      24th Feb 2005
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


 
Reply With Quote
 
 
 
 
Pat A
Guest
Posts: n/a
 
      24th Feb 2005
put a try/catch block around 'Application.Run(new frmMain());' in
static void Main().

 
Reply With Quote
 
Alexander Shirshov
Guest
Posts: n/a
 
      24th Feb 2005
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

> 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




 
Reply With Quote
 
Phil Jones
Guest
Posts: n/a
 
      25th Feb 2005
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


"Alexander Shirshov" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>> 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

>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
catching all errors =?Utf-8?B?cm9kY2hhcg==?= Microsoft ASP .NET 6 20th Nov 2006 02:19 PM
Catching errors cbh35711 Microsoft Excel Programming 0 3rd Apr 2006 10:52 PM
globally catching any error event? RB Smissaert Microsoft Excel Programming 2 4th Aug 2005 08:16 PM
Catching Framework Errors TonyG Microsoft ASP .NET 1 26th Aug 2003 08:52 PM
Catching ASP.NET errors Mikael Engdahl Microsoft ASP .NET 3 15th Aug 2003 08:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:46 PM.