FileStream.Flush(flushToDisk: true) call does not flush the buffers to disk - by iquazee

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 634385 Comments
Status Closed Workarounds
Type Bug Repros 3
Opened 1/3/2011 5:09:28 AM
Access Restriction Public


.NET Framework 4.0 introduced the new FileStream.Flush(bool flushToDisk) overload.
If flushToDisk is set to true, it should commit the changes to disk.

However, in many cases (if internal buffer pointer is 0) the changes are not committed to disk, and the Flush(true) call does absolutely nothing.

If applications rely on FileStream.Flush(true) working as described, it could lead to data corruption issues.
Sign in to post a comment.
Posted by AaronLie on 9/19/2012 at 12:03 PM
I want to confirm that this bug is indeed fixed. I'm not sure when it was fixed but the referenced program is working as expected in .NET 4.5.
Posted by Jim Fr on 7/2/2012 at 6:16 PM
This bug is marked as Closed/fixed. When it about to release, can you please update this to tell us version, SP or hotfix it is fixed in?
Posted by Microsoft on 1/7/2011 at 11:31 AM
Hi iquazee,

Thanks for reporting this issue. I'm happy to let you know that we're going to fix it in a future release of the .NET Framework.

Software Design Engineer
Base Class Libraries
Posted by Microsoft on 1/3/2011 at 5:52 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Posted by Microsoft on 1/3/2011 at 5:22 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(