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

Add JSON null support for the built-in (ReadOnly)Memory converters. #95275

Merged
merged 2 commits into from
Nov 28, 2023

Conversation

eiriktsarpalis
Copy link
Member

Fix #95267.

@ghost
Copy link

ghost commented Nov 27, 2023

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

Fix #95267.

Author: eiriktsarpalis
Assignees: -
Labels:

area-System.Text.Json

Milestone: -

@eiriktsarpalis eiriktsarpalis added this to the 9.0.0 milestone Nov 27, 2023
Converter = converter;
ConverterStrategy = converter.ConverterStrategy;
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 change adds some wiring that was being dropped so far.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was about to ask :) Does that mean there's another bug that was lurking and this was fixing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, it was surfaced with the newly added tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context this is a converter wrapper type that is being used by the source generator APIs. The logic I just added was copied from a similar wrapper type being used internally:

_sourceConverter = sourceConverter;
IsInternalConverter = sourceConverter.IsInternalConverter;
IsInternalConverterForNumberType = sourceConverter.IsInternalConverterForNumberType;
ConverterStrategy = sourceConverter.ConverterStrategy;
CanBePolymorphic = sourceConverter.CanBePolymorphic;
// Ensure HandleNull values reflect the exact configuration of the source converter
HandleNullOnRead = sourceConverter.HandleNullOnRead;
HandleNullOnWrite = sourceConverter.HandleNullOnWrite;
HandleNull = sourceConverter.HandleNullOnWrite;

@jozkee
Copy link
Member

jozkee commented Nov 27, 2023

Should this be backported to 8.0.x?

@eiriktsarpalis
Copy link
Member Author

/backport to release/8.0-staging

Copy link
Contributor

Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/7019012556

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.

JsonConverter for {ReadOnly}Memory doesn't deserialize nulls
4 participants