OperationCanceledException Class

Definition

The exception that is thrown in a thread upon cancellation of an operation that the thread was executing.

[System.Runtime.InteropServices.ComVisible(true)]
public class OperationCanceledException : SystemException
Inheritance
OperationCanceledException
Derived
Attributes

Inherited Members

System.Exception

System.Object

Remarks

If the task that was canceled had an associated cancellation token, it is returned by the CancellationToken property, and the CancellationToken.IsCancellationRequested property of the token is set to true.

Constructors

OperationCanceledException()

Initializes a new instance of the OperationCanceledException class with a system-supplied error message.

OperationCanceledException(String)

Initializes a new instance of the OperationCanceledException class with a specified error message.

OperationCanceledException(CancellationToken)

Initializes a new instance of the OperationCanceledException class with a cancellation token.

OperationCanceledException(SerializationInfo, StreamingContext)

Initializes a new instance of the OperationCanceledException class with serialized data.

OperationCanceledException(String, Exception)

Initializes a new instance of the OperationCanceledException class with a specified error message and a reference to the inner exception that is the cause of this exception.

OperationCanceledException(String, CancellationToken)

Initializes a new instance of the OperationCanceledException class with a specified error message and a cancellation token.

OperationCanceledException(String, Exception, CancellationToken)

Initializes a new instance of the OperationCanceledException class with a specified error message, a reference to the inner exception that is the cause of this exception, and a cancellation token.

Properties

CancellationToken

Gets a token associated with the operation that was canceled.