Previously, I talked about the new debugger visualizers in Visual Studio 11 (Developer Preview) based on XML. By the way, I haven’t any luck trying to figure out where does the file type
.NATVIS come from.
In previous versions of the Visual Studio, all templates of debugger visualizers have to be saved in single file:
%VSINSTALLDIR%\Common7\Packages\Debugger\autoexp.dat. In case one wants to extend or improve the templates definition, maintaining everything in one system-wide file is neither practical nor safe.
The visualizers in Visual Studio 11 seem to solve the maintenance hassle by allowing more modular approach. First nice feature is that custom templates can be defined without touching any of the installed Visual Studio files and can be put in
%USERPROFILE%\Documents\Visual Studio 11\Visualizers. Second nice feature I’ve just discovered is that definitions of visualizers can be split into several separate
.natvis files. It is especially useful if one wants to maintain visualizers grouped according to libraries (e.g. Loki, Boost, POCO).
%USERPROFILE%\Documents\Visual Studio 11\Visualizers works like a package of custom visualizers now:
Having the visualizers diagnostics enabled, whole process of parsing and loading
.natvis files will be traced in Visual Studio 11 output window:
No more copying and pasting debugger visualizers for Boost and others into big muddy autoexp.dat.
BTW, who knows where does NATVIS come from, hmm? :-)
There is a very good article by Cagri Aslan from Microsoft about Writing debugger type visualizers for C++ using .natvis files