Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Pseudovariables

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

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:

PseudovariableFunction
$errDisplays the last error value set with the function SetLastError. The value that is displayed represents what would be returned by the GetLastError function.

Use $err,hr to see the decoded form of this value. For example, if the last error was 3, the $err,hr would display ERROR_PATH_NOT_FOUND : The system cannot find the path specified.
$handlesDisplays the number of handles allocated in your application.
$vframeDisplays the address of the current stack frame.
$tidDisplays the thread ID for the current thread.
$envDisplays the environment block in the string viewer.
$cmdlineDisplays the command line string that launched the program.
$pidDisplays the process id.
$ 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.
$clkDisplays the time in clock cycles.
$userDisplays a structure with account information for the account running the application. For security reasons, the password information is not displayed.
$exceptionstackDisplays the stack trace of the current Windows Runtime exception. $ exceptionstack works only in Store apps that are running on Windows 8.1 or later. $ exceptionstack is not supported for C++ and SHE exceptions
$ReturnValueDisplays the return value of a .NET Framework method. See Examine return values of method calls

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

PseudovariableFunction
$exceptionDisplays 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.
$userDisplays 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:

PseudovariableFunction
$delete or $$deleteDeletes an implicit variable that was created in the Immediate window. The syntax is $delete, variable or$delete, variable.
$objectids or $listobjectidsDisplays 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.
$dynamicDisplays 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.

Watch and QuickWatch Windows
Variable Windows

Show:
© 2017 Microsoft