Closed SteveDunn closed 6 months ago
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).
Fixed in 4.0.5
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. HoweverJsonNumberHandling
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