Every now and then a feature gets put into the product that just gives you this tickle of excitement every time you think about it. $exception I find is one of those features.
Ok – so what scenario would I use it in? Lets say you’re writing some managed code. You’re debugging your merry way through the code when voilà, it crashes. Sigh. You see the little error dialog with additional information but to explore your code you have to dismiss it. As you go through your code, you wonder what that message said again? So you write a try catch and repeat the process.
Well, in Everett the debugger team put in a little feature called $exception. The next time you crash in C# or J# go ahead and dismiss the dialog. Open the locals window and take a peek at $exception there (chills are setting in right now). Expand it and you can see all the delightful things inside the Exception object – Messages, Stacktrace, Inner Exception etc – everything you would have gotten had you put a try catch around the code and caught the exception object. Is that cool or what?