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

Fix DebuggerDisplay for serializer types #65971

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -11,7 +11,7 @@ namespace System.Text.Json.Serialization.Metadata
/// <summary>
/// Provides JSON serialization-related metadata about a property or field.
/// </summary>
[DebuggerDisplay("MemberInfo={MemberInfo}")]
[DebuggerDisplay("{DebuggerDisplay,nq}")]
[EditorBrowsable(EditorBrowsableState.Never)]
public abstract class JsonPropertyInfo
{
Expand Down Expand Up @@ -519,5 +519,8 @@ internal JsonTypeInfo JsonTypeInfo
/// Default value used for parameterized ctor invocation.
/// </summary>
internal abstract object? DefaultValue { get; }

[DebuggerBrowsable(DebuggerBrowsableState.Never)]
eiriktsarpalis marked this conversation as resolved.
Show resolved Hide resolved
private string DebuggerDisplay => $"MemberInfo={MemberInfo}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace System.Text.Json.Serialization.Metadata
/// Provides JSON serialization-related metadata about a type.
/// </summary>
/// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called directly.</remarks>
[DebuggerDisplay("ConverterStrategy.{ConverterStrategy}, {Type.Name}")]
[DebuggerDisplay("{DebuggerDisplay,nq}")]
[EditorBrowsable(EditorBrowsableState.Never)]
public partial class JsonTypeInfo
{
Expand Down Expand Up @@ -632,5 +632,8 @@ private static bool IsByRefLike(Type type)

return numberHandlingAttribute?.Handling;
}

[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private string DebuggerDisplay => $"ConverterStrategy.{PropertyInfoForTypeInfo.ConverterStrategy}, {Type.Name}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace System.Text.Json
{
[DebuggerDisplay("Path:{JsonPath()} Current: ConverterStrategy.{Current.JsonTypeInfo.PropertyInfoForTypeInfo.ConverterStrategy}, {Current.JsonTypeInfo.Type.Name}")]
[DebuggerDisplay("{DebuggerDisplay,nq}")]
internal struct ReadStack
{
internal static readonly char[] SpecialCharacters = { '.', ' ', '\'', '/', '"', '[', ']', '(', ')', '\t', '\n', '\r', '\f', '\b', '\\', '\u0085', '\u2028', '\u2029' };
Expand Down Expand Up @@ -355,5 +355,8 @@ private void SetConstructorArgumentState()
}
}
}

[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private string DebuggerDisplay => $"Path:{JsonPath()} Current: ConverterStrategy.{Current.JsonTypeInfo?.PropertyInfoForTypeInfo.ConverterStrategy}, {Current.JsonTypeInfo?.Type.Name}";
eiriktsarpalis marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace System.Text.Json
{
[DebuggerDisplay("ConverterStrategy.{JsonTypeInfo.PropertyInfoForTypeInfo.ConverterStrategy}, {JsonTypeInfo.Type.Name}")]
[DebuggerDisplay("{DebuggerDisplay,nq}")]
internal struct ReadStackFrame
{
// Current property values.
Expand Down Expand Up @@ -89,5 +89,8 @@ public bool IsProcessingEnumerable()
{
return (JsonTypeInfo.PropertyInfoForTypeInfo.ConverterStrategy & ConverterStrategy.Enumerable) != 0;
}

[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private string DebuggerDisplay => $"ConverterStrategy.{JsonTypeInfo?.PropertyInfoForTypeInfo.ConverterStrategy}, {JsonTypeInfo?.Type.Name}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace System.Text.Json
{
[DebuggerDisplay("Path:{PropertyPath()} Current: ConverterStrategy.{ConverterStrategy.JsonTypeInfo.PropertyInfoForTypeInfo.ConverterStrategy}, {Current.JsonTypeInfo.Type.Name}")]
[DebuggerDisplay("{DebuggerDisplay,nq}")]
internal struct WriteStack
{
/// <summary>
Expand Down Expand Up @@ -375,5 +375,8 @@ static void AppendPropertyName(StringBuilder sb, string? propertyName)
}
}
}

[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private string DebuggerDisplay => $"Path:{PropertyPath()} Current: ConverterStrategy.{Current.JsonPropertyInfo?.ConverterBase.ConverterStrategy}, {Current.JsonTypeInfo?.Type.Name}";
eiriktsarpalis marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace System.Text.Json
{
[DebuggerDisplay("ConverterStrategy.{JsonTypeInfo.PropertyInfoForTypeInfo.ConverterStrategy}, {JsonTypeInfo.Type.Name}")]
[DebuggerDisplay("{DebuggerDisplay,nq}")]
internal struct WriteStackFrame
{
/// <summary>
Expand Down Expand Up @@ -120,5 +120,8 @@ public JsonConverter InitializeReEntry(Type type, JsonSerializerOptions options)

return PolymorphicJsonPropertyInfo.ConverterBase;
}

[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private string DebuggerDisplay => $"ConverterStrategy.{JsonTypeInfo?.PropertyInfoForTypeInfo.ConverterStrategy}, {JsonTypeInfo?.Type.Name}";
eiriktsarpalis marked this conversation as resolved.
Show resolved Hide resolved
}
}