Table of Contents

Class FormatterBase

Namespace
StreamJsonRpc
Assembly
StreamJsonRpc.dll

A base class for IJsonRpcMessageFormatter implementations that support exotic types.

public abstract class FormatterBase : IJsonRpcFormatterState, IJsonRpcInstanceContainer, IDisposable
Inheritance
FormatterBase
Implements
Derived
Inherited Members

Constructors

FormatterBase()

Initializes a new instance of the FormatterBase class.

public FormatterBase()

Properties

ApplicableMethodAttributeOnDeserializingMethod

Gets the JsonRpcMethodAttribute that is present on the method that may be invoked to serve the incoming request, when applicable.

protected JsonRpcMethodAttribute? ApplicableMethodAttributeOnDeserializingMethod { get; }

Property Value

JsonRpcMethodAttribute

DuplexPipeTracker

Gets the helper for marshaling pipes as RPC method arguments.

protected MessageFormatterDuplexPipeTracker DuplexPipeTracker { get; }

Property Value

MessageFormatterDuplexPipeTracker

EnumerableTracker

Gets the helper for marshaling IAsyncEnumerable<T> in RPC method arguments or return values.

protected MessageFormatterEnumerableTracker EnumerableTracker { get; }

Property Value

MessageFormatterEnumerableTracker

FormatterProgressTracker

Gets the MessageFormatterProgressTracker instance containing useful methods to help on the implementation of message formatters.

protected MessageFormatterProgressTracker FormatterProgressTracker { get; }

Property Value

MessageFormatterProgressTracker

JsonRpc

Gets the JsonRpc that is associated with this formatter.

protected JsonRpc? JsonRpc { get; }

Property Value

JsonRpc

Remarks

This field is used to create the IProgress<T> instance that will send the progress notifications when server reports it. The Rpc property helps to ensure that only one JsonRpc instance is associated with this formatter.

MultiplexingStream

Gets or sets the MultiplexingStream that may be used to establish out of band communication (e.g. marshal IDuplexPipe arguments).

public MultiplexingStream? MultiplexingStream { get; set; }

Property Value

MultiplexingStream

Methods

Dispose()

public void Dispose()

Dispose(bool)

Disposes managed and native resources held by this instance.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true if being disposed; false if being finalized.

TrackDeserialization(JsonRpcMessage, ReadOnlySpan<ParameterInfo>)

Sets up state to track deserialization of a message.

protected FormatterBase.DeserializationTracking TrackDeserialization(JsonRpcMessage message, ReadOnlySpan<ParameterInfo> parameters = default)

Parameters

message JsonRpcMessage

The message being deserialized.

parameters ReadOnlySpan<ParameterInfo>

The signature of the method that will be invoked for the incoming request, if applicable.

Returns

FormatterBase.DeserializationTracking

A value to dispose of when deserialization has completed.

TrackSerialization(JsonRpcMessage)

Sets up state to track serialization of a message.

protected FormatterBase.SerializationTracking TrackSerialization(JsonRpcMessage message)

Parameters

message JsonRpcMessage

The message being serialized.

Returns

FormatterBase.SerializationTracking

A value to dispose of when serialization has completed.