Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

AsyncTaskMethodBuilder(TResult).SetException Method

.NET Framework 4.6 and 4.5

Marks the task as failed and binds the specified exception to the task.

Namespace:  System.Runtime.CompilerServices
Assemblies:   mscorlib (in mscorlib.dll)
  System.Threading.Tasks (in System.Threading.Tasks.dll)

member SetException : 
        exception:Exception -> unit

Parameters

exception
Type: System.Exception

The exception to bind to the task.

ExceptionCondition
ArgumentNullException

exception is a null reference (Nothing in Visual Basic).

InvalidOperationException

The task has already completed.

This type and its members are intended for use by the compiler.

.NET Framework

Supported in: 4.6, 4.5

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Show:
© 2015 Microsoft