P
peter_m
Hi
I can't figure out why an exception is not trapped by an unhandled
exception handler and would appreciate some help.
My Windows Forms project has the Application Framework enabled and
includes the following event handler:
Private Sub AppUnhandledException(ByVal sender As Object, ByVal e As
Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs)
Handles Me.UnhandledException
'My code
End Sub
One of the Forms in the project includes a User Control that I've
written which contains a number of properties. If a Property value is
out of range an ArgumentException is thrown.
The code that loads the User Control's properties IS NOT included
within a Try Catch block. I was expecting that if a property value is
incorrect the ArgumentException thrown would be caught and reported by
the AppUnhandledException handler shown above. Instead what happens
is a "First chance ... ArgumentException" is reported in Visual
Studio's Output window but the AppUnhandledException handler is not
entered.
If I wrap the call to the User Control's property in a Try Catch block
the ArgumentException is caught. However, I don't want to have to
wrap every call to a property procedure (or group of property
procedures) in a Try Catch block as these seems inefficient.
Can someone help me diagnose why my unhandles eception handler is not
working. Thanks.
Peter,
I can't figure out why an exception is not trapped by an unhandled
exception handler and would appreciate some help.
My Windows Forms project has the Application Framework enabled and
includes the following event handler:
Private Sub AppUnhandledException(ByVal sender As Object, ByVal e As
Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs)
Handles Me.UnhandledException
'My code
End Sub
One of the Forms in the project includes a User Control that I've
written which contains a number of properties. If a Property value is
out of range an ArgumentException is thrown.
The code that loads the User Control's properties IS NOT included
within a Try Catch block. I was expecting that if a property value is
incorrect the ArgumentException thrown would be caught and reported by
the AppUnhandledException handler shown above. Instead what happens
is a "First chance ... ArgumentException" is reported in Visual
Studio's Output window but the AppUnhandledException handler is not
entered.
If I wrap the call to the User Control's property in a Try Catch block
the ArgumentException is caught. However, I don't want to have to
wrap every call to a property procedure (or group of property
procedures) in a Try Catch block as these seems inefficient.
Can someone help me diagnose why my unhandles eception handler is not
working. Thanks.
Peter,