-
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
Buffered file stream doesn't flush data right #77373
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
This belongs to area-System.IO |
Tagging subscribers to this area: @dotnet/area-system-io Issue DetailsDescriptionIn BufferedFileStreamStrategy.cs, the Flush(bool flushToDisk) method does not perform flushing to disk when flushToDisk == true and there is data in the read or write buffer. I.e., both conditional blocks marked as "// Has write data ..." and "// Has read data ... " return without calling the underlying strategy's flush(flushToDisk). Reproduction StepsNo simple reproduction is available but the problem is obvious from the method itself. Expected behaviorThe underlying strategy's flush(flushToDisk) must be called in all cases. Actual behaviorAs described above. Regression?No response Known WorkaroundsSetting the buffer size to 0 causes no buffering and correct flushing. But this is not really a workaround since it requires disabling of buffering. Configuration.NET 6. Other informationNo response
|
Hi @emayevski Big thanks for a detailed bug report! I've sent a fix: #77384
Another workaround is to call this this method twice (I know it's dirty). |
Thank you! The workaround is good too :). |
Description
In BufferedFileStreamStrategy.cs, the Flush(bool flushToDisk) method does not perform flushing to disk when flushToDisk == true and there is data in the read or write buffer. I.e., both conditional blocks marked as "// Has write data ..." and "// Has read data ... " return without calling the underlying strategy's flush(flushToDisk).
Reproduction Steps
No simple reproduction is available but the problem is obvious from the method itself.
Expected behavior
The underlying strategy's flush(flushToDisk) must be called in all cases.
Actual behavior
As described above.
Regression?
No response
Known Workarounds
Setting the buffer size to 0 causes no buffering and correct flushing. But this is not really a workaround since it requires disabling of buffering.
Configuration
.NET 6.
Other information
No response
The text was updated successfully, but these errors were encountered: