From 850cea188a94c2ef610330998b20375fa7a0a0a8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 05:32:45 +0000 Subject: [PATCH 1/4] Initial plan for issue From 70f67c43f3e07e0ca0a1e34aabaab986a7e053f1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Jun 2025 05:37:52 +0000 Subject: [PATCH 2/4] Fix FileStream.FlushAsync documentation to clarify it doesn't flush to underlying device Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com> --- xml/System.IO/FileStream.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xml/System.IO/FileStream.xml b/xml/System.IO/FileStream.xml index ddf9d0ce089..d8059ca106e 100644 --- a/xml/System.IO/FileStream.xml +++ b/xml/System.IO/FileStream.xml @@ -2864,12 +2864,14 @@ Calling `DisposeAsync` allows the resources used by the The token to monitor for cancellation requests. - Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests. + Asynchronously clears all buffers for this stream, causes any buffered data to be written to the file, and monitors cancellation requests. A task that represents the asynchronous flush operation. method with the `flushToDisk` parameter set to `true`. + If the operation is canceled before it completes, the returned task contains the value for the property. If the handle to the file is disposed, the returned task contains the exception in the property. 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 , are still thrown synchronously. For the stored exceptions, see the exceptions thrown by . From e9e6b8f9d6950be9c64a141b6459a05bffceb7a1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 30 Jun 2025 13:41:45 +0000 Subject: [PATCH 3/4] Fix xref encoding for FileStream.Flush method reference Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com> --- xml/System.IO/FileStream.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml/System.IO/FileStream.xml b/xml/System.IO/FileStream.xml index d8059ca106e..241b7274779 100644 --- a/xml/System.IO/FileStream.xml +++ b/xml/System.IO/FileStream.xml @@ -2870,7 +2870,7 @@ Calling `DisposeAsync` allows the resources used by the method with the `flushToDisk` parameter set to `true`. + 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 method with the `flushToDisk` parameter set to `true`. If the operation is canceled before it completes, the returned task contains the value for the property. If the handle to the file is disposed, the returned task contains the exception in the property. From 95ec01c8b4b5f3a5f13f66bc7feaa8aeca296b23 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Mon, 30 Jun 2025 16:07:46 +0200 Subject: [PATCH 4/4] Update FileStream.xml --- xml/System.IO/FileStream.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xml/System.IO/FileStream.xml b/xml/System.IO/FileStream.xml index 241b7274779..509ef897f76 100644 --- a/xml/System.IO/FileStream.xml +++ b/xml/System.IO/FileStream.xml @@ -2870,7 +2870,8 @@ Calling `DisposeAsync` allows the resources used by the method with the `flushToDisk` parameter set to `true`. + +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 method with the `flushToDisk` parameter set to `true`. If the operation is canceled before it completes, the returned task contains the value for the property. If the handle to the file is disposed, the returned task contains the exception in the property.