-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 default handling for value types when converter based on interface #42319
Conversation
} | ||
|
||
[Fact] | ||
public static void JsonIgnoreCondition_WhenWritingDefault_OnBoxedPrimitive() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was passing before, just added the test.
} | ||
|
||
[Fact] | ||
public static void JsonIgnoreCondition_WhenWritingDefault_OnRootTypes() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was passing before, just added the test.
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/GenericMethodHolder.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonPropertyInfoOfT.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonPropertyInfoOfT.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonPropertyInfoOfT.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/Serialization/PropertyVisibilityTests.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/Serialization/PropertyVisibilityTests.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/Serialization/PropertyVisibilityTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/Serialization/PropertyVisibilityTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Would like to present to ship-room for .NET 5 consideration (incomplete scenario for ignoring default values feature new in 5.0).
Runtime failure in mono unrelated:
|
Fixes #42237
When a custom converter is based on an interface and a corresponding property is based on a value type that implements the interface, default handling was not working. This PR fixes that.
Some local benchmarks showed no regression for the happy path that doesn't hit this edge case.