Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2015 Visualiser, (*.natvis) DisplayString call a function to display the value

I have a complex class, (MyClass), that has a function called ToString(), the function returns a string representation of the string.

I would like the visual studio visualiser to use that function to display the variable

This is my visualizer,

<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
  <Type Name="MyClass">
    <DisplayString>...</DisplayString> 
  </Type>
</AutoVisualizer>

If I use

...
  <DisplayString>{ToString}</DisplayString> 
...

The address of the function is returned, is it possible to display the result of the function?

If not, what would be the best way of displaying a string representation of the class?

like image 804
FFMG Avatar asked Dec 05 '15 07:12

FFMG


1 Answers

Methods cannot be called.

From MSDN Forums:

Calling a function from the debugger is playing with fire. You are likely to deadlock on cross thread dependencies (even if you don't have any explicit cross thread dependencies, there are shared locks for things like memory allocation). This is why the C++ debugger has no support for implicit funceval

like image 195
Thomas Weller Avatar answered Oct 22 '22 21:10

Thomas Weller