Delen via


Pipeline.InvokeAsync Method

Definition

Invoke the pipeline asynchronously.

public:
 abstract void InvokeAsync();
public:
 abstract void InvokeAsync();
 abstract void InvokeAsync();
public abstract void InvokeAsync ();
abstract member InvokeAsync : unit -> unit
Public MustOverride Sub InvokeAsync ()

Exceptions

  1. A pipeline is already executing. Pipeline cannot execute concurrently.
  2. InvokeAsync is called on nested pipeline. Nested pipeline cannot be executed Asynchronously.

PipelineState is not NotStarted.

RunspaceState is not Open

Pipeline already disposed

Remarks

1) Results are returned through the Output reader. 2) When pipeline is invoked using InvokeAsync, invocation doesn't finish until Input to pipeline is closed. Caller of InvokeAsync must close the input pipe after all input has been written to input pipe. Input pipe is closed by calling Pipeline.Input.Close();

If you want this pipeline to execute as a standalone command (that is, using command-line parameters only), be sure to call Pipeline.Input.Close() before calling InvokeAsync(). Otherwise, the command will be executed as though it had external input. If you observe that the command isn't doing anything, this may be the reason.

Applies to