A
Alex Glass
Im using the following code to test the unhandled exception feature and yet
on my development machine it works properly (i.e. it is able to consume the
exception) but on my test machine the event handler fails to trigger. Is
there something I am missing here? This code below comes from the help
files. I am using .NET v1.1, my development machine had installed .NET with
Visual Studio whereas I installed the framework on my test machine using the
redistributable exe file dotnetfx.exe
Output on Dev machine:
Catch clause caught : 1
MyHandler caught : 2
Press <ENTER>
Output on test machine:
Catch clause caught : 1
....Then window pops up
"Application has generated an exception that could not be handled.
Process id=0x1b0 .... Thread id=0x314 ....."
I would prefer if this window never appeared it looks very unprofessional
for my application.
Any help would be greatly appreciated.
----------------------------------------------------------------------------------------------------------------------
Module Module1
Sub Main()
Dim currentDomain As AppDomain = AppDomain.CurrentDomain
AddHandler currentDomain.UnhandledException, AddressOf MyHandler
Try
Throw New Exception("1")
Catch e As Exception
Console.WriteLine("Catch clause caught : " + e.Message)
End Try
Throw New Exception("2")
End Sub 'Main
Sub MyHandler(ByVal sender As Object, ByVal args As
UnhandledExceptionEventArgs)
Dim e As Exception = DirectCast(args.ExceptionObject, Exception)
Console.WriteLine("MyHandler caught : " + e.Message)
Console.WriteLine("Press <ENTER>")
Console.ReadLine()
End Sub 'MyUnhandledExceptionEventHandler
End Module
on my development machine it works properly (i.e. it is able to consume the
exception) but on my test machine the event handler fails to trigger. Is
there something I am missing here? This code below comes from the help
files. I am using .NET v1.1, my development machine had installed .NET with
Visual Studio whereas I installed the framework on my test machine using the
redistributable exe file dotnetfx.exe
Output on Dev machine:
Catch clause caught : 1
MyHandler caught : 2
Press <ENTER>
Output on test machine:
Catch clause caught : 1
....Then window pops up
"Application has generated an exception that could not be handled.
Process id=0x1b0 .... Thread id=0x314 ....."
I would prefer if this window never appeared it looks very unprofessional
for my application.
Any help would be greatly appreciated.
----------------------------------------------------------------------------------------------------------------------
Module Module1
Sub Main()
Dim currentDomain As AppDomain = AppDomain.CurrentDomain
AddHandler currentDomain.UnhandledException, AddressOf MyHandler
Try
Throw New Exception("1")
Catch e As Exception
Console.WriteLine("Catch clause caught : " + e.Message)
End Try
Throw New Exception("2")
End Sub 'Main
Sub MyHandler(ByVal sender As Object, ByVal args As
UnhandledExceptionEventArgs)
Dim e As Exception = DirectCast(args.ExceptionObject, Exception)
Console.WriteLine("MyHandler caught : " + e.Message)
Console.WriteLine("Press <ENTER>")
Console.ReadLine()
End Sub 'MyUnhandledExceptionEventHandler
End Module