0

I'm working in a framework that does a lot of inheritance, and I've found that Natvis for one base class will interfere with that for another.

Here's a dumb example:

class MainBase {};
class ExtraBase {};
class Derived: MainBase, ExtraBase {};

With this natvis:

<Type Name="MainBase">
  <Expand>
    <Item Name="MainBaseItem">23</Item>
  </Expand>
</Type>

<Type Name="ExtraBase">
  <Expand>
    <Item Name="ExtraBaseItem">42</Item>
  </Expand>
</Type>

...I get this: https://i.stack.imgur.com/0dMNu.png

enter image description here

The expansion for MainBaseItem has shown up fine, but the one for ExtraBaseItem is nowhere to be seen.

In my real-world case, the natvis for the MainBase equivalent is very important, so I can't solve the problem by adding Inheritable="false" to it. It's also not practical to add specialised natvis for the derived class itself - there are thousands of derived classes. Given these unhelpful constraints, is there anything I can do to make ExtraBaseItem show up?

Biro Cash
  • 11
  • 4

1 Answers1

0
<Type Name="ExtraBase">
  <Expand>
    <!-- Example of hierarchical class shown below-->
    <Item Name="MainBaseItem [base]">(MainBaseItem*)this</Item>
  </Expand>
</Type>

Idk if i understand this correct ....

Patroni
  • 23
  • 5
  • My question wasn't very clear - in my example, the ExtraBaseItem 42 line represents some important property of ExtraBase which I want to make visible. I've edited the question to hopefully make it a bit clearer. – Biro Cash Aug 07 '18 at 15:37