# DurableTaskAttemptCanceledException Constructors

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

## DurableTaskAttemptCanceledException {#constructor-849d65f5}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskattemptcanceledexception/constructors/constructor-849d65f5/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskAttemptCanceledException.cs#L61-L63)

```csharp
public DurableTaskAttemptCanceledException()
```

Initializes an exception for an attempt canceled because its activation is stopping.

## DurableTaskAttemptCanceledException(DurableTaskAttemptCancellationReason, CancellationToken, Exception?) {#constructor-orleans-durable-tasks-durabletaskattemptcancellationreason-system-th-8d7ffb11}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskattemptcanceledexception/constructors/constructor-orleans-durable-tasks-durabletaskattemptcancellationreason-system-th-8d7ffb11/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskAttemptCanceledException.cs#L88-L90)

```csharp
public DurableTaskAttemptCanceledException(DurableTaskAttemptCancellationReason reason, CancellationToken token, Exception? innerException = null)
```

Initializes an exception for an attempt canceled for `reason`, with a message which describes it.

### Parameters

- `reason` (`DurableTaskAttemptCancellationReason`): Why the host canceled the attempt.
- `token` (`CancellationToken`): The attempt's cancellation token.
- `innerException` (`Exception?`): The exception which the canceled operation threw, if any.

## DurableTaskAttemptCanceledException(string?) {#constructor-string-nullable-b440cbaa}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskattemptcanceledexception/constructors/constructor-string-nullable-b440cbaa/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskAttemptCanceledException.cs#L68-L70)

```csharp
public DurableTaskAttemptCanceledException(string? message)
```

Initializes an exception with `message`, for an attempt canceled because its activation is stopping.

### Parameters

- `message` (`string?`): The message which describes the cancellation.

## DurableTaskAttemptCanceledException(string?, Exception?) {#constructor-string-nullable-system-exception-nullable-7d587e6d}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskattemptcanceledexception/constructors/constructor-string-nullable-system-exception-nullable-7d587e6d/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskAttemptCanceledException.cs#L76-L78)

```csharp
public DurableTaskAttemptCanceledException(string? message, Exception? innerException)
```

Initializes an exception with `message`, for an attempt canceled because its activation is stopping.

### Parameters

- `message` (`string?`): The message which describes the cancellation.
- `innerException` (`Exception?`): The exception which the canceled operation threw.

## DurableTaskAttemptCanceledException(string?, Exception?, DurableTaskAttemptCancellationReason, CancellationToken) {#constructor-string-nullable-system-exception-nullable-orleans-durable-tasks-dura-c579f7ee}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durable.abstractions/orleans.durable.tasks.durabletaskattemptcanceledexception/constructors/constructor-string-nullable-system-exception-nullable-orleans-durable-tasks-dura-c579f7ee/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Durable.Abstractions/DurableTaskAttemptCanceledException.cs#L102-L105)

```csharp
public DurableTaskAttemptCanceledException(string? message, Exception? innerException, DurableTaskAttemptCancellationReason reason, CancellationToken token)
```

Initializes an exception for an attempt canceled for `reason`.

### Parameters

- `message` (`string?`): The message which describes the cancellation.
- `innerException` (`Exception?`): The exception which the canceled operation threw.
- `reason` (`DurableTaskAttemptCancellationReason`): Why the host canceled the attempt.
- `token` (`CancellationToken`): The attempt's cancellation token.
