-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[DebuggerDisplay] for JsonTypeInfo does not render #65960
Comments
Tagging subscribers to this area: @dotnet/area-system-text-json Issue DetailsDescriptionWhile debugging some code using the JSON source generator in Visual Studio 2022 I found that the debugger display for a Instead of showing the intended display text, instead the IDE shows a message similar to Following the code through, it looks like there's an issue with the value passed to the constructor of the runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfo.cs Line 17 in c41f452
Reproduction StepsView a derived instance of `` using the JSON source generator in an IDE with Intellisense, such as Visual Studio 2022. using System.Text.Json.Serialization;
var context = new CustomJsonSerializerContext();
// Put a breakpoint on the line below and inspect context in the debugger
Console.ReadLine();
[JsonSerializable(typeof(bool))]
internal sealed partial class CustomJsonSerializerContext : JsonSerializerContext
{
} Expected behaviorA compiler error is not shown in the rendered debugger display for the class' properties. Actual behaviorThe properties all show a compiler error similar to the below.
Regression?No, this functionality was new in .NET 6. Known WorkaroundsNone. Configuration
Other informationNo response
|
Thanks, I've been seeing this as well. It seems to be impacting a few internal serializer types as well. I submitted a fix in #65971 |
Description
While debugging some code using the JSON source generator in Visual Studio 2022 I found that the debugger display for a
JsonSerializerContext
class is broken.Instead of showing the intended display text, instead the IDE shows a message similar to
ConverterStrategy.error CS0119: 'ConverterStrategy' is a type, which is not valid in the given context, "Boolean"
.Following the code through, it looks like there's an issue with the value passed to the constructor of the
[DebuggerDisplay]
attribute onJsonTypeInfo
here:runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfo.cs
Line 17 in c41f452
Reproduction Steps
View a derived instance of `` using the JSON source generator in an IDE with Intellisense, such as Visual Studio 2022.
Expected behavior
A compiler error is not shown in the rendered debugger display for the class' properties.
Actual behavior
The properties all show a compiler error similar to the below.
Regression?
No, this functionality was new in .NET 6.
Known Workarounds
None.
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: