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
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
@@ -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
{
@@ -519,5 +519,8 @@ internal JsonTypeInfo JsonTypeInfo
/// Default value used for parameterized ctor invocation.
/// </summary>
internal abstract object? DefaultValue { get; }

[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private string DebuggerDisplay => $"MemberInfo={MemberInfo}";
}
}
Original file line number Diff line number Diff line change
@@ -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
{
@@ -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
@@ -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' };
@@ -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}";
}
}
Original file line number Diff line number Diff line change
@@ -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.
@@ -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
@@ -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>
@@ -375,5 +375,8 @@ static void AppendPropertyName(StringBuilder sb, string? propertyName)
}
}
}

[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private string DebuggerDisplay => $"Path:{PropertyPath()} Current: ConverterStrategy.{Current.JsonPropertyInfo?.ConverterStrategy}, {Current.JsonTypeInfo?.Type.Name}";
}
}
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@

namespace System.Text.Json
{
[DebuggerDisplay("ConverterStrategy.{JsonTypeInfo.PropertyInfoForTypeInfo.ConverterStrategy}, {JsonTypeInfo.Type.Name}")]
[DebuggerDisplay("{DebuggerDisplay,nq}")]
internal struct WriteStackFrame
{
/// <summary>
@@ -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}";
}
}