Project Support for Natvis

Project Support for Natvis

Rate This
  • Comments 14

The past two releases of Visual Studio have evolved the Natvis format to allow developers to easily visualize their debug data inside the VC++ expression evaluator.  The first Visual Studio “14” CTP provides a new way for native developers to consume and manage their Natvis debug visualizers.  In response to requests from Visual Studio developers, these files can now be added to a VC++ project which enables easier tracking and integration with source control.  Special thanks to C++ MVP Marius Bancila for sharing the Natvis project integration on his blog

 

Adding a Visualizer to a Project

Existing .natvis files can be easily added to a project using the “Add Existing Item…” option and navigating to their location.

 

In the image below, Volcanoes.natvis has been added to the project and is shown in the Solution Explorer. 

Natvis files from the project will be evaluated by the debugger after all other directories, allowing an existing visualizer to be overridden by a custom .natvis file inside the project.

Note: The CTP does not have a new item template for a blank .natvis file, however this will be available in the next release of Visual Studio along with a file icon for Natvis.

 

Live Editing While Debugging

Another improvement that we made for the first CTP is that the debugger no longer needs to be stopped to pick up the changes.  The animation below demonstrates the live editing of Volcanoes.natvis while debugging the program. Visualization code is pasted into the .natvis file and then saved during the debugging session. Notice how the value for volcanoesOfWashington turns red to indicate that the saved changes in the visualizer have been picked up by the debugger:

 

For more details on writing .natvis debug visualizers, consult these blog posts:

In conclusion, please let us know what you think about these improvements by submitting feedback either online (blog comments, UserVoice, Connect) or through the Feedback button in the upper right corner of Visual Studio ().  Thanks!

 

Leave a Comment
  • Please add 3 and 4 and type the answer here:
  • Post
  • Can you use natvis with native edit & continue in 14?

  • What does Nativs mean? Is it a twisted term for "natives"?

  • Without edit & continue support (both activatable at the same time) this feature is useless for us.

  • I think that is great news and makes natvis a very good feature.

  • This looks really great.

    Although not strictly related to visualization, a colleague of mine made a very interesting suggestion for the (native) Step Into Just My Code feature (that uses files sitting next to .natvis files, which is why I suggest this here): instead of painfully maintaining .natstepfilter files, wouldn't it be cool if, when debugging a function, we could somehow tell the debugger "In the future, don't step into the current method anymore", maybe dynamically modifying an "autodisables.natstepfilter" in the user Visualizers folder. What do you think?

  • This is a very exciting news.

    First, please assign an icon for nativs. With EnvDTE system, its very easy to add icon but you guys already know that! :D

    Secondly, please update natvis to get new YAML format and schema validations.

    Expansion on my second point can be found here: visualstudio.uservoice.com/.../6050429-yaml-in-addition-to-json

  • The live update is very nice.  

    C++/CLI devs, please vote for my UserVoice plea to support natvis when in Mixed mode debugging.

    visualstudio.uservoice.com/.../4192306-support-natvis-debug-visualizers-in-mixed-mode-deb

  • @jschroedl, done!

    Please vote for out-of-the-box YAML support in VS: visualstudio.uservoice.com/.../6050429-yaml-in-addition-to-json

  • please avoid yaml like the plague.

    It's a messy thing, like all the indentation based languages...

  • This is great, but what would be even more useful is if the visualizers could be linked into the symbol files so you would be able have the correct visualizers when debugging crash dumps.

  • @edl_si & Vertex: Due to Natvis using a newer debug engine than the one used for native edit and continue, it is not currently possible to use both of these features at the same time.  We are investigating the feasibility of implementing edit and continue in the new debug engine, but at this time it is too early to comment on when this will be available.

    @Sam: Natvis is derived from “Native visualizers”.  It is a framework that allows you to modify how native objects in memory are displayed inside Visual Studio while debugging using XML-defined views.

    msdn.microsoft.com/.../jj620914.aspx

    @Benjamin: Thanks for sharing the ideas, we will look into how we can improve this type of debugging experience in the future.

    @Sebastian: Glad to hear that!

    @Adeel:   As stated in the post, a Natvis file icon is coming in the next release of Visual Studio.  We do not currently have any plans to support YAML for Natvis, but will monitor developer demand on UserVoice concerning this suggestion.

    @Erik: A feature like the one you describe is coming soon:)

  • While the improvements brought by natvis are very welcome, could you please take care of the regression introduced with VS 2012 which causes the watch window to incorrectly calculate member adresses - and thus showing incorrect values for members when virtual inheritance is involved (see connect.microsoft.com/.../watchwindow-incorrectly-calculates-member-address)

  • @Debugini:  Thanks for the feedback, we are looking into fixing this issue for a future release of Visual Studio.

  • @Benjamin Visual Assist is a Visual Studio extension; the latest release (build 2042) has new native debugger functionality for telling the debugger not to step into specific functions.  see docs.wholetomato.com/default.asp for details.

Page 1 of 1 (14 items)