I've got a problem with exceptions being not handled correctly when showing a form from within a thread created when using a delegates BeginInvoke.
I.e. BeginInvoke runs a method async'ly which creates and shows a WinForm. And when this form throws an Exception I get a User-unhandled Exception thrown. In the VS2005 IDE this isn't so bad as it lets you continue, but once you run the application standalone you get a Unhandled Exception dialog and Details/Continue/Quit buttons.
Not really what you want.
I was under the impression that Exceptions thrown from within methods run in this manor would be propagated back out to the main thread when the call to EndInvoke was made, in my case from with in a callback method specified when calling BeginInvoke.
However, if, from within my asynchronous method, I choose not to open the form that throws the exception, and just to 'Throw New Exception' from right inside the method, this get handled correctly in my catch block when I call EndInvoke from within my call back method.
It seams that the exceptions are not handled correctly when they are thrown from within a form that was created within an asynchronous method when using asynchronous delegates.
How can I get these exceptions handled correctly?