Unhandled exception handler no longer being invoked.

  • Thread starter Thread starter TerryLa
  • Start date Start date
T

TerryLa

Guest
Not sure if this should be here or in the .Net framework forum.

Visual Studio 2010 and Framework 4.0

But here goes - This has been working for years but suddenly it doesn't. I have a unhandled exception handler (code below) that for some reason never its invoked when an exception occurs. The handler is in the top most part of the app. - the UI. The original exception occurred 4 levels deep and has worked in the past. As part of trying to figure out what is going on I threw an exception in the UI and it did not invoke the handler. What has changed? Have I accidently changed some setting?

Here is the code contained in the ApplicationEvents.vb:

Namespace My

' The following events are available 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 ex As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
Dim msg As String = "A unhandled exception has occured. Please contact PayBreeze support with the following information."
msg &= Microsoft.VisualBasic.ControlChars.CrLf
msg &= ex.Exception.Message
MsgBox(msg, MsgBoxStyle.OkOnly, "Unhandeled Exception")
My.Computer.Clipboard.SetText(ex.Exception.ToString & vbCrLf & "Stack Trace:" & vbCrLf & ex.Exception.StackTrace)
msg = "A stack trace has been put on the clipboard. Please paste it ([Ctrl]-V) into an email and send to Support@PayBreeze.com"
msg &= vbCrLf & "Please include other infromation like state, local tax name, Catalog Revision (if not the current one) etc."
MsgBox(msg, MsgBoxStyle.OkOnly, "")
End
End Sub
End Class
End Namespace

Thanks in advance for any help.


Terry

Continue reading...
 
Back
Top