visual-studio-codenatvis

VSCode natvis working on some variables but not others of the same template type


enter image description here

Working with the above std::vectors on Android's NDK. If I define the natvis for std::__ndk1::vector_base as follows

    <Type Name="std::__ndk1::__vector_base&lt;*&gt;">
        <DisplayString>{{size={__end_ - __begin_}}}</DisplayString>
        <Expand>
            <Item Name="[size]" ExcludeView="simple">__end_ - __begin_</Item>
            <Item Name="[capacity]" ExcludeView="simple">__end_cap_.__value_ - __begin_</Item>
            <ArrayItems>
                <Size>__end_ - __begin_</Size>
                <ValuePointer>__begin_</ValuePointer>
            </ArrayItems>
        </Expand>
    </Type>

I get the following

enter image description here

Why is the natvis definition working for unsigned char but not unsigned long?


Solution

  • Looks like it might be a bug in VSCode as there was a bug reported in Aug2020 (now closed) that seems to imply that there is an issue when using unsigned long in templates.

    https://github.com/microsoft/vscode-cpptools/issues/5253