Skip to content

Commit 70f67c4

Browse files
Copilotjeffhandley
andcommitted
Fix FileStream.FlushAsync documentation to clarify it doesn't flush to underlying device
Co-authored-by: jeffhandley <[email protected]>
1 parent 850cea1 commit 70f67c4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

xml/System.IO/FileStream.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2864,12 +2864,14 @@ Calling `DisposeAsync` allows the resources used by the <xref:System.IO.FileStre
28642864
</Parameters>
28652865
<Docs>
28662866
<param name="cancellationToken">The token to monitor for cancellation requests.</param>
2867-
<summary>Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.</summary>
2867+
<summary>Asynchronously clears all buffers for this stream, causes any buffered data to be written to the file, and monitors cancellation requests.</summary>
28682868
<returns>A task that represents the asynchronous flush operation.</returns>
28692869
<remarks>
28702870
<format type="text/markdown"><![CDATA[
28712871
28722872
## Remarks
2873+
This method flushes the .NET stream buffers to the file, but does not flush intermediate file buffers in the operating system. To ensure that all buffered data is written to the underlying storage device, use the <xref:System.IO.FileStream.Flush(System.Boolean)> method with the `flushToDisk` parameter set to `true`.
2874+
28732875
If the operation is canceled before it completes, the returned task contains the <xref:System.Threading.Tasks.TaskStatus.Canceled> value for the <xref:System.Threading.Tasks.Task.Status%2A> property. If the handle to the file is disposed, the returned task contains the <xref:System.ObjectDisposedException> exception in the <xref:System.Threading.Tasks.Task.Exception%2A> property.
28742876
28752877
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as <xref:System.ArgumentException>, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by <xref:System.IO.FileStream.Flush>.

0 commit comments

Comments
 (0)