从哪里获得调试器变量的完整列表?

Where to get a full list of debugger variables?

我正在尝试设置跟踪点以在 VS 中打印命中计数,但我无法找到任何类型的 $NAME 以在打印消息对话框中使用。我试过 http://msdn.microsoft.com/en-us/library/vstudio/232dxah7(v=vs.100).aspx 但我找不到任何 link 来描述我可以输出的每个可能值。以前我使用了我为此编写的 VB 宏,但不幸的是它运行得太慢并且可能导致非常高的延迟,这在我的环境中是不可接受的。也许有人可以给我指点一些文章,我可以从中挑选足够的信息?

MSDN 指出:您可以使用 DebuggerDisplayAttribute 语法(请参阅 DebuggerDisplayAttribute)在消息中包含编程信息。这里有几个例子

http://msdn.microsoft.com/en-us/library/5557y8b4.aspx http://msdn.microsoft.com/en-us/library/system.diagnostics.debuggerdisplayattribute.aspx

看看这个问答: What expressions are allowed in tracepoints?

不完全是您想要的,但您可以通过在立即 window 中声明一个变量并停止执行来实现此目的,即:

int hitCount;

然后在 Breakpoint -> When Hit -> Print a Message 输入:

命中数:{hitCount}