microsoft / microsoft/vscode-cpptools

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

Open
#14,362 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug debugger help wanted
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the supplied MSVC/cppvsdbg setup, then inspect how the debugger's natvis handling expands std::unordered_map entries and evaluates std::pair::DisplayString expressions. Compare hover and Variables-panel output with the working Watch expressions; done means each entry displays its key and value instead of (, ).

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.