Skip to content

std::unordered_map values display as "(,)" in hover/variables panel with cppvsdbg debugger #14362

@IanGrantLee

Description

@IanGrantLee

Environment

  • VS Code version: 1.115.0
  • cpptools extension: ms-vscode.cpptools 1.31.4
  • OS: Windows 11
  • Compiler: MSVC (Visual Studio Community 2022, amd64)
  • CMake Kit: Visual Studio Community 2022 Release - amd64

Bug Description

When debugging a C++ project built with MSVC (VS2022), std::unordered_map<int, float> values are displayed as (,) in both the hover tooltip and the Variables/Watch panel.

Image

Steps to Reproduce

  1. Declare and populate a std::unordered_map<int, float> variable.
  2. Start debugging (via CMake Tools, using cppvsdbg).
  3. Hover over the variable or expand it in the Variables panel.

Expected Behavior

Each entry should display as [key] = value, e.g. [3] = 0.5.

Actual Behavior

Each entry displays as [3] = (, ).

Additional Notes

  • begin()->first and begin()->second both evaluate correctly in the Watch panel, so debug info is intact.
  • The issue appears to be that std::pair::DisplayString expressions ({first}, {second}) fail when rendered as part of unordered_map expansion in vsdbg's natvis engine.
  • std::vector displays correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions