简体   繁体   中英

Why does this dictionary display differently in debug between VB.NET and C#?

I've been working in C# and VB.NET a lot lately, and the other night I noticed this strange behavior when running some through a debugger and trying to look at the contents of a Dictionary object. I'm fairly certain I've looked through a Dictionary in C# before and saw its contents, but now what I'm seeing is:

调试器中的C#Dictionary

Poking around in those sub parts, like the keys and values, doesn't show what's in the dictionary, just take me around in a loop to this same debugger window. I can't look at my values anywhere here.

Where as VB.NET looks fine:

调试器中的VB.NET Dictionary

Any idea why C# is different? Is there a setting or something I have off?

Somehow you're being shown the "Raw View -> Non-Public members" window. However, the list of numerically-indexed values should be accessible if you scroll down in this window to the next-to-last row, "values". Can you post a screenshot showing the expanded "keys" window?

Uncheck Tools -> Options -> Debugging -> General, 4th option from last: "Show raw structure of objects in variable windows". (Thanks should also go to https://stackoverflow.com/a/13422426/2236012 for sharing this settings path.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM