Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NatVis: typedefs allowed?

I have a type defined as:

typedef unsigned short StringChecksum;

which I eventually intend to use a NatVis to display the corresponding value in a global string table we have loaded in memory.

So I've defined a new NatVis for testing(which is my first time):

<?xml version="1.0" encoding="utf-8" ?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
  <Type Name="StringChecksum">
    <DisplayString>StringChecksum {this}</DisplayString>
  </Type>
</AutoVisualizer>

I've turned on NatVis debugging in the registry and I can see my .natvis file being loaded by the debugger and parsed successfully.

I also have Edit and Continue turned off.

However when I debug code and examine a StringChecksum, I don't see any difference, it shows the integer. I expected it to show something like "StringChecksum 3433".

Is it possible for NatVis to work with types defined from a plain typedef? All of the examples I've seen are using classes. And if so any idea what might be wrong?

like image 411
ColinCren Avatar asked Oct 20 '22 11:10

ColinCren


1 Answers

And the answer is no. The debugger cannot tell the difference from the original type.

Interestingly, enums and even strongly typed enums do not currently work in VS2012 Update 2 either even though the debugger can in fact tell the difference.

like image 140
ColinCren Avatar answered Jan 02 '23 21:01

ColinCren