Search code examples
c++debuggingvisual-studio-2012visualizer

Natvis Visual Studio 2012 Template class casting error


I am writing a natvis file for visual studio 2012 to help customize what is displayed while debugging. I'm trying to cast a void* to a template class & I'm seeing the following error:

Fatal error: Element CDIB' is unexpected according to content model of parent element

Here is my code:

<?xml version="1.0" encoding="utf-8"?> 
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> 
<Type Name="CDIBPtr"> 
  <DisplayString>(CRefCountRep<CDIB>*)m_rep</DisplayString> 
</Type>
</AutoVisualizer>

Any ideas?


Solution

  • Angle brackets must be escaped according to XML rules. It should be.

    <?xml version="1.0" encoding="utf-8"?> 
    <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> 
      <Type Name="CDIBPtr"> 
        <DisplayString>(CRefCountRep&lt;CDIB&gt;*)m_rep</DisplayString> 
      </Type>
    </AutoVisualizer>