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 default handling for value types when converter based on interface #42319

Merged
merged 5 commits into from
Sep 17, 2020

Conversation

steveharter
Copy link
Member

@steveharter steveharter commented Sep 16, 2020

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.

}

[Fact]
public static void JsonIgnoreCondition_WhenWritingDefault_OnBoxedPrimitive()
Copy link
Member Author

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()
Copy link
Member Author

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.

Copy link
Contributor

@layomia layomia left a 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).

@layomia layomia added this to the 5.0.0 milestone Sep 17, 2020
@steveharter
Copy link
Member Author

Runtime failure in mono unrelated:

##[error]Extraction failed for file: F:\workspace\_work\1\s\__download__\libraries_test_assets_Windows_NT_x64_Debug\libraries_test_assets_Windows_NT_x64_Debug.zip 
code: 2 

Publishing build artifacts failed with an error: Not found PathtoPublish: F:\workspace\_work\1\s\artifacts\log\Debug

@steveharter steveharter merged commit 710118d into dotnet:master Sep 17, 2020
@steveharter steveharter deleted the IgnoreNull branch September 17, 2020 14:58
layomia pushed a commit to layomia/dotnet_runtime that referenced this pull request Sep 17, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom struct not ignored during serialization when default
3 participants