Skip to content

Make natvis find winmds from the WinMD Reference - #1631

Open
Yexuan Xiao (YexuanXiao) wants to merge 3 commits into
microsoft:masterfrom
YexuanXiao:natvis-winmd-3
Open

Yexuan Xiao (YexuanXiao) wants to merge 3 commits into
microsoft:masterfrom
YexuanXiao:natvis-winmd-3

Conversation

@YexuanXiao

@YexuanXiao Yexuan Xiao (YexuanXiao) commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Fix microsoft/WindowsAppSDK#2809.

Currently, the VSIX extension only looks for winmd files from the exe directory and the system directory, making the visualization useless. In particular, metadata from the WindowsAppSDK was also not taken into consideration.

This patch passes the information of all winmd references to the binary through MSBuild, which is then parsed by the VSIX plugin to obtain the paths of the referenced winmd files. All of this is automatic.

All winmds are loaded lazily. When looking up a type, the extension first collects the paths of all winmd files, and then looks for the appropriate file based on the namespace of the type. Once a namespace has been looked up, it is recorded to avoid repeating a futile load the next time.

This patch also fixes the issue where natvis does not support reading winmd files under non-ASCII paths, because std::filesystem::path::string transcodes UTF-16 to ACP, and the Debugger's ACP is determined by Windows locale settings and is not always UTF-8.

std::filesystem::path::string has already been deprecated in C++26. If a UTF-8 path is needed, path.u8string() or winrt::to_string(path.native()) should be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Natvis for C++/WinRT doesn't work

1 participant