[RESOLVED] Error reporting not picking up unhandled exception

LPetersonLPeterson Posts: 7 New member
edited August 10, 2022 4:30PM in SmartAssembly
I have error reporting turned on in the GUI for the .saproj, and have server privileges for error reporting at red-gate.   (I've used error reporting successfully before with version 7, but just can't get it working now in 8.1).  At any rate, in VB.NET I added a line in a Button1 like

Dim a(5) As Integer
a(6) = 1 " this will throw an exception

I also commented out the default VB.NET unhandled exception handler as follows:

Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
            ' If the user clicks No, then exit.
            ' e.ExitApplication = MessageBox.Show(e.Exception.Message & vbCrLf & "Continue?", "Continue?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.No

End Sub

When I click the Button 1, the program now simply terminates, so SA is not detecting the unhandled exception.  Is there a switch setting I am missing?

RESOLVED

It works out that you have to totally comment out the default handler in VB.NET as in the following:

  'Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException
        '' If the user clicks No, then exit.
        'e.ExitApplication = MessageBox.Show(e.Exception.Message & vbCrLf & "Continue?", "Continue?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.No

        'End Sub

Before, I was just commenting out the messagebox.  With error reporting turned on in SA, when Visual Studio can't find the method (subroutine) to handle unhandled exceptions, SA will recognize it and load the popup to send an error report to the server.  

This is what I had to do to get error reporting working in Visual Studio (VB.NET).

Sign In or Register to comment.