Skip to content

DurableTaskAttemptCanceledException

class

Namespace: Orleans.Durable.Tasks

The exception which every durable operation of a canceled attempt throws, so the attempt's code unwinds and releases its in-process resources.
[Orleans.Alias(Orleans.Durable.Tasks.DurableTaskAttemptCanceledException)]
public sealed class DurableTaskAttemptCanceledException : OperationCanceledException

Remarks

An attempt is one in-memory run of a task's body. A host cancels the attempt, rather than the task, when the attempt's work can't be recorded any more: its grain activation is stopping, the task was aborted or deleted, or the running code can't replay the task's recorded execution, because it doesn't support a recorded version or diverged from the record. From then on, the attempt's durable operations, such as DurableTask, starting or awaiting tasks, signals, delays, and combinators, throw this exception, and the host discards the attempt's response: a stopping activation's task replays in a new attempt, and an aborted or deleted task already has its outcome. Changes which the attempt's code makes to the grain's journaled state, such as cleanup, commit with the grain's next journal write.

DurableTaskContext and DurableTaskContext are canceled together with the attempt. DurableTaskContext reports only durable task cancellation, so a catch block filtered on it runs durable cleanup only for task cancellation. Release in-process resources, such as semaphores and disposables, in finally blocks and using statements, which run for both.

Constructors

Properties

  • ReasonGets why the host canceled the attempt.