I set a global bug catcher in my application for unhandled exceptions and it is picking up all exceptions

Posted by user1632018 on Stack Overflow See other posts from Stack Overflow or by user1632018
Published on 2012-11-15T14:30:27Z Indexed on 2012/11/15 17:00 UTC
Read the original article Hit count: 147

I am trying to figure out why this is happing. In my vb.net application I set a global handler in the ApplicationEvents.vb which I thought would only pick up any unhandled exceptions, although it is picking up every exception that happens in my application whether or not they are handled with try catch blocks. Here is my code in applicationevents

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

            e.ExitApplication = _
            MessageBox.Show(e.Exception.Message & _
                    vbCrLf & "The application has encountered a bug, would you like to                 Continue?", "An Error has occured.", _
                    MessageBoxButtons.YesNo, _
                    MessageBoxIcon.Question) _
                    = DialogResult.No
    End Sub

In the rest of my application I set normal try catch blocks like this:

     Try


          Catch ex as exception


     End Try

Can anyone tell me why this is happening?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about vb.net