# InProcessTestCluster.WaitForDeactivationAsync(GrainId)

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

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/InProcTestCluster.cs#L165-L170)

```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;
```
