Unhandled Exceptions - Exception Management

Topics: CAB & Smart Client Software Factory
Feb 19, 2006 at 8:42 AM
originally posted by: christianwesterlund

I want a module to catch all unhandled exceptions in my app.
So in the class which inherits from FormShellApplication I do this:

<STAThread()> _
Public Shared Sub main()
Dim app As ShellApplication = New ShellApplication

Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException)
AddHandler Application.ThreadException, AddressOf app.ThreadException
app.Run()

End Sub

Private Sub ThreadException(ByVal sender As Object, ByVal e As Threading.ThreadExceptionEventArgs)
RaiseEvent ThreadExc(sender, EventArgs.Empty)
End Sub

<EventBroker.EventPublication("event://ThreadException")> _
Public Event ThreadExc(ByVal sender As Object, ByVal e As EventArgs)


The idea is to send an event with the threadexception eventually.
However, The ThreadException method doesn't get any unhandled exceptions.
I throw an exception in another module when I click on a menuitem:

Public Sub ShowMeClick(ByVal sender As Object, ByVal e As EventArgs)
Throw New Exception("HIHI")
End Sub

Visual Studio breaks at that line when I'm trying to throw the exception.

Anyone know what might be the case here?
Feb 21, 2006 at 5:09 AM
originally posted by: DLorenz

Chances are, you have something checked that causes it to stop at the Throw statement. You need to push Cntl-Alt-E and turn off the appropraite check marks so that it doesn't stop at that line. Hopefully that fixes your problem.
Feb 22, 2006 at 3:55 AM
originally posted by: christianwesterlund

There is a lot of things in that dialog box. I have not changed anything from the standard installation. Could it really be something I need to uncheck in that dialog box?
I have no idea what.