Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ debug: extend natvis to allow it to display the message() of std::error_code #242514

Closed
StephenApptronik opened this issue Mar 3, 2025 · 4 comments
Assignees
Labels
*caused-by-extension Issue identified to be caused by an extension

Comments

@StephenApptronik
Copy link

The type "std::error_code" is part of the standard library for communicating errors when not using exceptions in C++. When an error is set, it constructs an object that is an integer and a reference to an object that can translate that integer into a string. However, the Watch window by default displays errors like this:

err = std::error_code = {std::_V2::error_category: 2}

To get the message string, one has to invoke err.message(). For an error type on the stack, I can do that, although it is annoying that I cannot simply add a watch to err or get that info through hover. When the error is embedded in a cluster of more information, it gets harder.

Currently natvis cannot be taught how to display the message because that involves invoking a function. Is there any way to add the view functionality for err specifically without opening up the full can of worms that is arbitrary function invocation?

@roblourens
Copy link
Member

/extCpp

@roblourens roblourens reopened this Mar 5, 2025
@roblourens
Copy link
Member

You can file this on the repo for the C++ debug extension

@vs-code-engineering vs-code-engineering bot added the *caused-by-extension Issue identified to be caused by an extension label Mar 5, 2025
@StephenApptronik
Copy link
Author

Sorry -- I didn't know there was a separate repo, and this was where I found other natvis tickets.
Refiled here: microsoft/vscode-cpptools#13340

@roblourens
Copy link
Member

Np, this could also relate to #197287 I suppose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
*caused-by-extension Issue identified to be caused by an extension
Projects
None yet
Development

No branches or pull requests

2 participants