Skip to content

Commit c5eea03

Browse files
authored
Fix FileStream.FlushAsync documentation to correctly describe its behavior (#11471)
1 parent 28e189e commit c5eea03

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

xml/System.IO/FileStream.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2864,12 +2864,15 @@ 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+
2874+
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`.
2875+
28732876
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.
28742877
28752878
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)