-
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
Add JSON null support for the built-in (ReadOnly)Memory converters. #95275
Add JSON null support for the built-in (ReadOnly)Memory converters. #95275
Conversation
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsFix #95267.
|
...System.Text.Json/src/System/Text/Json/Serialization/Converters/Collection/MemoryConverter.cs
Outdated
Show resolved
Hide resolved
...ext.Json/src/System/Text/Json/Serialization/Converters/Collection/ReadOnlyMemoryConverter.cs
Outdated
Show resolved
Hide resolved
Converter = converter; | ||
ConverterStrategy = converter.ConverterStrategy; |
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 change adds some wiring that was being dropped so far.
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.
I was about to ask :) Does that mean there's another bug that was lurking and this was fixing?
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.
Correct, it was surfaced with the newly added tests.
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.
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:
Lines 27 to 36 in acf7c85
_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; |
...ext.Json/src/System/Text/Json/Serialization/Converters/Collection/ReadOnlyMemoryConverter.cs
Show resolved
Hide resolved
Should this be backported to 8.0.x? |
/backport to release/8.0-staging |
Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/7019012556 |
Fix #95267.