-
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
.NET 7 Preview 7 - Polymorphic Deserialization ignores PropertyNameCaseInsensitive setting #75269
Comments
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsDescriptionI have the following class structure
Reproduction StepsDeserializing following json doesn't work
while the following works
Mind that only difference is the capical A in Expected behaviorDeserializes correctly without error Actual behaviorThrows error
Regression?No response Known WorkaroundsNo response Configuration
Other informationNo response
|
I tend to agree that this is an omission that should be fixed. However, it doesn't meet the bar for a .NET 7 fix. As a workaround I would suggest hardcoding the expected casing as a string literal instead of using |
Moving to Future as we won't be able to work on this for 8.0 |
Serializer should also consider case options for discriminator property on serialization too. For now, discriminator property name is written as specified in attribute or contract model configuration. I'm also wondering, as we have generic attributes now, if it is possible to implement |
This is blocking our upgrade from .net 5 using Dahomey JSON polymorphism to .net 8 STJ. |
Description
I have the following class structure
Reproduction Steps
Deserializing following json doesn't work
while the following works
Mind that only difference is the capical A in
ActivityType
Expected behavior
Deserializes correctly without error
Actual behavior
Throws error
System.NotSupportedException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported
Regression?
No response
Known Workarounds
No response
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: