xmlvisual-studioclassnamenatvis

How to handle similar class names in different solutions, using native visualisers


In my company we are working with native visualisers (.natvis files) for debugging memory dumps in Visual Studio.

As we have equal class names for different projects, we are thinking of including .natvis files in the project definitions, and this seems to be working: the .natvis files get embedded in the symbol files (*.pdb) during the build, which is a good thing.

Unfortunately it now seems to be impossible to do any customisation: from both .natvis files (the file on PC and the one in the symbol file) the one in the symbol file gets priority, which makes it unchangeable, so no customisation seems to be possible anymore.

In order to have customisable .natvis files, we are thinking of altering the .natvisreload sequence. Is this possible or is there another approach for this (like adding parameters to the .natvisreload command)?


Solution

  • My question seems to be impossible to answer, as mentioned in the natvis schema I just found on my PC:

    natvis files that are part of a loaded project will always take precedence over files in the user natvis directory

    It seems that it is possible to distinguish between different solutions (applications) within the same natvis file, as you can see here:

      <!-- Solution1 -->
      <Type Name="Class_Name">
        <Version Name="Solution1.exe" Min="1.0" Max="99.99"/>
        <DisplayString>Class_Name Solution1 {m_strName}, {m_iID} </DisplayString>
      </Type>
    
      <!-- Solution2 -->
      <Type Name="Class_Name"> // in Solution2 Class_Name has no strName
        <Version Name="Solution2.exe" Min="1.0" Max="99.99"/>
        <DisplayString>Class_Name Solution2 identifier {m_iID}</DisplayString>
      </Type>