Skip to content

Conversation

@davidfowl
Copy link
Member

  • Take the segment index into account when copying buffered data. This handles the case where ReadAsync has consumed a partial segment and then the same PipeReader instance is used to copy to a Stream and PipeWriter.
  • Added tests

Fixes #57806

- Take the segment index into account when copying buffered data. This handles the case where ReadAsync has consumed a partial segment and then the same PipeReader instance is used to copy to a Stream and PipeWriter.
- Added tests
@davidfowl davidfowl requested review from BrennanConroy, halter73 and stephentoub and removed request for BrennanConroy August 23, 2021 15:42
[Fact]
public async Task CopyToAsyncStreamCopiesRemainderAfterReadingSome()
{
var buffer = Encoding.UTF8.GetBytes("Hello World");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally I'd comment on changing var => byte[], but it appears this file is already filled with such usage, so I won't say anything 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆 habit

@ghost
Copy link

ghost commented Aug 23, 2021

Hello @davidfowl!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 331cfe3 into main Aug 23, 2021
@ghost ghost deleted the davidfowl/fix-copy-to-async branch August 23, 2021 18:47
@davidfowl
Copy link
Member Author

/backport to release/6.0

@github-actions
Copy link
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1159922915

@davidfowl
Copy link
Member Author

/backport to release/6.0-rc1

@github-actions
Copy link
Contributor

Started backporting to release/6.0-rc1: https://github.com/dotnet/runtime/actions/runs/1159956239

@ghost ghost locked as resolved and limited conversation to collaborators Sep 22, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in StreamPipeReader.CopyToAsync() causes part of already consumed content to be copied again

3 participants