Friday, June 19, 2009

DevTnT 7 - Using $exception within Visual Studio’s Debugger

Sometimes our exception handling code makes no use of the exception object that has been thrown. Therefore we do not need to declare a variable to reference it (i.e. the traditional “ex”). However this leads to an issue while debugging. Without a variable there is nothing to mouse over in order to display the exception’s contents once the initial popup has been dismissed.

Instead of doing this you can add the special variable $exception to the debugger’s Watch Window, or query it via the Immediate Window. This variable references the currently thrown exception when located within a catch block.

image

No comments:

Post a Comment