How is it possible that exceptions (which are handled), are suddenly unhandled when clicking on a toolbutton?
I can't explain it very well, so that's why I attached a sample project demonstrating the problem. Both the normal button and the toolbutton call a method "Throw()", which in turn throws an exception. I've got a try/catch block in program.cs, to catch the exception. For the normal button, this works as expected. But when using the toolbutton, the exception isn't handled anymore.
Can anyone point me in the right direction? Thanks in advance.
Permission to bump?
I'm not really sure why, but it looks like the Application's ThreadException event is being fired when the exception is thrown through the ToolClick and not when it is thrown through the Button click. So the default ThreadException handling is being used and it is showing the normal error dialog. You can show your own dialog by handling the Application.ThreadException event in your Main method before calling off to Run. When the exception is thrown by the ToolClick, your event handler will get called.
Thanks, this solution works for me. But perhaps your support team could look into this, because I think the ToolClick should not throw the ThreadException in this case.
Hi,
I have created the following support case for you : CAS-46612-Z0N4BV. I will inform you about the progress of this issue there. If you have any further questions you could submit them to the ticket.
Regards,
Stefaniya
I agree. I have forwarded this post to the Developer Support Manager and a DS engineer will be contacting you about this issue.