Reputation: 14558
I just learned about $exception in the VS.NET watch window for .NET yesterday. This shows the current exception that has been thrown and is a big time-saver in not needing to find the little exclamation point icon and hover over it.
What other special variables are there in the watch window?
(Note: this question is about .NET, not C++.)
Upvotes: 20
Views: 3534
Reputation: 51511
Supported Pseudovariables in Visual Studio for .NET debugging:
$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.The following only apply to Visual Basic:
$delete,
variable or $$delete,
variable.$objectid,
expression or $listobjectids,
expression.IDynamicMetaObjectProvider
. Interface. The syntax is $dynamic,
object. This feature applies only to code that uses .NET Framework version 4. See Dynamic View.Upvotes: 12
Reputation: 420
@ERR ;Last error value,the same value returned by the GetLastError() API function
@TIB ;Thread information block for the current thread
@CLK ;Undocumented clock register; usable only in the Watch window
@EAX, @EBX, @ECX, @EDX, @ESI, @EDI, @EIP, @ESP, @EBP, @EFL ;Intel CPU registers
@CS, @DS, @ES, @SS, @FS, @GS ;Intel CPU segment registers
@ST0, @ST1, @ST2, @ST3, @ST4, @ST5, @ST6, @ST7 ;Intel CPU floating-point registers
Upvotes: 3
Reputation: 116481
If you right click any variable in the Watch window, you can create an Object ID. This will give you a number, e.g. the first object ID will be 1#.
The Object ID represents the specific instance. The instance can then be watched in the Watch window just like a regular variable, but you can keep watching the instance even when local reference go out of scope. When it eventually gets garbage collected you will lose access to it.
Upvotes: 9
Reputation: 942348
The $user pseudo variable is the only other documented one. In VS2010, the VB.NET debugger acquires some new ones.
Upvotes: 2
Reputation: 2166
Using "@err" will display the value of GetLastError() and "@err,hr" displays the error message.
Upvotes: 2