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 for null string values #390

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

RehanSaeed
Copy link
Owner

@RehanSaeed RehanSaeed added bug Issues describing a bug or pull requests fixing a bug. patch Pull requests requiring a patch version update according to semantic versioning. labels Feb 9, 2022
@Turnerj
Copy link
Collaborator

Turnerj commented Feb 10, 2022

Looks like our issue is this block of code in S.T.J: https://source.dot.net/#System.Text.Json/System/Text/Json/Serialization/Metadata/JsonPropertyInfoOfT.cs,353

There are a couple of flags around there that we might be able to toggle to get this to behave correctly.

@Turnerj
Copy link
Collaborator

Turnerj commented Feb 10, 2022

I should mention - that the block of code I linked to is likely based on the master/main code in the Runtime, not necessarily what we are using. We don't have individual control of HandleNullOnRead currently, just a HandleNull property which does read and write. (Edit: HandleNullOnRead is internal)

I imagine (though haven't confirmed) is that if we enable HandleNull, it might mean that null/default values are going to be serialized again.

@Turnerj
Copy link
Collaborator

Turnerj commented Feb 10, 2022

Setting HandleNull does make our converter run however another internal part of S.T.J trips:
image

I'm thinking that S.T.J is doing this because a struct can't technically be null instead of setting the struct to its default value.

@Turnerj
Copy link
Collaborator

Turnerj commented Feb 10, 2022

Tried to mess around with a few settings but doesn't seem like there is anything we can do without trying something drastic like switching Values and OneOrMany to be reference types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues describing a bug or pull requests fixing a bug. patch Pull requests requiring a patch version update according to semantic versioning.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants