In the Visual Studio debugger, you can view special 'variables' beginning with '$'. What are they?
For instance, write a function such as:
void foo()
{
try
{
throw new Exception(@"whatever");
}
catch
{
int n=1; //put a breakpoint here
}
}
When the debugger is on the line in the catch block, typing $exception
will show the exception information.
Are there any more? What are these things? There seems to be no official documentation on them. I've used $exception
for quite a while, but was 开发者_运维知识库hoping there were others that, for example, would show the return value of a method.
These are variables created by the debugger for your convenience. You get similar variables if you use the Immediate window:
int x = 10;
would result in $x in the locals window
More of the special variables are described in this article. There's also a comprehensive list of the variables available in windbg - not sure how many are supported in VisualStudio though
精彩评论