473,497 Members | 2,041 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

currentDomain.UnhandledException

I have copied this directly from the MSDN example into a Console
application. MyHandler does not run. Running compiled Release brings
up the JIT. What am I missing?

Module Module1

Sub Main()
Dim currentDomain As AppDomain = AppDomain.CurrentDomain
AddHandler currentDomain.UnhandledException, AddressOf
MyHandler

Try
Throw New Exception("1")
Catch e As Exception
Console.WriteLine("Catch clause caught : " + e.Message)
End Try

Throw New Exception("2")

' Output:
' Catch clause caught : 1
' MyHandler caught : 2

End Sub
Sub MyHandler(ByVal sender As Object, ByVal args As
UnhandledExceptionEventArgs)
Dim e As Exception = DirectCast(args.ExceptionObject,
Exception)
Console.WriteLine("MyHandler caught : " + e.Message)
End Sub 'MyUnhandledExceptionEventHandler

End Module
Nov 21 '05 #1
1 1507
In article <8b*************************@posting.google.com> , garbage400
@hotmail.com says...
I have copied this directly from the MSDN example into a Console
application. MyHandler does not run. Running compiled Release brings
up the JIT. What am I missing?


The VS.NET debugger gets the first chance at the exception. When given
the option to "Debug" or "Continue", click "Continue" and your handler
will get called.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 21 '05 #2

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

Similar topics

0
1529
by: Matt Calhoon | last post by:
Hi there, I have a web application that I need to move to a new webfarm. This application uses AppDomain.CurrentDomain.BaseDirectory to call up the base path (D:\content\clientwebsiteroot\) when...
4
2607
by: Thom Little | last post by:
I have a simple C# Winforms application that has an UnhandledException handler that writes to the log. This works fine if I throw a new exception (like"bogus") but it does not gain control on a...
0
4432
by: GrantS | last post by:
To ensure my C# Winforms application can only have one instance running, I am using the code below: string proc=Process.GetCurrentProcess().ProcessName; // get the list of all processes by that...
5
1932
by: John Richardson | last post by:
Quick question about the UnhandledException event and associated Handler. I just implemented this handler for the first time, and am surprised that it this event is being raised for an exception...
2
6505
by: Chris Dunaway | last post by:
I am attempting to use the AppDomain.UnhandledException event in a Windows Forms app and also in a Windows Service. But the event doesn't seem to be called. In a Windows Forms app, the event IS...
5
10991
by: Benny Raymond | last post by:
What should I do instead of this: AppDomain.CurrentDomain.AppendPrivatePath(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + @"\plugins"); now that...
1
4270
by: pack | last post by:
What're the meaning of "App domain" and "Current Domain" in appdomain.CurrentDomain.UnhandledException?
7
1668
by: Spam Catcher | last post by:
Hi all, When I'm debugging my application in VS.NET 2005, the debugger intercepts all unhandled exceptions and does not break into ApplicationEvents.UnhandledException. How do I debug...
2
2031
by: james | last post by:
Hi all, I have a console app that uses AppDomain.CurrentDomain.UnhandledException. However it only seems to catch exceptions in the current thread. Exceptions in other threads (like from a...
0
7121
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
7162
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
7197
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...
1
6881
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
7375
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
5456
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,...
1
4899
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4584
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.