I was reading a couple of articles a while back which I think described a behaviour where you can, in a .net application (specifically VB.net), allow an exception to occur, and then handle it in some kind of application-level exception handler, as opposed to within a Try/Catch block. My google-fu is weak at the moment, so I’m not having much luck guessing what this feature is called in order to find information about it.
If this rings a bell for any of you, can you point me in the right direction on what exactly the feature is called so that I can search for it?
Sample code is always welcome, of course, but this is mostly just a case of me forgetting the name of the feature and being unable to search for it.
I believe you are looking for the AppDomain.UnhandledException event. This will allow you to handle any exception that is unhandled in the AppDomain of your choice. Most applications only have a single AppDomain so this code should do the trick
However, actually attempting to handle the event here is not the best idea. This will fire for any exception thrown from any part of the code. This could very easily be an exception that is fatal to some component you depend on and handling it could lead to further, worse errors down the road.
I usually use this event purely logging and error reporting scenarios.