Application unhandled exception event question



In Vs 2005 you have new applicationsEvents.vb I was testing it in a simple
app and found that it was easier to implement unhandled exception management
tah it was in Vs2003 (vb.net) You can, if you want to, prevent your app from
terminating on an unhandled exception, and for me this is important. In an
Ivr app it will let me hang up the phone only on the line that triggered the
unhandled exception, leaving other callers to complete their calls.
This is the sample app code

In form1

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnTest.Click

'-- just a simple "object not initialized" exception (should read "as new")

Dim x As Specialized.NameValueCollection

MessageBox.Show(x.Count.ToString)

MessageBox.Show("Application is continuing")

End Sub

End Class



In application Events.vb

Namespace My

' The following events are availble for MyApplication:

'

' Startup: Raised when the application starts, before the startup form is
created.

' Shutdown: Raised after all application forms are closed. This event is not
raised if the application terminates abnormally.

' UnhandledException: Raised if the application encounters an unhandled
exception.

' StartupNextInstance: Raised when launching a single-instance application
and the application is already active.

' NetworkAvailabilityChanged: Raised when the network connection is
connected or disconnected.

Partial Friend Class MyApplication

Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e
As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs)
Handles Me.UnhandledException

MsgBox("Sender: " & sender.ToString & " Exception:" & e.Exception.Message)

e.ExitApplication = False

End Sub

End Class

End Namespace



Quite simple really and it seems to work OK. I have one problem, I would
like to be able to single step through the applicationEvents.vb code when it
is triggered in my IDE, like when I click the button in form1 while in the
IDE but I always get The exception dialog window that gives me info about
the unhandled application and I can only test if it works by running the
compiled exe, Only then do I see the message box un the unhandledexeception
event handler.

Is there any way that I could get to that code while in debug mode?

Thanks for any help

Bob




.



Relevant Pages

  • Re: Disable continue option when an unhandled exception occurs?
    ... That will generate a new partial class looking ... ' UnhandledException: Raised if the application encounters an unhandled ... End Namespace ... the the user to continue when there is an unhandled exception. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Debuggen zur Laufzeit
    ... Try-Catch UnhandledException, ThreadException... ... public static void SubMain() { ... // Setup unhandled exception handlers ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: CLR hosting: unhandled exceptions and reliability
    ... an unhandled exception in an AppDomain ... register an unhandled exception event handler. ... if a handler for the UnhandledException event ever ...
    (microsoft.public.dotnet.framework.clr)
  • Unable to debug the unhandled exxception application event code
    ... I have some code in there whose execution I need to verify. ... to do that I wrote a simple button click event in my app that would fire off ... I set a break point on the first line of code in my unhandled exception ... How can I debug the code in the unhandledexception event? ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Application unhandled exception event question
    ... app and found that it was easier to implement unhandled exception management ... terminating on an unhandled exception, and for me this is important. ... Private Sub Button1_Click(ByVal sender As System.Object, ... ' Startup: Raised when the application starts, ...
    (microsoft.public.dotnet.languages.vb)