AsyncTaskMethodBuilder.SetException(Exception) 方法

定义

标记此任务为失败并将指定的异常绑定到此任务。Marks the task as failed and binds the specified exception to the task.

public:
 void SetException(Exception ^ exception);
public void SetException (Exception exception);
member this.SetException : Exception -> unit
Public Sub SetException (exception As Exception)

参数

exception
Exception

要绑定到该任务的异常。The exception to bind to the task.

例外

exceptionnullexception is null.

任务已完成。The task has already completed.

- 或 --or-

未初始化该生成器。The builder is not initialized.

注解

此类型及其成员旨在供编译器使用。This type and its members are intended for use by the compiler.

适用于