# TestCluster.MigrateAsync(IAddressable, SiloAddress?)

[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#L279)

```csharp
public Task MigrateAsync(IAddressable grain, SiloAddress? targetSilo = null)
```

Migrates the current activation of the specified grain to a different silo and waits for migration to complete. If `targetSilo` is specified, a placement hint is set to guide migration to that silo.

### Parameters

- `grain` (`IAddressable`): The grain to migrate.
- `targetSilo` (`SiloAddress?`): The target silo address, or `null` to let the placement director choose.

### Returns

A task that completes when the grain has been migrated (deactivated on the source silo).

### Examples

```csharp
var targetSilo = cluster.GetActiveSilos().First(s => s.SiloAddress != originalHost).SiloAddress;
            await cluster.MigrateAsync(grain.GetGrainId(), targetSilo);
```
