473,386 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Catching ALL Unhandled Exceptions

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
Nov 15 '05 #1
5 1361
"James Hancock" <~j****@darwinconsulting.com> wrote in message
news:eS**************@TK2MSFTNGP11.phx.gbl...
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
Nov 15 '05 #2
See http://www.codeproject.com/dotnet/un...exceptions.asp

"John Vottero" <Jo**@mvpsi.com> wrote in message
news:O9**************@TK2MSFTNGP10.phx.gbl...
"James Hancock" <~j****@darwinconsulting.com> wrote in message
news:eS**************@TK2MSFTNGP11.phx.gbl...
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

Nov 15 '05 #3
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" <~j****@darwinconsulting.com> wrote in message
news:eS**************@TK2MSFTNGP11.phx.gbl...
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

Nov 15 '05 #4
Thanks all! Works great :)

"James Hancock" <~j****@darwinconsulting.com> wrote in message
news:eS**************@TK2MSFTNGP11.phx.gbl...
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

Nov 15 '05 #5
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" <~j****@darwinconsulting.com> wrote in message
news:eS**************@TK2MSFTNGP11.phx.gbl...
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

Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Shravan | last post by:
Hi, Does anybody know how to catch unhandled exceptions in an application. I have tried using AppDomain.UnhandledException Event Application.ThreadException Event but they were not catching...
5
by: Hubert Hermanutz | last post by:
Hi, as yet i have readed in the MSDN about exception handling. The only references that i was founded, described try, catch, finally and throw objects. But I am searching about an occation to...
4
by: Laxmikant Rashinkar | last post by:
Hi, I am working with a program that someone else wrote. This program is full of bugs and unhandled exceptions are thrown all over the code. Instead of trying to catch the exception at each...
12
by: Vasco Lohrenscheit | last post by:
Hi, I have a Problem with unmanaged exception. In the debug build it works fine to catch unmanaged c++ exceptions from other dlls with //managed code: try { //the form loads unmanaged dlls...
0
by: Chris Joslyn | last post by:
I am integrating some legacy VC++ 6.0 classes into a managed C++.NET Windows service. After I had the basic framework in place and running, I added in the source files I needed and tried to run the...
1
by: Atara | last post by:
My application starts with: Module mmcMain Public Sub Main() Debug.WriteLine("Main begin") Dim splashForm As New mcDlgs.cmcDlgSplash2 splashForm.Show() ....
3
by: Mike Binks | last post by:
I wish to make sure all unhandled exceptions (UE) are handled by a central handler. For primary thread UEs, this may be done by string exceptionText; ...
5
by: Simon Tamman | last post by:
I have an object named DisasterRecovery. The Ctor of this object is this: private DisasterRecovery() { Application.ThreadException+= new...
5
by: Sam Samson | last post by:
Hi All, I have seen a few good behaviours for what to do in the case of those pesky uncaught exceptions. and I want to build some of these mechanisms into my Application that is currently out on...
1
by: aine_canby | last post by:
Hi, This is my Program class in my Application - static class Program { /// <summary> /// The main entry point for the application. /// </summary>
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.