PDA

Click to See Complete Forum and Search --> : Weird Problem With Subscribing To ThreadException Event


groovydaz
Aug 17th, 2004, 03:15 PM
I have subscribed my application to receive unhandled exceptions in a custom Error class as below:


Application.ThreadException += new ThreadExceptionEventHandler(Error.unhandled);

To test I am generating the Exception in the form_load event with:

throw new Exception("Unhandled Exception!!");



It works really well, until I place a Windows Media Player object on the form, if I do this the Exception is handled normally and not through my custom class.

If I generate the errors when using a command button then there is no problem, unlike in form_load.


I also have found that if I comment out the following line then the exception is handled as I would like:
((System.ComponentModel.ISupportInitialize)(this.WMP)).EndInit();
note: WMP is the Windows media player object.


Any Ideas? Because Im stumped and also rather irritated by this.

Darren.