You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to serialize the record using JsonSerializer but it throws an exception: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported
I want to add a [JsonConstructor] attribute to the TargetScreen(PointF[] Locations) but it won't allow me to put an attribute on it
I want to serialize the record using JsonSerializer but it throws an exception: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported
I want to add a [JsonConstructor] attribute to the TargetScreen(PointF[] Locations) but it won't allow me to put an attribute on it
Description
my record:
I want to serialize the record using JsonSerializer but it throws an exception:
Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported
I want to add a
[JsonConstructor]
attribute to theTargetScreen(PointF[] Locations)
but it won't allow me to put an attribute on itReproduction Steps
Copy the class and deserialize it:
Expected behavior
I expected to put a
[JsonConstructor]
attribute on the record and make the record's main constructor the json constructor.Actual behavior
Gives an error:
Attribute 'JsonConstructor' is not valid on this declaration type. It is only valid on 'constructor' declarations.
Regression?
No response
Known Workarounds
switch to a normal class or play around with the constructors
Configuration
Visual Studio 2022, .NET 6, C# 9
Other information
No response
The text was updated successfully, but these errors were encountered: