-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Improve debug views of dictionaries #52867
Conversation
I have mixed feelings about this. Not sure I want to lose sight of index. Although I welcome an easier to read key. Is 3 columns easily possible? Or some format that preserves the index? |
Three columns isn't possible. What do you want the existing number in the name column for? It is meaningless. The new value is actually the index. For example: var headers = new Dictionary<string, string> { ["content-type"] = "application/json" };
var v1 = headers["content-type"]; // works
var v2 = headers[0]; // trying to use the number causes a compile error that a string is expected And displaying the number becomes confusing in the cases when the dictionary key is an integer: var products = new Dictionary<int, string> { [1] = "Apple", [0] = "Orange" }; |
One more thing. In the screenshot, one of the headers shows up as
vs
Of course, the server should handle it the same way, but I could see it mattering for query strings or something. Since quotes inside the |
Fixes #51827
Update custom dictionaries in ASP.NET Core to display the key in the name column. There are a lot of dictionaries and I haven't tested all of them, but reusing debugger proxies on most dictionary types means they should just work.
Background: .NET debugging has supported customizing the name for years, but for some reason dictionaries have always displayed a meaningless index in the name column instead of the item key. See dotnet/runtime#88736
Items before:
Items after:
Cookies before:
Cookies after:
Request headers before:
Request headers after:
Route values before:
Route values after:
Features before:
Features after: