Class RemoteExceptionTypeMapping
- Namespace
- Nerdbank.JsonRpc
- Assembly
- Nerdbank.JsonRpc.dll
Defines explicitly allowed exception types that may be reconstructed from peer diagnostics.
public sealed class RemoteExceptionTypeMapping : IReadOnlyCollection<Type>, IEnumerable<Type>, IEnumerable
- Inheritance
-
RemoteExceptionTypeMapping
- Implements
- Inherited Members
- Extension Methods
Remarks
This mutable builder is frozen when assigned to AdditionalExceptionTypes.
Properties
Count
Gets the number of allowed exception types.
public int Count { get; }
Property Value
Methods
Add<TException>()
Adds a self-shapeable exception type that may be serialized and reconstructed.
public void Add<TException>() where TException : Exception, IShapeable<TException>
Type Parameters
TExceptionThe exception type, which provides its own generated shape.
Remarks
The shape must use a PolyType marshaler to select and sanitize the data that crosses the RPC boundary. The serializer uses its surrogate shape to construct the exception without a factory delegate.
Add<TException, TProvider>()
Adds an exception type using a shape provided by a source-generated witness type.
public void Add<TException, TProvider>() where TException : Exception where TProvider : IShapeable<TException>
Type Parameters
TExceptionThe allowed exception type.
TProviderThe witness type that provides the shape for
TException.
Remarks
Use a PolyType marshaler on the shape to exclude or sanitize members that should not cross the RPC boundary.
GetEnumerator()
Gets the explicitly allowed exception types.
public IEnumerator<Type> GetEnumerator()
Returns
- IEnumerator<Type>
The allowed types.