PC Review


Reply
Thread Tools Rate Thread

Catching ALL Unhandled Exceptions

 
 
James Hancock
Guest
Posts: n/a
 
      12th Jan 2004
I would like to have some way that if there is no error handling and an
exception is thrown in our application that it will do a last resort error
handling so that we can send information to support about the error.

Anyone have any ideas? I've tried putting a Try/catch around the
Application.run() command but it only works some of the time.

Thanks,
James Hancock


 
Reply With Quote
 
 
 
 
John Vottero
Guest
Posts: n/a
 
      12th Jan 2004
"James Hancock" <~(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I would like to have some way that if there is no error handling and an
> exception is thrown in our application that it will do a last resort error
> handling so that we can send information to support about the error.
>
> Anyone have any ideas? I've tried putting a Try/catch around the
> Application.run() command but it only works some of the time.
>


You need a try/catch around the Application.Run and you need to add a
ThreadExceptionHandler to the Application.ThreadException event.

John Vottero


 
Reply With Quote
 
Jim Hughes
Guest
Posts: n/a
 
      12th Jan 2004
See http://www.codeproject.com/dotnet/un...exceptions.asp

"John Vottero" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "James Hancock" <~(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I would like to have some way that if there is no error handling and an
> > exception is thrown in our application that it will do a last resort

error
> > handling so that we can send information to support about the error.
> >
> > Anyone have any ideas? I've tried putting a Try/catch around the
> > Application.run() command but it only works some of the time.
> >

>
> You need a try/catch around the Application.Run and you need to add a
> ThreadExceptionHandler to the Application.ThreadException event.
>
> John Vottero
>
>



 
Reply With Quote
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      12th Jan 2004
James,
In addition to the other comments:

Depending on the type of application you are creating, .NET has three
different global exception handlers.

For ASP.NET look at:
System.Web.HttpApplication.Error event
Normally placed in your Global.asax file.

For console applications look at:
System.AppDomain.UnhandledException event
Use AddHandler in your Sub Main.

For Windows Forms look at:
System.Windows.Forms.Application.ThreadException event
Use AddHandler in your Sub Main.

Hope this helps
Jay


"James Hancock" <~(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I would like to have some way that if there is no error handling and an
> exception is thrown in our application that it will do a last resort error
> handling so that we can send information to support about the error.
>
> Anyone have any ideas? I've tried putting a Try/catch around the
> Application.run() command but it only works some of the time.
>
> Thanks,
> James Hancock
>
>



 
Reply With Quote
 
James Hancock
Guest
Posts: n/a
 
      12th Jan 2004
Thanks all! Works great

"James Hancock" <~(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I would like to have some way that if there is no error handling and an
>exception is thrown in our application that it will do a last resort error
>handling so that we can send information to support about the error.
>
> Anyone have any ideas? I've tried putting a Try/catch around the
> Application.run() command but it only works some of the time.
>
> Thanks,
> James Hancock
>



 
Reply With Quote
 
Mike Junkin
Guest
Posts: n/a
 
      13th Jan 2004
Check out "Debugging Applications for Microsoft .NET and Microsoft Windows"
by John Robbins.
Microsoft Press ISBN 0-7356-1536-5

It's got a ton of information about how to provide exception monitoring and
reporting.

Mike

"James Hancock" <~(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I would like to have some way that if there is no error handling and an
> exception is thrown in our application that it will do a last resort error
> handling so that we can send information to support about the error.
>
> Anyone have any ideas? I've tried putting a Try/catch around the
> Application.run() command but it only works some of the time.
>
> Thanks,
> James Hancock
>
>



 
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 unhandled exceptions in the finalizer under .NET 2.0 =?iso-8859-15?Q?Stefan_K=FChnel?= Microsoft Dot NET Framework 6 31st Oct 2006 10:46 AM
Catching unhandled exceptions using HttpModules Amil Hanish Microsoft ASP .NET 0 13th Apr 2006 12:51 AM
catching all unhandled exceptions NickP Microsoft VB .NET 1 14th Feb 2006 11:49 PM
Catching ALL Unhandled Exceptions James Hancock Microsoft C# .NET 5 13th Jan 2004 04:38 PM
Catching ALL Unhandled Exceptions James Hancock Microsoft Dot NET Framework Forms 6 13th Jan 2004 04:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:02 PM.