Add index to OrderedDictionary debugger display#120885
Conversation
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
|
Tagging subscribers to this area: @dotnet/area-system-collections |
src/libraries/Common/tests/System/Collections/DebugView.Tests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
|
... Fixed build error by making the DebuggerTypeProxy attribute conditional. When SYSTEM_COLLECTIONS is defined (System.Collections project), it uses OrderedDictionaryDebugView. Otherwise (e.g., System.Text.Json for netstandard2.0), it falls back to IDictionaryDebugView. Commit: TBD (in progress) |
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
eiriktsarpalis
left a comment
There was a problem hiding this comment.
@copilot could you add back testing that validates the expected display format?
Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
Added Commit: TBD (in progress) |
eiriktsarpalis
left a comment
There was a problem hiding this comment.
@copilot please fix the failing builds
I've verified that both System.Collections and System.Text.Json build successfully locally, and the |
|
@copilot take a look at CI logs: |
…dDictionary tests Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
... Fixed by wrapping OrderedDictionary test cases with Commit: TBD (in progress) |
|
@eiriktsarpalis, my sign-off doesn't count; can you review? |
I signed off, I think @eiriktsarpalis is not available today. |
|
/ba-g test failures unrelated. |
Changed OrderedDictionary debugger display to use a list-style view where items are shown as KeyValuePairs with implicit indexing from array position. The debugger will display:
Changes Made
KeyValuePair<TKey, TValue>[]array. Simplified implementation usesCopyTofor better performance.DebuggerTypeProxyattribute to always useOrderedDictionaryDebugViewTestDebuggerAttributes_OrderedDictionarythat validates the debug view returns KeyValuePair array items in the correct order#if !NETFRAMEWORKto prevent compilation errors on .NET Framework where the type is not availableThe list-style view shows index information implicitly through array position ([0], [1], [2]) while keeping the key/value relationship clear with standard KeyValuePair display. This matches the display pattern used by Queue, Stack, and List.
Testing
Fixes #118590
Original prompt
Fixes #118590
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.