# ExceptionCodec Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/)

## DeepCopy(Exception, Exception, CopyContext) {#deepcopy-system-exception-system-exception-orleans-serialization-cloning-copycon-7584d245}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/methods/deepcopy-system-exception-system-exception-orleans-serialization-cloning-copycon-7584d245/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/ISerializableSerializer/ExceptionCodec.cs#L421-L430)

```csharp
public void DeepCopy(Exception input, Exception output, CopyContext context)
```

Clones members from `input` and copies them to `output`.

### Parameters

- `input` (`Exception`): The input.
- `output` (`Exception`): The output.
- `context` (`CopyContext`): The context.

## Deserialize(Reader&lt;TInput&gt;, Exception) {#deserialize-1-ref-orleans-serialization-buffers-reader-tinput-system-exception-13b8e4de}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/methods/deserialize-1-ref-orleans-serialization-buffers-reader-tinput-system-exception-13b8e4de/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/ISerializableSerializer/ExceptionCodec.cs)

```csharp
public void Deserialize<TInput>(ref Reader<TInput> reader, Exception value)
```

Deserializes into the provided value.

### Parameters

- `reader` (`Reader<TInput>`): The reader.
- `value` (`Exception`): The value.

## Deserialize(Reader&lt;TInput&gt;, object) {#deserialize-1-ref-orleans-serialization-buffers-reader-tinput-object-11e4639a}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/methods/deserialize-1-ref-orleans-serialization-buffers-reader-tinput-object-11e4639a/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/ISerializableSerializer/ExceptionCodec.cs)

```csharp
public void Deserialize<TInput>(ref Reader<TInput> reader, object value)
```

Deserializes into the provided value.

### Parameters

- `reader` (`Reader<TInput>`): The reader.
- `value` (`object`): The value.

## DeserializeException(Reader&lt;TInput&gt;, Field) {#deserializeexception-1-ref-orleans-serialization-buffers-reader-tinput-orleans-s-b7155acc}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/methods/deserializeexception-1-ref-orleans-serialization-buffers-reader-tinput-orleans-s-b7155acc/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/ISerializableSerializer/ExceptionCodec.cs#L335-L415)

```csharp
public Exception DeserializeException<TInput>(ref Reader<TInput> reader, Field field)
```

### Parameters

- `reader` (`Reader<TInput>`)
- `field` (`Field`)

## GetDataProperty(Exception) {#getdataproperty-system-exception-51e98387}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/methods/getdataproperty-system-exception-51e98387/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/ISerializableSerializer/ExceptionCodec.cs#L182-L195)

```csharp
public Dictionary<object, object> GetDataProperty(Exception exception)
```

Gets the data property from the provided exception.

### Parameters

- `exception` (`Exception`): The exception.

### Returns

The provided exception's `System.Exception.Data` property.

## GetObjectData(Exception) {#getobjectdata-system-exception-f10fe377}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/methods/getobjectdata-system-exception-f10fe377/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/ISerializableSerializer/ExceptionCodec.cs#L119-L124)

```csharp
public SerializationInfo GetObjectData(Exception value)
```

Gets the object data from the provided exception.

### Parameters

- `value` (`Exception`): The value.

### Returns

A populated `System.Runtime.Serialization.SerializationInfo` value.

## IsSupportedType(Type) {#issupportedtype-system-type-dde18110}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/methods/issupportedtype-system-type-dde18110/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/ISerializableSerializer/ExceptionCodec.cs#L251-L278)

```csharp
public bool IsSupportedType(Type type)
```

Determines whether the specified type is supported by this instance.

### Parameters

- `type` (`Type`): The type.

### Returns

`true` if the specified type is supported; otherwise, `false`.

## ReadValue(Reader&lt;TInput&gt;, Field) {#readvalue-1-ref-orleans-serialization-buffers-reader-tinput-orleans-serializatio-b13fb861}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/methods/readvalue-1-ref-orleans-serialization-buffers-reader-tinput-orleans-serializatio-b13fb861/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/ISerializableSerializer/ExceptionCodec.cs#L299-L319)

```csharp
public Exception ReadValue<TInput>(ref Reader<TInput> reader, Field field)
```

Reads a value.

### Parameters

- `reader` (`Reader<TInput>`): The reader.
- `field` (`Field`): The field.

### Returns

The value.

## Serialize(Writer&lt;TBufferWriter&gt;, Exception) {#serialize-1-ref-orleans-serialization-buffers-writer-tbufferwriter-system-except-6183ed47}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/methods/serialize-1-ref-orleans-serialization-buffers-writer-tbufferwriter-system-except-6183ed47/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/ISerializableSerializer/ExceptionCodec.cs)

```csharp
public void Serialize<TBufferWriter>(ref Writer<TBufferWriter> writer, Exception value)
```

Serializes the provided value.

### Parameters

- `writer` (`Writer<TBufferWriter>`): The writer.
- `value` (`Exception`): The value.

## Serialize(Writer&lt;TBufferWriter&gt;, object) {#serialize-1-ref-orleans-serialization-buffers-writer-tbufferwriter-object-e23152ad}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/methods/serialize-1-ref-orleans-serialization-buffers-writer-tbufferwriter-object-e23152ad/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/ISerializableSerializer/ExceptionCodec.cs)

```csharp
public void Serialize<TBufferWriter>(ref Writer<TBufferWriter> writer, object value)
```

Serializes the provided value.

### Parameters

- `writer` (`Writer<TBufferWriter>`): The writer.
- `value` (`object`): The value.

## SerializeException(Writer&lt;TBufferWriter&gt;, Exception) {#serializeexception-1-ref-orleans-serialization-buffers-writer-tbufferwriter-syst-94d901dc}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/methods/serializeexception-1-ref-orleans-serialization-buffers-writer-tbufferwriter-syst-94d901dc/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/ISerializableSerializer/ExceptionCodec.cs#L214-L223)

```csharp
public void SerializeException<TBufferWriter>(ref Writer<TBufferWriter> writer, Exception value)
```

### Parameters

- `writer` (`Writer<TBufferWriter>`)
- `value` (`Exception`)

## SetBaseProperties(Exception, string, string, Exception, int, Dictionary&lt;object, object&gt;) {#setbaseproperties-system-exception-string-string-system-exception-int-system-col-a3ca9796}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/methods/setbaseproperties-system-exception-string-string-system-exception-int-system-col-a3ca9796/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/ISerializableSerializer/ExceptionCodec.cs#L139-L173)

```csharp
public void SetBaseProperties(Exception value, string message, string stackTrace, Exception innerException, int hResult, Dictionary<object, object> data)
```

Sets base properties on the provided exception.

### Parameters

- `value` (`Exception`): The value.
- `message` (`string`): The message.
- `stackTrace` (`string`): The stack trace.
- `innerException` (`Exception`): The inner exception.
- `hResult` (`int`): The HResult.
- `data` (`Dictionary<object, object>`): The data.

## WriteField(Writer&lt;TBufferWriter&gt;, uint, Type, Exception) {#writefield-1-ref-orleans-serialization-buffers-writer-tbufferwriter-uint-system-6822bed9}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/methods/writefield-1-ref-orleans-serialization-buffers-writer-tbufferwriter-uint-system-6822bed9/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/ISerializableSerializer/ExceptionCodec.cs)

```csharp
public void WriteField<TBufferWriter>(ref Writer<TBufferWriter> writer, uint fieldIdDelta, Type expectedType, Exception value)
```

Writes a field.

### Parameters

- `writer` (`Writer<TBufferWriter>`): The writer.
- `fieldIdDelta` (`uint`): The field identifier delta.
- `expectedType` (`Type`): The expected type.
- `value` (`Exception`): The value.

## WriteField(Writer&lt;TBufferWriter&gt;, uint, Type, object) {#writefield-1-ref-orleans-serialization-buffers-writer-tbufferwriter-uint-system-b15354ff}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.exceptioncodec/methods/writefield-1-ref-orleans-serialization-buffers-writer-tbufferwriter-uint-system-b15354ff/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/ISerializableSerializer/ExceptionCodec.cs)

```csharp
public void WriteField<TBufferWriter>(ref Writer<TBufferWriter> writer, uint fieldIdDelta, Type expectedType, object value)
```

Writes a field using the provided untyped value. The type must still match the codec instance!

### Parameters

- `writer` (`Writer<TBufferWriter>`)
- `fieldIdDelta` (`uint`)
- `expectedType` (`Type`)
- `value` (`object`)
