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

DebuggerDisplayAttribute implementation doesn't have means to check for the current display settings (such as hexadecimal base) #39661

Open
vsfeedback opened this issue Nov 4, 2019 · 1 comment
Labels
Area-Interactive Developer Community The issue was originally reported on https://developercommunity.visualstudio.com Interactive-Debugging
Milestone

Comments

@vsfeedback
Copy link

vsfeedback commented Nov 4, 2019

This issue has been moved from a ticket on Developer Community.


I'm using a bit pattern (a Uinteger) as a key in a Dictionary. I've switched the display to hex, but the values are still displayed in decimal. This is similar to an already reported problem, which has been solved in VS 15.8, but it's happening in VS 15.9.6.

The attached shows a dictionary whose count in in hex but the keys are in decimal.

This happens both when using the "locals" tab and when hovering over a value.

Whether the item number shold be in hex or decimal is an interesting question.

(private comment, text removed)
image

@tmat tmat changed the title Hex display is incorrect for data structures DebuggerDisplayAttribute implementation doesn't have means to check for the current display settings (such as hexadecimal base) Nov 4, 2019
@tmat
Copy link
Member

tmat commented Nov 4, 2019

KeyValuePair<K,V> could use DebuggerDisplayAttribute("[{Key}, {Value}]"), which would result in formatting the Key as a hexadecimal number. This is however not a recommended pattern due to performance. The recommended pattern is to define GetDebuggerDisplay method and use DebuggerDisplayAttribute("{GetDebuggerDisplay(),nq}"). However, GetDebuggerDisplay is not aware of "hex" mode.

Perhaps we could allow GetDebuggerDisplay to take an enum DebuggerDisplayOptions as an argument that would reflect the current debugger settings.

@tmat tmat added this to the Backlog milestone Nov 4, 2019
@sharwell sharwell added the Developer Community The issue was originally reported on https://developercommunity.visualstudio.com label Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Interactive Developer Community The issue was originally reported on https://developercommunity.visualstudio.com Interactive-Debugging
Projects
None yet
Development

No branches or pull requests

3 participants