Skip to content

System.Diagnostics.Process docs do not refer to async StreamReader APIs #4592

Open
@ohadschn

Description

@ohadschn

This issue is spread around a few sections, for example Process.StandardOutput:

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).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions