473,396 Members | 1,921 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,396 software developers and data experts.

Catching unhandled exceptions in application

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 unhandled exceptions always.
There are not working in some cases.

Anybody pl reply

Thanks,
Shravan.
Nov 15 '05 #1
2 1820
My advice would be to find the problem area and add a try... catch. I know
of no way to have a completely unhandled exception caught, except by the
system (ugly error message). This does not mean it is impossible, but that
you might end up with far more work trying to nab this functionality from
the CLR than it is worth.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"Shravan" <sh**********@semanticspace.com> wrote in message
news:0e****************************@phx.gbl...
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 unhandled exceptions always.
There are not working in some cases.

Anybody pl reply

Thanks,
Shravan.

Nov 15 '05 #2
"Shravan" <sh**********@semanticspace.com> wrote
Hi,
Does anybody know how to catch unhandled exceptions in
an application.


You have to use try..catch to handle exceptions. If you are getting an
error message based on an unhandled exception, simply put your code in the
following:

try
{
//insert the code here (and If this means the entire procedure, then so
be it)
}
catch (System.Exception ex)
{
//you will want to learn more about try..catch syntax because the order
of error goes from specific to less specific...this catches any system
error, period
//however you might want to code specifically for a data error and do
something like catch(System.Data.Exception ex) ...
MessageBox.Show("SYSTEM ERROR: " + ex.Message.ToString());
}

Good Luck,
Brian
--
Brian L. Gorman

Nov 15 '05 #3

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

Similar topics

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...
3
by: Elp | last post by:
Hi, I've developped a Window Form C# application which main form contains several activex controls. No problems most of the time but on some machine, the application crashes when the main form...
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...
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() ....
0
by: Colmeister | last post by:
I recently read Jason Clark's excellent article on Unhandled Exceptions (http://msdn.microsoft.com/msdnmag/issues/04/06/NET/default.aspx) and have attempted to incorporate the features he talks...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.