Add DebuggerDisplay for SearchValues#86559
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-runtime |
|
Just a general question: why this can't be just |
| { | ||
| T[] values = GetValues(); | ||
|
|
||
| string display = $"{GetType().Name}, Count={values.Length}"; |
There was a problem hiding this comment.
I'm using this in my testing, helps a ton when there are multiple generic variants.
Type implType = searchValuesInstance.GetType();
string impl = $"{implType.Name} [{string.Join(", ", implType.GenericTypeArguments.Select(t => t.Name))}]";E.g.
SingleStringSearchValuesThreeChars`2 [ValueLength8OrLonger, CaseSensitive]
src/libraries/System.Private.CoreLib/src/System/SearchValues/SearchValuesDebugView.cs
Show resolved
Hide resolved
|
Overriding |
|
This is effectively a collection. We don't override ToString on collections, and if we did, this wouldn't be the format chosen. The purpose of DebuggerDisplay is to raise for quick consumption the most relevant information for debugging purposes, not for runtime formatting. We should also feel free to frequently change a DebuggerDisplay rendering whereas doing so with ToString would not be desirable as code can take a dependency on it, it can be persisted in logs, test output, etc. This also needn't increase app size and can be trimmed as a debugger display. |


Before:

After:
