dotnet / dotnet/dotnet-api-docs
System.Diagnostics.Process docs do not refer to async StreamReader APIs
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
This issue is spread around a few sections, for example [Process.StandardOutput](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.process.standardoutput?view=netcore-3.1):
> The redirected `StandardOutput` stream can be read synchronously or asynchronously. Methods such as `Read`, `ReadLine`, and `ReadToEnd` perform synchronous read operations on the output stream of the process. These synchronous read operations do not complete until the associated `Process` writes to its `StandardOutput` stream, or closes the stream.
>
> In contrast, `BeginOutputReadLine` starts asynchronous read operations on the `StandardOutput` stream. This method enables a designated event handler for the stream output and immediately returns to the caller, which can perform other work while the stream output is directed to the event handler.
The description makes it sound like sync = `Read`/`ReadLine` and async = `BeginOutputReadLine`/`OutputDataReceived` where in fact the recommended async approach would surely be the task-based `System.IO.StreamReader.ReadXAsync` (invoked on the supposedly "sync" `StandardOutput`).
Contributor guide
Assessment
This issue has not been assessed yet.