473,398 Members | 2,088 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,398 software developers and data experts.

Notification on Exceptions

Hi,

I would like a method to get invoked whenever an
exception is thrown in my Main thread, even if it is
caught. Is there any automated way to do this without
calling it explicitly in all catch blocks?

Thanks in advance
Rakesh
Nov 15 '05 #1
2 1126
You have two chioces if I understand the problem correctly. 1) Don't
include try catches and let the exception propogate up to one that you wrap
around main 2) Rethrow your exceptions in the local blocks so they
propogate back up the stack. Another alternative is to create your own
subclassed exception(s) and call them, in that/those classes, raise whatever
event you want. This is a cumbersome approach and probably isn't worth it,
but it may suit your needs. More than likely you'll want to opt for one of
the first two methods.. probably the second.

HTH,

Bill
"Rakesh" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
Hi,

I would like a method to get invoked whenever an
exception is thrown in my Main thread, even if it is
caught. Is there any automated way to do this without
calling it explicitly in all catch blocks?

Thanks in advance
Rakesh

Nov 15 '05 #2
MTK
You will need to add try catch blocks to all your event
handler code. The catch blocks shld all have one method
where you want to do your event handling. That way any
unhandled exception gets trapped and handled in one method
of your choice.

Cheers, MTK.
-----Original Message-----
Hi,

I would like a method to get invoked whenever an
exception is thrown in my Main thread, even if it is
caught. Is there any automated way to do this without
calling it explicitly in all catch blocks?

Thanks in advance
Rakesh
.

Nov 15 '05 #3

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

Similar topics

0
by: grutta | last post by:
I am writing a windows service that will recieve notification when a USB Device is insterted into the machine. I have used the RegisterDeviceNotification and the RegisterServiceCtrlHandlerEx with...
3
by: Robert W. | last post by:
I have a separate thread that handles data transfer operations (with a mobile device). I've set things up so that a small notification form is displayed in the lower right corner of the window. ...
0
by: Ed Lukoski | last post by:
I'm trying to send mail (via our Exchange v5.5 server) from a VB.Net webapp and get Delivery Notification and Read Receipt. If I use mail.Headers.Add("Return-Receipt-To", "mailbox@whatever.com")...
2
by: SB | last post by:
Can someone please tell me Microsoft .NET's position on this WS-Notification specification that includes the pub/sub model? Is there something in the pipeline or already available as part of the...
0
by: Eron Wright | last post by:
We heavily use the ASP.NET Cache with file dependencies. The files are located in approximately 200 directories (I understand that monitoring largely occurs on a per-directory basis). As of...
1
by: Anonieko | last post by:
Understanding and Using Exceptions (this is a really long post...only read it if you (a) don't know what try/catch is OR (b) actually write catch(Exception ex) or catch{ }) The first thing I...
0
by: Nadia Amir | last post by:
I want to enable SQL cache notification on northwind tables employees. I have used the tool aspnet_regsql.exe as defined in the tutorial http://msdn2.microsoft.com/en-us/library/e3w8402y(vs.80).aspx...
0
by: vsrprasad16 | last post by:
Hi All, I am implementing a notification form similar to outlook email notification. my application call this notification form from a dll. this dll includes a form class and this dll has some...
4
markmcgookin
by: markmcgookin | last post by:
Has anyone used the notification class from Windows CE forms? using the following code using Microsoft.WindowsCE.Forms; ... Notification note = new Notification()
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.