This PR fixes a bug in the ODataUtf8JsonWriter's StartStreamValueScopeAsync where the contents of the utf8jsonwriter are not committed to the buffer before writing stream content to the buffer directly. This leads to content previously written by the utf8jsonwriter being overwritten which leads to corrupt data. Committing utf8jsonwriter's content to buffer before streaming data to the buffer directly fixes this issue.
The PR also has logic to add support for float.PositiveInfinity ( -> "INF"), float.NegativityInfinity (-> "-INF") and float.NaN(->"NaN") to ODataUtf8JsonWriter. Support was already there for double, but not float(an exception would be thrown whenUtf8JsonWritertries to writefloat.NaN` for example)
The ODataUtf8JsonWriter.TextWriter did not override Write(char), This PR has changes to override both TextWriter.Write(char) and TextWriter.WriteAsync(char).
Checklist (Uncheck if it is not completed)
[ ] Test cases added
[ ] Build and test with one-click build and test script passed
Additional work necessary
If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.
Issues
This pull request fixes #xxx.
Description
This PR fixes a bug in the ODataUtf8JsonWriter's
StartStreamValueScopeAsync
where the contents of the utf8jsonwriter are not committed to the buffer before writing stream content to the buffer directly. This leads to content previously written by the utf8jsonwriter being overwritten which leads to corrupt data. Committing utf8jsonwriter's content to buffer before streaming data to the buffer directly fixes this issue.The PR also has logic to add support for float.PositiveInfinity ( -> "INF"), float.NegativityInfinity (-> "-INF") and float.NaN(->"NaN") to ODataUtf8JsonWriter. Support was already there for double, but not float(an exception would be thrown whenUtf8JsonWritertries to writefloat.NaN` for example)
The ODataUtf8JsonWriter.TextWriter did not override Write(char), This PR has changes to override both TextWriter.Write(char) and TextWriter.WriteAsync(char).
Checklist (Uncheck if it is not completed)
Additional work necessary
If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.