Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get variable name in debugger visualizer

Is there a way to get the underlying variable name of a target object in a Visual Studio debugger visualizer? The built-in string visualizer does it:

string myStr = "abc\ndef";
Debugger.Break();

Clicking on the visualizer icon for myStr, you will see the "Expression" text box shows "myStr". How can I get this in my own visualizers?

like image 723
yoyoyoyosef Avatar asked May 20 '09 13:05

yoyoyoyosef


1 Answers

It's not possible to do. The only information provided to the visualizer is the value.

The string visualizer has the name because it is in fact not a true visualizer. That is, it's a debugger feature which has a greater level of access to the underlying metadata and more importantly the expression evaluators.

like image 50
JaredPar Avatar answered Sep 20 '22 06:09

JaredPar