PipeWriter.CompleteAsync(Exception) Method

Definition

Marks the current pipe writer instance as being complete, meaning no more data will be written to it.

public virtual System.Threading.Tasks.ValueTask CompleteAsync (Exception exception = default);
public virtual System.Threading.Tasks.ValueTask CompleteAsync (Exception? exception = default);
abstract member CompleteAsync : Exception -> System.Threading.Tasks.ValueTask
override this.CompleteAsync : Exception -> System.Threading.Tasks.ValueTask
Public Overridable Function CompleteAsync (Optional exception As Exception = Nothing) As ValueTask

Parameters

exception
Exception

An optional exception that indicates the failure that caused the pipeline to complete.

Returns

A value task that represents the asynchronous complete operation.

Remarks

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Complete(Exception).

Applies to