K
Karl Seguin
I'm trying to setup a global exception handler by attaching a handler to the
CurrentDomain.UnhandledException exception.
Here's sample code I got from the net:
Module Module1
Sub Main()
Dim currentDomain As AppDomain = AppDomain.CurrentDomain
AddHandler currentDomain.UnhandledException, AddressOf MyHandler
Dim s As String
Console.WriteLine(s.ToString())
End Sub
Sub MyHandler(ByVal sender As Object, ByVal args As
UnhandledExceptionEventArgs)
Dim e As Exception = DirectCast(args.ExceptionObject, Exception)
Console.WriteLine("MyHandler caught : " + e.Message)
End Sub
End Module
However, when the code is run, I still get an "Unhandled Exception" error
because of the null reference...any help?
Karl
CurrentDomain.UnhandledException exception.
Here's sample code I got from the net:
Module Module1
Sub Main()
Dim currentDomain As AppDomain = AppDomain.CurrentDomain
AddHandler currentDomain.UnhandledException, AddressOf MyHandler
Dim s As String
Console.WriteLine(s.ToString())
End Sub
Sub MyHandler(ByVal sender As Object, ByVal args As
UnhandledExceptionEventArgs)
Dim e As Exception = DirectCast(args.ExceptionObject, Exception)
Console.WriteLine("MyHandler caught : " + e.Message)
End Sub
End Module
However, when the code is run, I still get an "Unhandled Exception" error
because of the null reference...any help?
Karl