# DurableTaskContext Properties

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/)

## AttemptCancellationReason {#attemptcancellationreason-a251d9d4}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/properties/attemptcancellationreason-a251d9d4/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskContext.cs#L243)

```csharp
protected internal DurableTaskAttemptCancellationReason? AttemptCancellationReason
```

Gets why this attempt was canceled, or `null` while it runs.

## AttemptCancellationToken {#attemptcancellationtoken-0bf454e2}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/properties/attemptcancellationtoken-0bf454e2/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskContext.cs#L231)

```csharp
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 {#cancellationtoken-c8a6695b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/properties/cancellationtoken-c8a6695b/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskContext.cs#L212)

```csharp
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 {#hostid-f09488f9}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/properties/hostid-f09488f9/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskContext.cs#L649)

```csharp
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 {#id-44043fd0}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/properties/id-44043fd0/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskContext.cs#L92)

```csharp
public TaskId Id
```

Gets this execution's identifier.

## Incarnation {#incarnation-51a76cbe}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/properties/incarnation-51a76cbe/)

```csharp
public abstract Guid Incarnation
```

Gets the nonce which identifies the run of the root task which this execution belongs to.

## IsAttemptCanceled {#isattemptcanceled-e00b1357}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/properties/isattemptcanceled-e00b1357/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskContext.cs#L240)

```csharp
protected internal bool IsAttemptCanceled
```

Gets a value indicating whether this attempt was canceled, by the host or by a divergence of its replay.

## IsReplaying {#isreplaying-f12c1531}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/properties/isreplaying-f12c1531/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskContext.cs#L136)

```csharp
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.

## IsTaskCancellationRequested {#istaskcancellationrequested-8e932079}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/properties/istaskcancellationrequested-8e932079/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskContext.cs#L147)

```csharp
public bool IsTaskCancellationRequested
```

Gets a value indicating whether durable cancellation of the task has been requested.

## SchedulesShieldedChildren {#schedulesshieldedchildren-b93a4c1c}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/properties/schedulesshieldedchildren-b93a4c1c/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskContext.cs#L178)

```csharp
protected internal bool SchedulesShieldedChildren
```

Gets whether the calling code runs within a [DurableTaskExtensions](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskextensions/) start of this execution, so that a child which it schedules isn't reached by this execution's durable cancellation.

## TaskCancellationReason {#taskcancellationreason-6e919509}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/properties/taskcancellationreason-6e919509/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskContext.cs#L160)

```csharp
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 {#utcnow-483b97a3}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskcontext/properties/utcnow-483b97a3/)

```csharp
public abstract DateTimeOffset UtcNow
```

Gets the host-provided logical UTC time for this execution.
