Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2006

Tip: Looking for answers? Try searching our database.

Global error handler

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
UJ - 29 Aug 2006 19:03 GMT
Is there a way to do a global error handler much the way you can in asp.net
? Essentially I want to set up a routine that if there is any unhandled
exception it will call that routine so I can process it. I do quite a bit
with timers so if I had to put code in in each place where an error could
happen, it would be difficult.

TIA - Jeff
Markus Stoeger - 29 Aug 2006 20:37 GMT
> Is there a way to do a global error handler much the way you can in asp.net
> ? Essentially I want to set up a routine that if there is any unhandled
> exception it will call that routine so I can process it. I do quite a bit
> with timers so if I had to put code in in each place where an error could
> happen, it would be difficult.

Have a look at these two events:

  AppDomain.CurrentDomain.UnhandledException
  Application.ThreadException

hth,
Max
UJ - 29 Aug 2006 21:03 GMT
Maybe I didn't make myself clear. I want this for a windows program. I want
the equivalent of the Application_Error event from the web side.

I essentially want a way to trap any unhandled error someplace so the
message doesn't display to the user.

TIA - Jeff.

>> Is there a way to do a global error handler much the way you can in
>> asp.net ? Essentially I want to set up a routine that if there is any
[quoted text clipped - 9 lines]
> hth,
> Max
Bruce Wood - 29 Aug 2006 21:11 GMT
You did make yourself clear, and Markus give you the correct answer.
Take a look at those two events. As well, if you search for the event
names on MSDN you should find at least one article on global event
handling in .NET.

> Maybe I didn't make myself clear. I want this for a windows program. I want
> the equivalent of the Application_Error event from the web side.
[quoted text clipped - 17 lines]
> > hth,
> > Max
Alan Pretre - 29 Aug 2006 22:58 GMT
> You did make yourself clear, and Markus give you the correct answer.
> Take a look at those two events. As well, if you search for the event
> names on MSDN you should find at least one article on global event
> handling in .NET.

Although, IIRC, these don't catch unhandled exceptions from threadpool
threads.  I may be wrong on that.

-- Alan
Bruce Wood - 30 Aug 2006 01:38 GMT
> > You did make yourself clear, and Markus give you the correct answer.
> > Take a look at those two events. As well, if you search for the event
[quoted text clipped - 3 lines]
> Although, IIRC, these don't catch unhandled exceptions from threadpool
> threads.  I may be wrong on that.

No, you are right. These two events catch only events from the UI
thread, not from background threads.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.