System.Diagnostics.Process.HasExited Property

Gets a value indicating whether the associated process has been terminated.

Syntax

[System.ComponentModel.Browsable(false)]
[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
[System.Diagnostics.MonitoringDescription("Determines if the process is still running.")]
public bool HasExited { get; }

Value

Documentation for this section has not yet been entered.

Remarks

A value of true for Process.HasExited indicates that the associated process has terminated, either normally or abnormally. You can request or force the associated process to exit by calling Process.CloseMainWindow or Process.Kill. If a handle is open to the process, the operating system releases the process memory when the process has exited, but retains administrative information about the process, such as the handle, exit code, and exit time. To get this information, you can use the Process.ExitCode and Process.ExitTime properties. These properties are populated automatically for processes that were started by this component. The administrative information is released when all the System.Diagnostics.Process components that are associated with the system process are destroyed and hold no more handles to the exited process.

A process can terminate independently of your code. If you started the process using this component, the system updates the value of Process.HasExited automatically, even if the associated process exits independently.

Note:

When standard output has been redirected to asynchronous event handlers, it is possible that output processing will not have completed when this property returns true. To ensure that asynchronous event handling has been completed, call the Process.WaitForExit overload that takes no parameter before checking Process.HasExited.

Requirements

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