Get variable name in debugger visualizer

Is there a way to get the base name of the target variable in the Visual Studio debugger visualizer? The built-in row visualizer does this:

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

By clicking on the visualizer icon for myStr , you will see that β€œmyStr” is displayed in the Expression text box. How can I get this in my own visualizers?

+7
debugging c # visual-studio debuggervisualizer
source share
1 answer

This is impossible to do. The value is only the information provided to the visualizer.

The row visualizer has a name because it is not really a true visualizer. That is, it is a debugger function that has a greater level of access to underlying metadata and, more importantly, expression evaluators.

+9
source share

All Articles