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

Commit Utf8JsonWriter contents to buffer before writing directly to b… #2985

Merged
merged 3 commits into from
Jun 3, 2024

Conversation

ElizabethOkerio
Copy link
Contributor

@ElizabethOkerio ElizabethOkerio commented May 30, 2024

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)

  • 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.

@ElizabethOkerio ElizabethOkerio force-pushed the fix/async_streaming_bugs branch 3 times, most recently from d0366b3 to 42e13a2 Compare May 31, 2024 06:46
@ElizabethOkerio ElizabethOkerio force-pushed the fix/async_streaming_bugs branch from d9538db to b9ed641 Compare June 3, 2024 03:44
habbes
habbes previously approved these changes Jun 3, 2024
@ElizabethOkerio ElizabethOkerio merged commit 711f621 into main Jun 3, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants