Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error handling not kicking in when running from an exe ....
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Error handling not kicking in when running from an exe ....
Divers
Thread ID:
00862456
Message ID:
00862456
Vues:
50
Hi,

I have error handling in place throughout my application. I also start the application wrapped in error handling code to catch any unexpected exceptions (i.e. exceptions that occur where I haven't placed error handling code).

When I run my app from the IDE, the unhandled errors are caught by the error handling code in my Sub Main routine and the error details are logged to a text file and optionally e-mailed to me for follow-up.

However, when I run the app as an EXE (i.e. running the executable - not from the IDE) - this error handling does not kick-in. Instead, I the default .NET error message box is displayed (and the error is not logged).

Any idea why this would be happening? Note, I've noticed the same behaviour when compiling in both "Release" and "Debug" mode.

Here is the part of my Sub Main that traps all other unexpected errors in the application:
If gblnAuthenticated Then

Try
    Application.Run(New frmMain)
Catch ex As Exception
    Dim errInfo As String
     errInfo = "Source:  " + ex.Source.ToString + vbCrLf
     errInfo += vbCrLf
     errInfo += "Message:  " + ex.Message.ToString + vbCrLf
     errInfo += vbCrLf
     errInfo += "Target:  " + ex.TargetSite.ToString + vbCrLf
     errInfo += vbCrLf
     errInfo += "Stack Trace:  " + vbCrLf
     errInfo += ex.StackTrace.ToString + vbCrLf
    'show form advising user that an unexpected error has occured
    Dim frmErr As New frmError
    frmErr.ShowDialog()

    Try
   'call function to log and E-Mail error details to LDS
      clsGeneral.fnLogError(errInfo, gblnAutoSendErrorReports)
    Catch e As Exception
    'if an error occurs while logging the error - just ignore it
    End Try
Finally
   Application.Exit()
End Try 

End If
Al Williams

Anola MB, CANADA
Répondre
Fil
Voir

Click here to load this message in the networking platform