Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Pseudovariables

This topic applies to:

Edition

Visual Basic

C#

F#

C++

Web Developer

Express

Topic appliesTopic appliesTopic does not applyTopic appliesTopic applies

Pro, Premium, and Ultimate

Topic applies

Topic applies

Topic does not apply

Topic applies

Topic applies

Pseudovariables are terms used to display certain information in a variable window or the QuickWatch dialog box. You can enter a pseudovariable the same way you would enter a normal variable. Pseudovariables are not variables, however, and do not correspond to variable names in your program.

Suppose you are writing a native code application and want to see the number of handles allocated in your application. In the Watch window, you can enter the following pseudovariable in the Name column, then press Return to evaluate it:

$handles

In native code, you can use the pseudovariables shown in this table:

Pseudovariable

Function

$handles

Displays the number of handles allocated in your application.

$vframe

Displays the address of the current stack frame.

$TID

Displays the thread ID for the current thread.

$ENV

Displays the size of the environment block.

Trying to edit the size of the environment block (in the Value column) causes the contents of the environment block to be displayed in the Output window when you press Return. It does not change the size of the environment block.

$CMDLINE

Displays the size of the command line string that launched the program.

Trying to edit the size (in the Value column) causes the command line string to be displayed in the Output window when you press Return. It does not change the size of the command line string.

$registername

or

@registername

Displays the contents of the register registername.

Normally, you can display register contents just by entering the register name. The only time you need to use this syntax is when the register name overloads a variable name. If the register name is the same as a variable name in the current scope, the debugger interprets the name as a variable name. That's when $registername or @registername comes in handy.

$clk

Displays the time in clock cycles.

$user

Displays a structure with account information for the account running the application. For security reasons, the password information is not displayed.

In C# and Visual Basic, you can use the pseudovariables shown in this table:

Pseudovariable

Function

$exception

Displays information on the last exception. If no exception has occurred, evaluating $exception displays an error message.

In Visual C# only, when the Exception Assistant is disabled, $exception is automatically added to the Locals window when an exception occurs.

$user

Displays a structure with account information for the account running the application. For security reasons, the password information is not displayed.

In Visual Basic, you can use the pseudovariables shown in the following table:

Pseudovariable

Function

$delete or $$delete

Deletes an implicit variable that was created in the Immediate window. The syntax is $delete, variable or $delete, variable.

$objectids or $listobjectids

Displays all active Object IDs as children of the specified expression. The syntax is $objectid, expression or $listobjectids, expression.

$N#

Displays object with Object ID equal to N.

$dynamic

Displays the special Dynamic View node for an object that implements the IDynamicMetaObjectProvider. Interface. The syntax is $dynamic, object. This feature applies only to code that uses .NET Framework version 4. See Dynamic View.

Community Additions

ADD
Show:
© 2015 Microsoft