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

Add DebuggerTypeProxy to ListDictionaryInternal #91355

Merged
merged 3 commits into from
Sep 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace System.Collections
/// Recommended for collections that typically include fewer than 10 items.
/// </summary>
[DebuggerDisplay("Count = {count}")]
[DebuggerTypeProxy(typeof(ListDictionaryInternalDebugView))]
[Serializable]
[TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
// Needs to be public to support binary serialization compatibility
Expand Down Expand Up @@ -405,5 +406,31 @@ private sealed class DictionaryNode
public object? value;
public DictionaryNode? next;
}

private sealed class ListDictionaryInternalDebugView
{
private readonly ListDictionaryInternal _list;

public ListDictionaryInternalDebugView(ListDictionaryInternal list)
{
ArgumentNullException.ThrowIfNull(list);
_list = list;
}

[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public KeyValuePairs[] Items
{
get
{
var array = new KeyValuePairs[_list.count];
int index = 0;
for (DictionaryNode? node = _list.head; node != null; node = node.next)
{
array[index++] = new KeyValuePairs(node.key, node.value);
}
return array;
}
}
}
}
}
Loading