This is a public, read-only report. Striff reads this repository's docs, turns each sentence that makes a claim about the code into a rule, and checks the rule against the code on the default branch. How this works
For servers that should wait for incoming RPC requests until the client disconnects, utilize the @StreamJsonRpc.JsonRpc.Completion?displayProperty=nameWithType property which returns a @System.Threading.Tasks.Task that completes when the connection drops.
JsonRpc has Completion
Holds
Read Oct 22
When any of the above conditions are met, @StreamJsonRpc.JsonRpc will (in no particular order): Call @System.IDisposable.Dispose on the @StreamJsonRpc.IJsonRpcMessageHandler, which is expected to dispose the underlying transport.
JsonRpc depends on IJsonRpcMessageHandler
Holds
Read Oct 22
When any of the above conditions are met, @StreamJsonRpc.JsonRpc will (in no particular order): … Faults all outstanding @System.Threading.Tasks.Task objects that represent outbound requests with a <xref:StreamJsonRpc.ConnectionLostException>.
JsonRpc depends on ConnectionLostException
HoldsJsonRpc.cs → Exceptions
Read Oct 22
JSON-RPC also allows for an error.data property which may be a primitive value, array or object that provides more data regarding the error. The schema for this property is up to the application, but StreamJsonRpc defaults to serializing a <xref:StreamJsonRpc.Protocol.CommonErrorData> object to this property which retains much of the useful information from an <xref:System.Exception> object.
JsonRpc depends on CommonErrorData
HoldsJsonRpc.cs → Protocol
Read Oct 22
By setting <xref:StreamJsonRpc.JsonRpc.ExceptionStrategy?displayProperty=nameWithType> to <xref:StreamJsonRpc.ExceptionProcessing.ISerializable?displayProperty=nameWithType>, @StreamJsonRpc.JsonRpc will use the <xref:System.Runtime.Serialization.ISerializable> patterns in .NET to serialize exceptions with higher fidelity.
2 rules from this sentence
JsonRpc has ExceptionStrategy
checks “JsonRpc.ExceptionStrategy”
Holds
ExceptionProcessing has ISerializable
checks “ExceptionProcessing.ISerializable”
Holds
Read Oct 22
When a JSON-RPC server may throw multiple exceptions that clients should react differently to, it's highly recommended that the RPC server throw <xref:StreamJsonRpc.LocalRpcException> and set its <xref:StreamJsonRpc.LocalRpcException.ErrorCode> property so the client can check and branch based on it.
LocalRpcException has ErrorCode
Holds
Read Oct 22
Another option to more closely control the error messages sent from an RPC server is to derive from the @StreamJsonRpc.JsonRpc class and override its <xref:StreamJsonRpc.JsonRpc.CreateErrorDetails*> method.
JsonRpc has a CreateErrorDetails method
Holds
Read Oct 22
The exception's <xref:StreamJsonRpc.RemoteInvocationException.DeserializedErrorData> property is typically the best one to use and will typically be an instance of <xref:StreamJsonRpc.Protocol.CommonErrorData> which you can try casting to.
2 rules from this sentence
RemoteInvocationException depends on CommonErrorData
checks “The exception's <xref:StreamJsonRpc.RemoteInvocationException.DeserializedErrorData> property is typically the best one to use and will typically be an instance of <xref:StreamJsonRpc.Protocol.CommonErrorData>”
HoldsExceptions → Protocol
RemoteInvocationException has DeserializedErrorData
Holds
Read Oct 22
you may derive from the @StreamJsonRpc.JsonRpc class and override the <xref:StreamJsonRpc.JsonRpc.GetErrorDetailsDataType*> method to inspect the JSON-RPC error message directly and return the type of data object that should be deserialized for easier consumption from your exception handlers.
JsonRpc has a GetErrorDetailsDataType method
Holds
Read Oct 22
The @StreamJsonRpc.IJsonRpcMessageHandler interface that StreamJsonRpc defines fills the responsibility for writing and reading multiple distinct messages on a transport.
2 rules from this sentence
IJsonRpcMessageHandler is a contract, and IJsonRpcMessageHandler is in StreamJsonRpc
Holds
IJsonRpcMessageHandler is in StreamJsonRpc, and IJsonRpcMessageHandler is a contract
Holds
Read Oct 22
Some of the constructors on the @StreamJsonRpc.JsonRpc class accept an object that implements the @StreamJsonRpc.IJsonRpcMessageHandler interface, allowing you to select any of the built-in behaviors listed above, or define this part of the protocol yourself.
JsonRpc depends on IJsonRpcMessageHandler
Holds
Read Oct 22
The encoding of an individual JSON-RPC message is the responsibility of an <xref:StreamJsonRpc.IJsonRpcMessageFormatter>. This interface has the very focused responsibility serializing and deserializing <xref:StreamJsonRpc.Protocol.JsonRpcMessage>-derived types, of which there are three: <xref:StreamJsonRpc.Protocol.JsonRpcRequest>, <xref:StreamJsonRpc.Protocol.JsonRpcResult> and <xref:StreamJsonRpc.Protocol.JsonRpcError>.
IJsonRpcMessageFormatter depends on JsonRpcMessage
HoldsIJsonRpcMessageFormatter.cs → Protocol
Read Oct 22
The encoding of an individual JSON-RPC message is the responsibility of an <xref:StreamJsonRpc.IJsonRpcMessageFormatter>.
IJsonRpcMessageFormatter is a contract
Holds
Read Oct 22
This interface has the very focused responsibility serializing and deserializing <xref:StreamJsonRpc.Protocol.JsonRpcMessage>-derived types, of which there are three: <xref:StreamJsonRpc.Protocol.JsonRpcRequest>, <xref:StreamJsonRpc.Protocol.JsonRpcResult> and <xref:StreamJsonRpc.Protocol.JsonRpcError>.
3 rules from this sentence
JsonRpcRequest extends JsonRpcMessage
Holds
JsonRpcResult extends JsonRpcMessage
Holds
JsonRpcError extends JsonRpcMessage
Holds
Read Oct 22
Text-based formatters should implement <xref:StreamJsonRpc.IJsonRpcMessageTextFormatter> (which derives from <xref:StreamJsonRpc.IJsonRpcMessageFormatter>) so that it can be used with an @StreamJsonRpc.IJsonRpcMessageHandler such as <xref:StreamJsonRpc.HeaderDelimitedMessageHandler> that can determine the text encoding to use at the transport level.
StreamJsonRpc includes the following <xref:StreamJsonRpc.IJsonRpcMessageFormatter> implementations: <xref:StreamJsonRpc.NerdbankMessagePackFormatter> - Uses the Nerdbank.MessagePack library to serialize each message using the very fast and compact binary MessagePack format.
<xref:StreamJsonRpc.NerdbankMessagePackFormatter> - Uses the Nerdbank.MessagePack library to serialize each message using the very fast and compact binary MessagePack format.
All custom converters can be added to the serializer at <xref:StreamJsonRpc.NerdbankMessagePackFormatter.UserDataSerializer>.
NerdbankMessagePackFormatter has UserDataSerializer
Holds
Read Oct 22
When customizing the serializer, always base the new serializer on the default one defined by <xref:StreamJsonRpc.NerdbankMessagePackFormatter.DefaultSerializer> as shown below:
NerdbankMessagePackFormatter has DefaultSerializer
Holds
Read Oct 22
<xref:StreamJsonRpc.JsonMessageFormatter> - Uses Newtonsoft.Json to serialize each JSON-RPC message as actual JSON.
JsonMessageFormatter imports Newtonsoft.Json
Holds
Read Oct 22
You can leverage JsonConverter and add your custom converters via attributes or by contributing them to the JsonMessageFormatter.JsonSerializer.Converters collection.
JsonMessageFormatter has JsonSerializer
Holds
Read Oct 22
<xref:StreamJsonRpc.MessagePackFormatter> - Uses the MessagePack-CSharp library to serialize each JSON-RPC message using the very fast and compact binary MessagePack format.
MessagePackFormatter imports MessagePack
Holds
Read Oct 22
<xref:StreamJsonRpc.SystemTextJsonFormatter> - Uses the System.Text.Json library to serialize each JSON-RPC message as UTF-8 encoded JSON.
SystemTextJsonFormatter imports System.Text.Json
Holds
Read Oct 22
You can leverage JsonConverter<T> and add your custom converters via attributes or by contributing them to the <xref:StreamJsonRpc.SystemTextJsonFormatter.JsonSerializerOptions?displayProperty=nameWithType>.<xref:System.Text.Json.JsonSerializerOptions.Converters> collection.
SystemTextJsonFormatter has JsonSerializerOptions
Holds
Read Oct 22
An application that has a main thread and an instance of <xref:Microsoft.VisualStudio.Threading.JoinableTaskContext> should set the <xref:StreamJsonRpc.JsonRpc.JoinableTaskFactory?displayProperty=nameWithType> property to an instance of <xref:Microsoft.VisualStudio.Threading.JoinableTaskFactory>.
JsonRpc has JoinableTaskFactory
Holds
Read Oct 22
Set the <xref:StreamJsonRpc.JsonRpcProxyOptions.AcceptProxyWithExtraInterfaces?displayProperty=nameWithType> property to true to reduce the number of predefined groups for which proxies must be specially generated.
JsonRpcProxyOptions has AcceptProxyWithExtraInterfaces
Holds
Read Oct 22
Set <xref:System.Text.Json.JsonSerializerOptions.TypeInfoResolver> on the <xref:StreamJsonRpc.SystemTextJsonFormatter.JsonSerializerOptions?displayProperty=nameWithType> property to the Default property on your class that derives from <xref:System.Text.Json.Serialization.JsonSerializerContext>.
SystemTextJsonFormatter has JsonSerializerOptions
Holds
Read Oct 22
Use <xref:StreamJsonRpc.JsonRpc.AddLocalRpcTarget(StreamJsonRpc.RpcTargetMetadata,System.Object,StreamJsonRpc.JsonRpcTargetOptions)?displayProperty=nameWithType> to add RPC target objects rather than other overloads.
JsonRpc depends on RpcTargetMetadata, and JsonRpc depends on JsonRpcTargetOptions
Holds
Read Oct 22
When using named parameters (e.g. <xref:StreamJsonRpc.JsonRpc.NotifyWithParameterObjectAsync*> or <xref:StreamJsonRpc.JsonRpc.InvokeWithParameterObjectAsync*>), call the overloads that accept <xref:StreamJsonRpc.NamedArgs>.
JsonRpc depends on NamedArgs
Holds
Read Oct 22
These proxies can be created using either the static <xref:StreamJsonRpc.JsonRpc.Attach1(System.IO.Stream)> method or the instance <xref:StreamJsonRpc.JsonRpc.Attach1> method (or their overloads).
JsonRpc has an Attach method
Holds
Read Oct 22
@StreamJsonRpc.JsonRpc always invokes local methods by posting to its <xref:System.Threading.SynchronizationContext>.
JsonRpc uses SynchronizationContext
Holds
Read Oct 22
This ordering comes by setting the <xref:StreamJsonRpc.JsonRpc.SynchronizationContext> property to a <xref:System.Threading.SynchronizationContext> that preserves order of calls dispatched with <xref:System.Threading.SynchronizationContext.Post*>.
JsonRpc has SynchronizationContext
Holds
Read Oct 22
This can be accomplished by deriving from the @StreamJsonRpc.JsonRpc class and overriding its <xref:StreamJsonRpc.JsonRpc.IsFatalException*> method such that it returns true for some subset of exceptions.
JsonRpc has an IsFatalException method
Holds
Read Oct 22
Listening is started either by calling the static @StreamJsonRpc.JsonRpc.Attach* method or via a call to @StreamJsonRpc.JsonRpc.StartListening instance method.
2 rules from this sentence
JsonRpc has an Attach method
checks “calling the static @StreamJsonRpc.JsonRpc.Attach* method”
Holds
JsonRpc has a StartListening method
checks “via a call to @StreamJsonRpc.JsonRpc.StartListening instance method”
Holds
Read Oct 22
Instead of using positional arguments as shown in the example above, we might instead use named arguments by using @StreamJsonRpc.JsonRpc.InvokeWithParameterObjectAsync*.
JsonRpc has InvokeWithParameterObjectAsync
Holds
Read Oct 22
This strategy utilizes the <xref:System.Diagnostics.CorrelationManager> and <xref:System.Diagnostics.TraceSource> APIs to track activities.
The tracestate property on an outbound request is set to the value of <xref:StreamJsonRpc.CorrelationManagerTracingStrategy.TraceState?displayProperty=nameWithType>.
CorrelationManagerTracingStrategy has TraceState
Holds
Read Oct 22
The full list of events is available on the <xref:StreamJsonRpc.JsonRpc.TraceEvents?displayProperty=nameWithType> enum.
TraceEvents is an enumeration
Holds
Read Oct 22
The most convenient way to do this is with the JsonRpcEnumerableSettings.Prefetch property:
JsonRpcEnumerableSettings has Prefetch
Holds
45 rules from 12 docs
See these where the change is. The browser extension puts a pull request's doc findings, and a diagram of what it changed, on the GitHub page itself, so the code and what your docs say about it are side by side.