Class JsonRpcOptions
- Namespace
- Nerdbank.JsonRpc
- Assembly
- Nerdbank.JsonRpc.dll
Provides immutable configuration that can be shared across independent JsonRpc connections.
public sealed record JsonRpcOptions : IEquatable<JsonRpcOptions>
- Inheritance
-
JsonRpcOptions
- Implements
- Inherited Members
Remarks
These options describe how a connection should behave: its policies, limits, and conventions. Supply live runtime infrastructure, such as a logger, synchronization context, or multiplexing stream, on JsonRpc instead. Reusing options does not share connection runtime state.
Properties
AdditionalExceptionTypes
Gets or initializes additional exception types that may be reconstructed from peer diagnostics.
public RemoteExceptionTypeMapping AdditionalExceptionTypes { get; init; }
Property Value
Remarks
The mapping is frozen when assigned and may then be shared across connections.
Default
Gets the default options.
public static JsonRpcOptions Default { get; }
Property Value
IncludeExceptionDetails
Gets a value indicating whether exception details are included in error responses.
public bool IncludeExceptionDetails { get; init; }
Property Value
MarshaledProxy
Gets or initializes the options used for proxies implicitly created for RPC-marshalable objects.
public JsonRpcProxyOptions MarshaledProxy { get; init; }
Property Value
- JsonRpcProxyOptions
Defaults to Default, the same naming convention used for ordinary RPC proxies.
Remarks
To communicate with StreamJsonRpc's default RPC-marshalable objects, set this property to
new() { MethodNameTransform = CommonMethodNameTransforms.Identity } in the JsonRpcOptions object initializer.
This does not change options for proxies attached through Attach<T>(JsonRpcProxyOptions?).
Exceptions
- ArgumentNullException
Thrown when set to null.
MarshaledTarget
Gets or initializes the options used when implicitly registering RPC-marshalable targets.
public JsonRpcTargetOptions MarshaledTarget { get; init; }
Property Value
- JsonRpcTargetOptions
Defaults to Default, the same naming convention used for ordinary RPC targets.
Remarks
To communicate with StreamJsonRpc's default RPC-marshalable objects, set this property to
new() { MethodNameTransform = CommonMethodNameTransforms.Identity } in the JsonRpcOptions object initializer.
This does not change options for targets registered through AddRpcTarget<T>(T, ITypeShape<T>, JsonRpcTargetOptions?).
Exceptions
- ArgumentNullException
Thrown when set to null.
MaximumMessageSize
Gets or initializes the maximum encoded message size, in bytes.
public int MaximumMessageSize { get; init; }
Property Value
- int
Defaults to 8 MiB. The built-in JSON and MessagePack channels apply this limit to received messages; the JSON channel also applies it to sent messages.
Exceptions
- ArgumentOutOfRangeException
Thrown when set to zero or a negative value.
OutboundRequestTimeout
Gets or initializes the timeout applied to each outbound request that expects a response.
public TimeSpan OutboundRequestTimeout { get; init; }
Property Value
- TimeSpan
The timeout, or InfiniteTimeSpan to disable this behavior. The default is InfiniteTimeSpan.
Remarks
When the timeout expires, the request is canceled locally and a cancellation notification is sent to the peer. The peer may still be processing the request. The maximum finite timeout is MaxValue milliseconds, for compatibility with all supported target frameworks.
Exceptions
- ArgumentOutOfRangeException
Thrown when set to zero, a negative value other than InfiniteTimeSpan, or more than MaxValue milliseconds.