Skip to content

DurableTaskContext Properties

Describes a running durable task and supplies its host's services.

AttemptCancellationToken

get
View source
public CancellationToken AttemptCancellationToken
Gets the token which is canceled when the host cancels this attempt: its grain activation is stopping, or the task was aborted or deleted. Pass it to the calls which durable cleanup makes after task cancellation.

CancellationToken

get
View source
public CancellationToken CancellationToken
Gets the token which is canceled when durable cancellation of the task is requested or the host cancels this attempt. Pass it to the calls which ordinary task code makes.

HostId

virtualget
View source
protected internal virtual string? HostId
Gets the identity of the host which runs this execution, such as its grain, which qualifies the root identifiers which the execution derives for the detached tasks it starts, or null for none.

Id

get
View source
public TaskId Id
Gets this execution's identifier.

Incarnation

abstractget
public abstract Guid Incarnation
Gets the nonce which identifies the run of the root task which this execution belongs to.

IsAttemptCanceled

get
View source
protected internal bool IsAttemptCanceled
Gets a value indicating whether this attempt was canceled, by the host or by a divergence of its replay.

IsReplaying

virtualget
View source
public virtual bool IsReplaying
Gets a value indicating whether this run of the task's body is re-running operations which an earlier run recorded. Use it for logging and diagnostics only.

TaskCancellationReason

get
View source
public string? TaskCancellationReason
Gets the reason which the durable cancellation request carries, or null when task cancellation hasn't been requested or its request carries no reason.

UtcNow

abstractget
public abstract DateTimeOffset UtcNow
Gets the host-provided logical UTC time for this execution.