Export (0) Print
Expand All

Process.ErrorDataReceived Event

Occurs when an application writes to its redirected StandardError stream.

Namespace:  System.Diagnostics
Assembly:  System (in System.dll)

[<BrowsableAttribute(true)>]
member ErrorDataReceived : IEvent<DataReceivedEventHandler,
    DataReceivedEventArgs>

The ErrorDataReceived event indicates that the associated process has written to its redirected StandardError stream.

The event only occurs during asynchronous read operations on StandardError. To start asynchronous read operations, you must redirect the StandardError stream of a Process, add your event handler to the ErrorDataReceived event, and call BeginErrorReadLine. Thereafter, the ErrorDataReceived event signals each time the process writes a line to the redirected StandardError stream, until the process exits or calls CancelErrorRead.

NoteNote

The application that is processing the asynchronous output should call the WaitForExit() method to ensure that the output buffer has been flushed.

The following example uses the net view command to list the available network resources on a remote computer. The user supplies the target computer name as a command-line argument. The user can also supply a file name for error output. The example collects the output of the net command, waits for the process to finish, and then writes the output results to the console. If the user supplies the optional error file, the example writes errors to the file.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

  • LinkDemand 

    for full trust for the immediate caller. This member cannot be used by partially trusted code.

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft