Add UnhandledException EventHandler
This commit is contained in:
parent
7768e5b0d7
commit
bc46ccadb3
24
app/DD_PM_WINDREAM/ApplicationEvents.vb
Normal file
24
app/DD_PM_WINDREAM/ApplicationEvents.vb
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
Imports Microsoft.VisualBasic.ApplicationServices
|
||||||
|
|
||||||
|
Namespace My
|
||||||
|
' Für MyApplication sind folgende Ereignisse verfügbar:
|
||||||
|
' Startup: Wird beim Starten der Anwendung noch vor dem Erstellen des Startformulars ausgelöst.
|
||||||
|
' Shutdown: Wird nach dem Schließen aller Anwendungsformulare ausgelöst. Dieses Ereignis wird nicht ausgelöst, wenn die Anwendung mit einem Fehler beendet wird.
|
||||||
|
' UnhandledException: Wird bei einem Ausnahmefehler ausgelöst.
|
||||||
|
' StartupNextInstance: Wird beim Starten einer Einzelinstanzanwendung ausgelöst, wenn die Anwendung bereits aktiv ist.
|
||||||
|
' NetworkAvailabilityChanged: Wird beim Herstellen oder Trennen der Netzwerkverbindung ausgelöst.
|
||||||
|
Partial Friend Class MyApplication
|
||||||
|
Private Sub MyApplication_UnhandledException(sender As Object, e As UnhandledExceptionEventArgs) Handles Me.UnhandledException
|
||||||
|
Dim oMessage = "Application encountered an unhandled error!" & vbNewLine & vbNewLine &
|
||||||
|
"The errormessage was:" & vbNewLine & e.Exception.Message & vbNewLine &
|
||||||
|
"The stacktrace was:" & vbNewLine & e.Exception.StackTrace
|
||||||
|
|
||||||
|
If IsNothing(LOGGER) = False Then
|
||||||
|
LOGGER.Info(oMessage)
|
||||||
|
LOGGER.Error(e.Exception)
|
||||||
|
End If
|
||||||
|
|
||||||
|
MsgBox(oMessage, MsgBoxStyle.Critical, "Process Manager")
|
||||||
|
End Sub
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
@ -237,6 +237,7 @@
|
|||||||
<Import Include="System.Xml.Linq" />
|
<Import Include="System.Xml.Linq" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="ApplicationEvents.vb" />
|
||||||
<Compile Include="ClassAnnotation.vb" />
|
<Compile Include="ClassAnnotation.vb" />
|
||||||
<Compile Include="ClassConfig.vb" />
|
<Compile Include="ClassConfig.vb" />
|
||||||
<Compile Include="ClassControlCreator.vb" />
|
<Compile Include="ClassControlCreator.vb" />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user