I was wondering if anyone knew how to catch global exceptions in a VB.NET windows form application. Here is what I have tried already:
AddHandler System.Windows.Forms.Application.ThreadException, AddressOf HandleException
This works great for exceptions thrown within the main form's thread.
However, if I do something like the following:
'code that causes exception.
then inside my .net form app, I create a button that initiates the thread like so:
Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRun.Click
Dim oThread as Threading.Thread = New Threading.Thread(AddressOf TheThread)
the application will actually crash and exception will not get "Handled".
My Goal is to be able to output a memory dump of the exception causing the error on the main form thread and any thread being started by the form out to a file on the system for reporting later.
Thanks in advance for any assistance on this.