-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add ReadAtLeastAsync implementation for StreamPipeReader #52246
Add ReadAtLeastAsync implementation for StreamPipeReader #52246
Conversation
src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeReaderOptions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeReader.cs
Outdated
Show resolved
Hide resolved
@manandre This conflicts with your other PR can you resolve those. |
src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeReader.cs
Outdated
Show resolved
Hide resolved
cbe195e
to
2126bd8
Compare
src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeReader.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Pipelines/tests/StreamPipeReaderTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeReader.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Pipelines/tests/PipeReaderReadAtLeastAsyncTests.cs
Show resolved
Hide resolved
The |
@ViktorHofer Can you help with the .NET 4.8 issue? |
The pipeline is called |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Infra changes LGTM
@manandre Thanks for the contribution! |
// TODO ReadyAsync needs to throw if there are overlapping reads. | ||
ThrowIfCompleted(); | ||
|
||
cancellationToken.ThrowIfCancellationRequested(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should really be:
if (cancellationToken.IsCancellationRequested)
{
return ValueTask.FromCanceled<ReadResult>(cancellationToken);
}
or to be able to target downlevel as well:
if (cancellationToken.IsCancellationRequested)
{
return new ValueTask<ReadResult>(Task.FromCanceled<ReadResult>(cancellationToken));
}
Otherwise, this is going to propagate the OperationCanceledException synchronously out of the ReadAtLeastAsync call, when we generally prefer to propagate it as part of the returned task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manandre would you like to take this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
Fix proposal available in PR #53306
Closes #52150
/cc @davidfowl