# IStorageFaultGrain Methods

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

## AddFaultOnClear(GrainId, Exception) {#addfaultonclear-orleans-runtime-grainid-system-exception-6c42ac72}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.istoragefaultgrain/methods/addfaultonclear-orleans-runtime-grainid-system-exception-6c42ac72/)

```csharp
public abstract Task AddFaultOnClear(GrainId grainId, Exception exception)
```

Adds a storage exception to be thrown when the referenced grain clears state in a storage provider

### Parameters

- `grainId` (`GrainId`)
- `exception` (`Exception`)

### Returns

Task.

## AddFaultOnRead(GrainId, Exception) {#addfaultonread-orleans-runtime-grainid-system-exception-681337c7}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.istoragefaultgrain/methods/addfaultonread-orleans-runtime-grainid-system-exception-681337c7/)

```csharp
public abstract Task AddFaultOnRead(GrainId grainId, Exception exception)
```

Adds a storage exception to be thrown when the referenced grain reads state from a storage provider

### Parameters

- `grainId` (`GrainId`)
- `exception` (`Exception`)

### Returns

Task.

## AddFaultOnWrite(GrainId, Exception) {#addfaultonwrite-orleans-runtime-grainid-system-exception-1a9faba4}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.istoragefaultgrain/methods/addfaultonwrite-orleans-runtime-grainid-system-exception-1a9faba4/)

```csharp
public abstract Task AddFaultOnWrite(GrainId grainId, Exception exception)
```

Adds a storage exception to be thrown when the referenced grain writes state to a storage provider

### Parameters

- `grainId` (`GrainId`)
- `exception` (`Exception`)

### Returns

Task.

## OnClear(GrainId) {#onclear-orleans-runtime-grainid-d26aa185}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.istoragefaultgrain/methods/onclear-orleans-runtime-grainid-d26aa185/)

```csharp
public abstract Task OnClear(GrainId grainId)
```

Throws a storage exception if one has been added for the grain reference for clearing state.

### Parameters

- `grainId` (`GrainId`)

## OnRead(GrainId) {#onread-orleans-runtime-grainid-2adfe988}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.istoragefaultgrain/methods/onread-orleans-runtime-grainid-2adfe988/)

```csharp
public abstract Task OnRead(GrainId grainId)
```

Throws a storage exception if one has been added for the grain reference for reading.

### Parameters

- `grainId` (`GrainId`)

## OnWrite(GrainId) {#onwrite-orleans-runtime-grainid-f75e181b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.istoragefaultgrain/methods/onwrite-orleans-runtime-grainid-f75e181b/)

```csharp
public abstract Task OnWrite(GrainId grainId)
```

Throws a storage exception if one has been added for the grain reference for writing.

### Parameters

- `grainId` (`GrainId`)
