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

Is there a way to get hexadecimal output for watch and variables while debugging? #2713

Closed
cgraig opened this issue Nov 29, 2018 · 3 comments

Comments

@cgraig
Copy link

cgraig commented Nov 29, 2018

Environment data

dotnet --info output:
VS Code version:
C# Extension version:

Steps to reproduce

Expected behavior

Actual behavior

@gregg-miskelly
Copy link
Contributor

Yes, you can evaluate an expression with ,h (for hex) at the end. Example: myVariable,h

Here is the full list: https://github.com/MicrosoftDocs/visualstudio-docs/blob/master/docs/debugger/format-specifiers-in-csharp.md#format-specifiers

@cgraig
Copy link
Author

cgraig commented Dec 2, 2018

Great, thank you! Is there any way to apply the expression evaluation as a default for the "locals" variables? I could be misunderstanding but to get a hex view I need to add the variable to my watch window and then apply the ",h" evaluation. Was wondering/hoping there was a way to do this by default for all variables.

Thanks again!

@gregg-miskelly
Copy link
Contributor

Unfortunately VS Code doesn't have any UI to toggle between hex and decimal output. There is a feature request to enable this if you want to go "+1" it -- microsoft/vscode#28025

The one possible work around (besides adding things you want to look at to the watch window and adding the ',h' specifier) -- if you mostly run into this with a particular variable/field/property, you could wrap that variable and a struct like below.

[DebuggerDisplay("{Value,h}")]
struct HexInt
{
    public int Value;
}

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

No branches or pull requests

2 participants