Uh oh!
There was an error while loading. Please reload this page.
Handle incomplete writes - #55474
Conversation
ghost
commented
Jul 11, 2021
Tagging subscribers to this area: @dotnet/area-system-io Issue DetailsThis is a short term solution for #55473. It solves the problem, but only for I can't provide a better solution right now because I am on vacations. I'll be back in a week, then I can provide a long-term fix.
|
| Span<byte> buffer = bytes; | ||
| do | ||
| { | ||
| int bytesWritten = RandomAccess.WriteAtOffset(sfh, buffer, offset); |
There was a problem hiding this comment.
Should this somehow handle !buffer.IsEmpty && bytesWritten == 0 to prevent infinite loop? (Logically, it would make more sense to me as a while loop instead of do-while loop).
| #pragma warning restore CA2012 | ||
| private ValueTask<int> WriteAsyncCore(ReadOnlyMemory<byte> source, CancellationToken cancellationToken) | ||
| public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken) |
There was a problem hiding this comment.
| publicoverrideValueTaskWriteAsync(ReadOnlyMemory<byte>source,CancellationTokencancellationToken) | |
| publicoverrideasyncValueTaskWriteAsync(ReadOnlyMemory<byte>source,CancellationTokencancellationToken) |
stephentoub
commented
Jul 12, 2021
Thanks. #55490 provides the longer-term fix. |
This is a short term solution for #55473. It solves the problem, but only for
FileStreamand it's introducing a performance regression (allocations).I can't provide a better solution right now because I am on vacations. I'll be back in a week, then I can provide a long-term fix.