I suggest you ...

Support for function call in natvis

Hi,

I have a question if natvis visualizator will be extended to support function call?
For example I have a class:
`class A {
const char* describe() const;
};`

And I would like to in debugger be able to see result of describe();
Somethink like:

<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">

<Type Name="A">
<DisplayString>{{ data={this->describe()} }}</DisplayString>
</Type>

</AutoVisualizer>

13 votes
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Michał Błasiak shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

2 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...
  • Matt Haynie commented  ·   ·  Flag as inappropriate

    This is a significant issue. Most (all?) functions that you attempt to call in either the Watch window or NatVis display the message "This expression has side effects and will not be evaluated", or "Function <name> has no address, possibly due to compiler optimizations." This completely handicaps the entire debugger system unless you're working on only POD types.

    For the former "side effects" message, this is almost never accurate, and as far as I can tell there's no way to tell the debugger "trust me, you're wrong, I know what I'm doing". I have no problem with it being careful what it evaluates, as long as there's a way to override it when it's wrong.

    While I understand it's not the same thing, complex debugging expressions are fully supported in C# by making a property with your code in it, then evaluating that property.

Feedback and Knowledge Base