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

Bug in System.Text.Json number handling #595

Closed
SteveDunn opened this issue May 15, 2024 · 2 comments
Closed

Bug in System.Text.Json number handling #595

SteveDunn opened this issue May 15, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@SteveDunn
Copy link
Owner

SteveDunn commented May 15, 2024

The generated code for reading a value uses
options.NumberHandling == global::System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString
to check if reading from strings is enabled. However JsonNumberHandling is a [Flags] enum and therefore this fails if multiple options are set (e.g. NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString).

This was originally raised by @MGRatEJOT

@SteveDunn SteveDunn self-assigned this May 15, 2024
@SteveDunn SteveDunn added the bug Something isn't working label May 15, 2024
@SteveDunn
Copy link
Owner Author

SteveDunn commented May 15, 2024

I don't that fixing this will be a breaking change because there should be nothing out there serialized as a string and hence failing the incorrect reading logic (the reading logic currently says 'if it is exactly 'allow reading from string' and the token is a string).

@SteveDunn
Copy link
Owner Author

Fixed in 4.0.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant