Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$exception Pseudovariable is not Available in Visual Studio Debugger (Dollar Exception)

I frequently use the $exception pseudovariable to gain access to the items in theUpdateException.StateEntries collection as they are not accessible via the Exception Assistant's 'View Details' dialog.

Adding a watch with the name '$exception' will return the current exception. This is also available automatically in the Locals window for C# if the exception assistant is disabled.

I have seen cases where this variable is not available. Why might this be and how can it be restored?

Edit: I have also posted this issue to Connect.

Edit2: The following post describes the purpose of this setting.

Did you know? You can unwind the call stack from exceptions

And this one includes a couple of screenshots of the dialogs involved.

Did you know… What unwinding the call stack on unhandled exceptions does? – #277

like image 706
Scott Munro Avatar asked Aug 09 '11 05:08

Scott Munro


1 Answers

Tools -> Options -> Debugging (General) [VS 2010]

Do you have "Unwind the call stack on unhandled exceptions" unchecked ?

It needs to be unchecked for $exception to work.

like image 148
Patrick Avatar answered Oct 04 '22 20:10

Patrick