-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
when async operation fails with ERROR_OPERATION_ABORTED, we should ignore numBytes that can be != 0 #57229
when async operation fails with ERROR_OPERATION_ABORTED, we should ignore numBytes that can be != 0 #57229
Conversation
…nore numBytes that can be != 0
Tagging subscribers to this area: @dotnet/area-system-io Issue DetailsIn #57212, I've validated that when async
fixes #56894
|
Hello @adamsitnik! Because this pull request has the 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 (
|
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.
LGTM. Just a small optional suggestion to add a comment.
// Cancellation | ||
CancellationToken ct = _cancellationRegistration.Token; | ||
_source.SetException(ct.IsCancellationRequested ? new OperationCanceledException(ct) : new OperationCanceledException()); | ||
break; | ||
|
||
default: | ||
// Failure | ||
strategy?.OnIncompleteOperation(_bufferSize, 0); |
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.
Do we care to add a comment here explaining why 0 for the default case?
In #57212, I've validated that when async
WriteFile
operation fails withERROR_OPERATION_ABORTED
, the reported number of transferred bytes can be different than zero. Moreover, its value can be bigger than the number of bytes that we have requested to transfer when the operation was started, so we can assume that this value is always invalid in such case and just use zero instead.fixes #56894