# InProcessTestCluster Methods

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

## CreateSiloAsync(InProcessTestSiloSpecificOptions) {#createsiloasync-orleans-testinghost-inprocesstestsilospecificoptions-3620f110}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/createsiloasync-orleans-testinghost-inprocesstestsilospecificoptions-3620f110/)

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

```csharp
public Task<InProcessSiloHandle> CreateSiloAsync(InProcessTestSiloSpecificOptions siloOptions)
```

### Parameters

- `siloOptions` (`InProcessTestSiloSpecificOptions`)

## DeactivateAsync(GrainId) {#deactivateasync-orleans-runtime-grainid-2df6a46c}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/deactivateasync-orleans-runtime-grainid-2df6a46c/)

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

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

Deactivates the current activation of the specified grain and waits for deactivation to complete.

### Parameters

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

### Returns

A task that completes when the grain has been deactivated.

### Examples

```csharp
await cluster.DeactivateAsync(grain.GetGrainId());
```

## DeactivateAsync(IAddressable) {#deactivateasync-orleans-runtime-iaddressable-f071d424}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/deactivateasync-orleans-runtime-iaddressable-f071d424/)

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

```csharp
public Task DeactivateAsync(IAddressable grain)
```

Deactivates the current activation of the specified grain and waits for deactivation to complete.

### Parameters

- `grain` (`IAddressable`): The grain to deactivate.

### Returns

A task that completes when the grain has been deactivated.

### Examples

```csharp
await cluster.DeactivateAsync(grain.GetGrainId());
```

## DeployAsync {#deployasync-40d7340d}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/deployasync-40d7340d/)

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

```csharp
public Task DeployAsync()
```

Deploys the cluster using the specified configuration and starts the client in-process.

## Dispose {#dispose-949a0b78}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/dispose-949a0b78/)

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

```csharp
public void Dispose()
```

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

## DisposeAsync {#disposeasync-d1297dcc}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/disposeasync-d1297dcc/)

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

```csharp
public ValueTask DisposeAsync()
```

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

### Returns

A task that represents the asynchronous dispose operation.

## GetActiveSilos {#getactivesilos-15ff101b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/getactivesilos-15ff101b/)

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

```csharp
public IEnumerable<InProcessSiloHandle> GetActiveSilos()
```

Get the list of current active silos.

### Returns

List of current silos.

## GetLivenessStabilizationTime(ClusterMembershipOptions, bool) {#getlivenessstabilizationtime-orleans-configuration-clustermembershipoptions-bool-51e07d3a}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/getlivenessstabilizationtime-orleans-configuration-clustermembershipoptions-bool-51e07d3a/)

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

```csharp
public static TimeSpan GetLivenessStabilizationTime(ClusterMembershipOptions clusterMembershipOptions, bool didKill = false)
```

Get the timeout value to use to wait for the silo liveness sub-system to detect and act on any recent cluster membership changes.

### Parameters

- `clusterMembershipOptions` (`ClusterMembershipOptions`)
- `didKill` (`bool`)

## GetLog {#getlog-1b791700}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/getlog-1b791700/)

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

```csharp
public string GetLog()
```

Gets the log.

### Returns

The log contents.

## GetSiloForAddress(SiloAddress) {#getsiloforaddress-orleans-runtime-siloaddress-27d5024b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/getsiloforaddress-orleans-runtime-siloaddress-27d5024b/)

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

```csharp
public InProcessSiloHandle? GetSiloForAddress(SiloAddress siloAddress)
```

Find the silo handle for the specified silo address.

### Parameters

- `siloAddress` (`SiloAddress`): Silo address to be found.

### Returns

SiloHandle of the appropriate silo, or `null` if not found.

## GetSiloServiceProvider(SiloAddress) {#getsiloserviceprovider-orleans-runtime-siloaddress-80599dd1}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/getsiloserviceprovider-orleans-runtime-siloaddress-80599dd1/)

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

```csharp
public IServiceProvider GetSiloServiceProvider(SiloAddress silo = null)
```

Returns the `System.IServiceProvider` associated with the given `silo`.

### Parameters

- `silo` (`SiloAddress`): The silo process to the the service provider for.

## InitializeClientAsync {#initializeclientasync-79c83ebb}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/initializeclientasync-79c83ebb/)

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

```csharp
public Task InitializeClientAsync()
```

Initialize the grain client. This should be already done by [InProcessTestCluster](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/)

## KillClientAsync {#killclientasync-4f982fb1}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/killclientasync-4f982fb1/)

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

```csharp
public Task KillClientAsync()
```

Performs a hard kill on client. Client will not cleanup resources.

## KillSiloAsync(InProcessSiloHandle) {#killsiloasync-orleans-testinghost-inprocesssilohandle-de434785}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/killsiloasync-orleans-testinghost-inprocesssilohandle-de434785/)

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

```csharp
public Task KillSiloAsync(InProcessSiloHandle instance)
```

Do an immediate Kill of the specified silo.

### Parameters

- `instance` (`InProcessSiloHandle`): Silo to be killed.

## MigrateAsync(GrainId, SiloAddress?) {#migrateasync-orleans-runtime-grainid-orleans-runtime-siloaddress-nullable-62c8a879}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/migrateasync-orleans-runtime-grainid-orleans-runtime-siloaddress-nullable-62c8a879/)

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

```csharp
public Task MigrateAsync(GrainId grainId, 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

- `grainId` (`GrainId`): The ID of 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);
```

## MigrateAsync(IAddressable, SiloAddress?) {#migrateasync-orleans-runtime-iaddressable-orleans-runtime-siloaddress-nullable-f920645b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/migrateasync-orleans-runtime-iaddressable-orleans-runtime-siloaddress-nullable-f920645b/)

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

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

## RestartSiloAsync(InProcessSiloHandle) {#restartsiloasync-orleans-testinghost-inprocesssilohandle-32d78ea8}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/restartsiloasync-orleans-testinghost-inprocesssilohandle-32d78ea8/)

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

```csharp
public Task<InProcessSiloHandle?> RestartSiloAsync(InProcessSiloHandle instance)
```

Do a Stop or Kill of the specified silo, followed by a restart.

### Parameters

- `instance` (`InProcessSiloHandle`): Silo to be restarted.

## RestartStoppedSecondarySiloAsync(string) {#restartstoppedsecondarysiloasync-string-2594889b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/restartstoppedsecondarysiloasync-string-2594889b/)

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

```csharp
public Task<InProcessSiloHandle> RestartStoppedSecondarySiloAsync(string siloName)
```

Restart a previously stopped.

### Parameters

- `siloName` (`string`): Silo to be restarted.

## StartAdditionalSilo {#startadditionalsilo-020b1fea}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/startadditionalsilo-020b1fea/)

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

```csharp
public InProcessSiloHandle StartAdditionalSilo()
```

Start an additional silo, so that it joins the existing cluster.

### Returns

SiloHandle for the newly started silo.

## StartAdditionalSilo(bool) {#startadditionalsilo-bool-dc8ed54e}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/startadditionalsilo-bool-dc8ed54e/)

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

```csharp
[System.Obsolete(Use overload which does not have a 'startAdditionalSiloOnNewPort' parameter.)]
public InProcessSiloHandle StartAdditionalSilo(bool startAdditionalSiloOnNewPort)
```

Start an additional silo, so that it joins the existing cluster.

### Parameters

- `startAdditionalSiloOnNewPort` (`bool`)

### Returns

SiloHandle for the newly started silo.

## StartAdditionalSiloAsync {#startadditionalsiloasync-4d029b67}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/startadditionalsiloasync-4d029b67/)

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

```csharp
public Task<InProcessSiloHandle> StartAdditionalSiloAsync()
```

Start an additional silo, so that it joins the existing cluster.

### Returns

SiloHandle for the newly started silo.

## StartAdditionalSiloAsync(bool) {#startadditionalsiloasync-bool-b4edbe15}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/startadditionalsiloasync-bool-b4edbe15/)

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

```csharp
public Task<InProcessSiloHandle> StartAdditionalSiloAsync(bool startAdditionalSiloOnNewPort)
```

Start an additional silo, so that it joins the existing cluster.

### Parameters

- `startAdditionalSiloOnNewPort` (`bool`)

### Returns

SiloHandle for the newly started silo.

## StartSiloAsync(int, InProcessTestClusterOptions) {#startsiloasync-int-orleans-testinghost-inprocesstestclusteroptions-d57d629b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/startsiloasync-int-orleans-testinghost-inprocesstestclusteroptions-d57d629b/)

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

```csharp
public Task<InProcessSiloHandle> StartSiloAsync(int instanceNumber, InProcessTestClusterOptions clusterOptions)
```

Starts a new silo.

### Parameters

- `instanceNumber` (`int`): The instance number to deploy
- `clusterOptions` (`InProcessTestClusterOptions`): The options to use.

### Returns

A handle to the deployed silo.

## StartSiloAsync(int, InProcessTestClusterOptions, IReadOnlyList&lt;IConfigurationSource&gt;, bool) {#startsiloasync-int-orleans-testinghost-inprocesstestclusteroptions-system-collec-f6245194}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/startsiloasync-int-orleans-testinghost-inprocesstestclusteroptions-system-collec-f6245194/)

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

```csharp
[System.Obsolete(Use the overload which does not have a 'startSiloOnNewPort' parameter.)]
public Task<InProcessSiloHandle> StartSiloAsync(int instanceNumber, InProcessTestClusterOptions clusterOptions, IReadOnlyList<IConfigurationSource> configurationOverrides, bool startSiloOnNewPort)
```

Starts a new silo.

### Parameters

- `instanceNumber` (`int`): The instance number to deploy
- `clusterOptions` (`InProcessTestClusterOptions`): The options to use.
- `configurationOverrides` (`IReadOnlyList<IConfigurationSource>`): Configuration overrides.
- `startSiloOnNewPort` (`bool`): Whether we start this silo on a new port, instead of the default one

### Returns

A handle to the deployed silo.

## StartSiloAsync(InProcessTestCluster, int, InProcessTestClusterOptions) {#startsiloasync-orleans-testinghost-inprocesstestcluster-int-orleans-testinghost-217f4f65}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/startsiloasync-orleans-testinghost-inprocesstestcluster-int-orleans-testinghost-217f4f65/)

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

```csharp
public static Task<InProcessSiloHandle> StartSiloAsync(InProcessTestCluster cluster, int instanceNumber, InProcessTestClusterOptions clusterOptions)
```

Start a new silo in the target cluster

### Parameters

- `cluster` (`InProcessTestCluster`): The InProcessTestCluster in which the silo should be deployed
- `instanceNumber` (`int`): The instance number to deploy
- `clusterOptions` (`InProcessTestClusterOptions`): The options to use.

### Returns

A handle to the silo deployed

## StartSiloAsync(InProcessTestCluster, int, InProcessTestClusterOptions, IReadOnlyList&lt;IConfigurationSource&gt;, bool) {#startsiloasync-orleans-testinghost-inprocesstestcluster-int-orleans-testinghost-065cc76e}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/startsiloasync-orleans-testinghost-inprocesstestcluster-int-orleans-testinghost-065cc76e/)

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

```csharp
[System.Obsolete(Use the overload which does not have a 'startSiloOnNewPort' parameter.)]
public static Task<InProcessSiloHandle> StartSiloAsync(InProcessTestCluster cluster, int instanceNumber, InProcessTestClusterOptions clusterOptions, IReadOnlyList<IConfigurationSource> configurationOverrides, bool startSiloOnNewPort)
```

Start a new silo in the target cluster

### Parameters

- `cluster` (`InProcessTestCluster`): The InProcessTestCluster in which the silo should be deployed
- `instanceNumber` (`int`): The instance number to deploy
- `clusterOptions` (`InProcessTestClusterOptions`): The options to use.
- `configurationOverrides` (`IReadOnlyList<IConfigurationSource>`): Configuration overrides.
- `startSiloOnNewPort` (`bool`): Whether we start this silo on a new port, instead of the default one

### Returns

A handle to the silo deployed

## StartSilosAsync(int) {#startsilosasync-int-da724d53}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/startsilosasync-int-da724d53/)

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

```csharp
public Task<List<InProcessSiloHandle>> StartSilosAsync(int silosToStart)
```

Start a number of additional silo, so that they join the existing cluster.

### Parameters

- `silosToStart` (`int`): Number of silos to start.

### Returns

List of SiloHandles for the newly started silos.

## StartSilosAsync(int, bool) {#startsilosasync-int-bool-84764165}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/startsilosasync-int-bool-84764165/)

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

```csharp
[System.Obsolete(Use overload which does not have a 'startAdditionalSiloOnNewPort' parameter.)]
public Task<List<InProcessSiloHandle>> StartSilosAsync(int silosToStart, bool startAdditionalSiloOnNewPort)
```

Start a number of additional silo, so that they join the existing cluster.

### Parameters

- `silosToStart` (`int`): Number of silos to start.
- `startAdditionalSiloOnNewPort` (`bool`)

### Returns

List of SiloHandles for the newly started silos.

## StopAllSilos {#stopallsilos-81f775a2}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/stopallsilos-81f775a2/)

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

```csharp
public void StopAllSilos()
```

Stop all current silos.

## StopAllSilosAsync {#stopallsilosasync-2e4aca91}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/stopallsilosasync-2e4aca91/)

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

```csharp
public Task StopAllSilosAsync()
```

Stop all current silos.

## StopClusterClientAsync {#stopclusterclientasync-993d6245}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/stopclusterclientasync-993d6245/)

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

```csharp
public Task StopClusterClientAsync()
```

Stop cluster client as an asynchronous operation.

### Returns

A `System.Threading.Tasks.Task` representing the asynchronous operation.

## StopSiloAsync(InProcessSiloHandle) {#stopsiloasync-orleans-testinghost-inprocesssilohandle-0464a879}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/stopsiloasync-orleans-testinghost-inprocesssilohandle-0464a879/)

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

```csharp
public Task StopSiloAsync(InProcessSiloHandle instance)
```

Do a semi-graceful Stop of the specified silo.

### Parameters

- `instance` (`InProcessSiloHandle`): Silo to be stopped.

## StopSilosAsync {#stopsilosasync-c4be92a8}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/stopsilosasync-c4be92a8/)

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

```csharp
public Task StopSilosAsync()
```

Stop all silos.

## TryGetGrainContext(GrainId, IGrainContext?) {#trygetgraincontext-orleans-runtime-grainid-out-orleans-runtime-igraincontext-nul-da6792ee}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/trygetgraincontext-orleans-runtime-grainid-out-orleans-runtime-igraincontext-nul-da6792ee/)

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

```csharp
public bool TryGetGrainContext(GrainId grainId, out IGrainContext? grainContext)
```

Attempts to find the [IGrainContext](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.igraincontext/) for the grain with the specified `grainId` by searching all silos in the cluster.

### Parameters

- `grainId` (`GrainId`): The ID of the grain to find.
- `grainContext` (`IGrainContext?`): When this method returns, contains the grain context if found; otherwise, `null`.

### Returns

`true` if the grain was found in one of the silos; otherwise, `false`.

## WaitForClusterManifestToStabilizeAsync(bool) {#waitforclustermanifesttostabilizeasync-bool-542ceb7c}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/waitforclustermanifesttostabilizeasync-bool-542ceb7c/)

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

```csharp
public Task WaitForClusterManifestToStabilizeAsync(bool didKill = false)
```

Wait for active silos to observe cluster manifest updates for all active silos.

### Parameters

- `didKill` (`bool`): Whether recent membership changes were done by graceful Stop.

## WaitForDeactivationAsync(GrainId) {#waitfordeactivationasync-orleans-runtime-grainid-339870d3}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/waitfordeactivationasync-orleans-runtime-grainid-339870d3/)

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

## WaitForDeactivationAsync(IAddressable) {#waitfordeactivationasync-orleans-runtime-iaddressable-0d3f51a1}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/waitfordeactivationasync-orleans-runtime-iaddressable-0d3f51a1/)

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

```csharp
public Task WaitForDeactivationAsync(IAddressable grain)
```

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

- `grain` (`IAddressable`): 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;
```

## WaitForLivenessToStabilizeAsync(bool) {#waitforlivenesstostabilizeasync-bool-97cd87ec}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.inprocesstestcluster/methods/waitforlivenesstostabilizeasync-bool-97cd87ec/)

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

```csharp
public Task WaitForLivenessToStabilizeAsync(bool didKill = false)
```

Wait for the silo liveness sub-system to detect and act on any recent cluster membership changes.

### Parameters

- `didKill` (`bool`): Whether recent membership changes we done by graceful Stop.
