Developer Blog - Inventic.eu
  • Skipper - The ORM Designer
  • VsBuilds - Parallel building
  • Pulpo - Free Skipper CLI

Tag: #Visual studio 2013

Visual Studio 2013 - Visualizers

One of very useful feature of Visual Studio is custom variables views. It's possible to configure own views to each of your class. For this, VS2013 (and VS2012) uses .natvis files located in following directories:

%VSINSTALLDIR%\Common7\Packages\Debugger\Visualizers<br />
%USERPROFILE%\My Documents\Visual Studio 2013\Visualizers<br />

Files are stored in common .xml format and has following format:

&lt;AutoVisualizer xmlns=&quot;http://schemas.microsoft.com/vstudio/debugger/natvis/2010&quot;&gt;<br />
  &lt;Type Name=&quot;String::CStringHolder&amp;lt;String::string_trait&amp;lt;char&amp;gt; &amp;gt;&quot;&gt;<br />
    &lt;DisplayString&gt;{m_pszData,s8}&lt;/DisplayString&gt;<br />
    &lt;StringView&gt;m_pszData&lt;/StringView&gt;<br />
    &lt;Expand&gt;<br />
      &lt;Item Name=&quot;[m_pszData]&quot;&gt;m_pszData&lt;/Item&gt;<br />
      &lt;Item Name=&quot;[nDataLength]&quot;&gt;m_pStringData-&gt;nDataLength&lt;/Item&gt;<br />
      &lt;Item Name=&quot;[nAllocLength]&quot;&gt;m_pStringData-&gt;nAllocLength&lt;/Item&gt;<br />
      &lt;Item Name=&quot;[nRefs]&quot;&gt;m_pStringData-&gt;nRefs&lt;/Item&gt;<br />
    &lt;/Expand&gt;<br />
  &lt;/Type&gt;<br />
&lt;/AutoVisualizer&gt;<br />

Debugging .natvis files

Visual studio contains a way how to catch syntax and logical errors in natvis format. All warnings/errors can be displayed to Visual Studio output panel by specifying following registry key to "1".

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Debugger<br />
&quot;EnableNatvisDiagnostics&quot;=dword:00000001<br />

Note: It's necessary to restart Visual studio to turn on this feature

Other usefull links

06 Aug 2014