System.Diagnostics.Process.ErrorDataReceived Event

Occurs when an application writes to its redirected Process.StandardError stream.


[System.Diagnostics.MonitoringDescription("Raised when it receives error data")]
public event DataReceivedEventHandler ErrorDataReceived


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

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


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


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