Deploying a software, it's a common practice to encapsulate top-most function calls and/or event handlers with general try-catch blocks to deliver an error description to the user instead of just having him/her see the software exiting unexpectedly
when unexpected exceptions occur.
Unfortunately, during debugging it is most annoying to reach these log entries or message boxes instead of having Visual Studio halt where the exception occured.
At the time of writing it is possible to designate particular exception types to halt the debugger when they are actually thrown. But it becomes a nuisance when there are many exception types to be marked this way. Plus, it becomes contra-productive if there
is a scenario when expected exceptions of the marked types occur regularly and "Continue" has to be selected again and again in the debugger.
Thus, I'd like to suggest to add a new, Microsoft specific, "try" keyword to all of the CLR languages (plus C++), perhaps something like "__try". This new kind of try should create a try-catch block only when compiling in
Release mode. (This behaviour might apply to other configurations as well. I suppose the Configuration Settings dialog to provide an additional checkbox column to provide an option to select whether a particular configuration will create
a try-catch block or not.)
View Complete Post