# FaultInjectionGrainStorage Methods

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

## ClearStateAsync(string, GrainId, IGrainState&lt;T&gt;) {#clearstateasync-1-string-orleans-runtime-grainid-orleans-igrainstate-t-4ecd7b96}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.faultinjectiongrainstorage/methods/clearstateasync-1-string-orleans-runtime-grainid-orleans-igrainstate-t-4ecd7b96/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/TestStorageProviders/FaultInjectionStorageProvider.cs#L102-L116)

```csharp
public Task ClearStateAsync<T>(string grainType, GrainId grainId, IGrainState<T> grainState)
```

Faults if exception is provided, otherwise calls through to decorated storage provider.

### Parameters

- `grainType` (`string`)
- `grainId` (`GrainId`)
- `grainState` (`IGrainState<T>`)

### Returns

Completion promise for the Delete operation on the specified grain.

## Participate(ISiloLifecycle) {#participate-orleans-runtime-isilolifecycle-51558834}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.faultinjectiongrainstorage/methods/participate-orleans-runtime-isilolifecycle-51558834/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/TestStorageProviders/FaultInjectionStorageProvider.cs#L121-L122)

```csharp
public void Participate(ISiloLifecycle lifecycle)
```

Adds the provided observer as a participant in the lifecycle.

### Parameters

- `lifecycle` (`ISiloLifecycle`): The observer.

## ReadStateAsync(string, GrainId, IGrainState&lt;T&gt;) {#readstateasync-1-string-orleans-runtime-grainid-orleans-igrainstate-t-a8507469}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.faultinjectiongrainstorage/methods/readstateasync-1-string-orleans-runtime-grainid-orleans-igrainstate-t-a8507469/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/TestStorageProviders/FaultInjectionStorageProvider.cs#L64-L77)

```csharp
public Task ReadStateAsync<T>(string grainType, GrainId grainId, IGrainState<T> grainState)
```

Faults if exception is provided, otherwise calls through to decorated storage provider.

### Parameters

- `grainType` (`string`)
- `grainId` (`GrainId`)
- `grainState` (`IGrainState<T>`)

### Returns

Completion promise for the Read operation on the specified grain.

## WriteStateAsync(string, GrainId, IGrainState&lt;T&gt;) {#writestateasync-1-string-orleans-runtime-grainid-orleans-igrainstate-t-daa1dfb8}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.faultinjectiongrainstorage/methods/writestateasync-1-string-orleans-runtime-grainid-orleans-igrainstate-t-daa1dfb8/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/TestStorageProviders/FaultInjectionStorageProvider.cs#L83-L96)

```csharp
public Task WriteStateAsync<T>(string grainType, GrainId grainId, IGrainState<T> grainState)
```

Faults if exception is provided, otherwise calls through to decorated storage provider.

### Parameters

- `grainType` (`string`)
- `grainId` (`GrainId`)
- `grainState` (`IGrainState<T>`)

### Returns

Completion promise for the Write operation on the specified grain.
