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

Fixed issue that closed stream when using StreamWriter in SyntaxPrinter.PrintToAsync #7657

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

glen-84
Copy link
Collaborator

@glen-84 glen-84 commented Oct 29, 2024

Summary of the changes (Less than 80 chars)

  • Leave stream open when using StreamWriter in SyntaxPrinter#PrintToAsync.

Closes #7631


📓 Notes:

  • When FileSystemOperationDocumentStorage#SaveInternalAsync is called with a document that is an instance of OperationDocument, WriteToAsync calls PrintToAsync, which uses a StreamWriter that disposes the stream. The stream is then accessed again in order to flush it, which throws.
  • The stream should be disposed by the caller, so I've set leaveOpen to true.

❓ Questions:

  • Is there a simpler way to create the OperationRequest in the test?

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.77%. Comparing base (6c9d385) to head (914c439).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7657      +/-   ##
==========================================
+ Coverage   73.75%   73.77%   +0.02%     
==========================================
  Files        2922     2922              
  Lines      150896   150895       -1     
  Branches    17550    17549       -1     
==========================================
+ Hits       111294   111327      +33     
+ Misses      33781    33748      -33     
+ Partials     5821     5820       -1     
Flag Coverage Δ
unittests 73.77% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@michaelstaib michaelstaib changed the title Leave stream open when using StreamWriter in SyntaxPrinter#PrintToAsync Fixed issue that closed stream when using StreamWriter in SyntaxPrinter.PrintToAsync Oct 30, 2024
@michaelstaib michaelstaib merged commit 9e86b1b into main Oct 30, 2024
103 checks passed
@michaelstaib michaelstaib deleted the gai/issue-7631 branch October 30, 2024 09:41
michaelstaib pushed a commit that referenced this pull request Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FileSystemOperationDocumentStorage fails at SaveInternalAsync when persisting query
2 participants