# WrappedException Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.wrappedexception/)

## CreateAndRethrow(Exception) {#createandrethrow-system-exception-1cd8d613}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.wrappedexception/methods/createandrethrow-system-exception-1cd8d613/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/Exceptions/WrappedException.cs#L70-L78)

```csharp
public static void CreateAndRethrow(Exception exception)
```

Creates a new instance of the [WrappedException](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.wrappedexception/) class and rethrows it using the provided exception's stack trace.

### Parameters

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

## GetObjectData(SerializationInfo, StreamingContext) {#getobjectdata-system-runtime-serialization-serializationinfo-system-runtime-seri-93072c42}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.wrappedexception/methods/getobjectdata-system-runtime-serialization-serializationinfo-system-runtime-seri-93072c42/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/Exceptions/WrappedException.cs#L59-L61)

```csharp
[System.Obsolete]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
```

When overridden in a derived class, sets the `System.Runtime.Serialization.SerializationInfo` with information about the exception.

### Parameters

- `info` (`SerializationInfo`): The `System.Runtime.Serialization.SerializationInfo` that holds the serialized object data about the exception being thrown.
- `context` (`StreamingContext`): The `System.Runtime.Serialization.StreamingContext` that contains contextual information about the source or destination.

### Exceptions

- `System.ArgumentNullException`: The `info` parameter is a null reference (`Nothing` in Visual Basic).

## ToString {#tostring-0143d6aa}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.wrappedexception/methods/tostring-0143d6aa/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Core.Abstractions/Exceptions/WrappedException.cs#L100)

```csharp
public override string ToString()
```

Creates and returns a string representation of the current exception.

### Returns

A string representation of the current exception.
