# TestCluster.WaitForDeactivationAsync(GrainId)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/TestCluster.cs#L215-L220)

```csharp
public Task WaitForDeactivationAsync(GrainId grainId)
```

Gets a `System.Threading.Tasks.Task` that completes when the current activation of the specified grain finishes deactivating. If the grain is not currently activated, returns `System.Threading.Tasks.Task.CompletedTask`.

### Parameters

- `grainId` (`GrainId`): The ID of the grain to observe.

### Returns

A task that completes when the grain's current activation has deactivated.

### Examples

```csharp
var deactivated = cluster.WaitForDeactivationAsync(grain.GetGrainId());
            await grain.DoDeactivate();
            await deactivated;
```
