If exception handling needs to be centralized, are the WinForm components wrong?

Or any other design that has gui widgets as the first port of call where an unhandled exception will kill the application?

We all want one basic one: "catch all" for face saving purposes (although in most cases this shouldn't have a "continuation"), but it cannot be easily implemented with the gui widget, which is the first port of the call. Is this project buggy or am I missing something?

I ask this because I was reading an article by a language developer and he stated that exception handling should be centralized, and the first thing that popped into my head was the WinForm event mechanism when it gets difficult.

Had the WinForm / GUI team listened to it, or was it perhaps too late?

+1


source to share


2 answers


You can put try / catch around Application.Run and handle Application.ThreadException. In handlers, you can register an exception and exit.



Apart from the above, I usually put an exception handler in all calls in the Business Tier (and all access to external resources in the client tier, such as exporting to a file) that display an error but don't exit the application.

+2


source


Do you know about Application.ThreadException ? I'm not saying this is necessarily the best answer, but it's at least the answer ...



+1


source







All Articles