Nerdbank.JsonRpc 0.2.48-alpha

Prefix Reserved
This is a prerelease version of Nerdbank.JsonRpc.
dotnet add package Nerdbank.JsonRpc --version 0.2.48-alpha
                    
NuGet\Install-Package Nerdbank.JsonRpc -Version 0.2.48-alpha
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Nerdbank.JsonRpc" Version="0.2.48-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nerdbank.JsonRpc" Version="0.2.48-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Nerdbank.JsonRpc" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Nerdbank.JsonRpc --version 0.2.48-alpha
                    
#r "nuget: Nerdbank.JsonRpc, 0.2.48-alpha"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Nerdbank.JsonRpc@0.2.48-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Nerdbank.JsonRpc&version=0.2.48-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Nerdbank.JsonRpc&version=0.2.48-alpha&prerelease
                    
Install as a Cake Tool

Nerdbank.JsonRpc

Nerdbank.JsonRpc is a NativeAOT-safe .NET library for building strongly typed JSON-RPC clients and servers over MessagePack or UTF-8 JSON.

Features

  • Strongly typed RPC: Register local targets and issue typed requests or notifications.
  • Generated client proxies: A built-in source generator creates interface-backed proxies with positional or named arguments.
  • MessagePack or JSON: MessagePack (default, length-header or self-delimiting framing) or UTF-8 JSON (newline-delimited or Content-Length framing).
  • Peer-to-peer: One connection can both expose local methods and invoke remote ones.
  • Batching: Send independent requests and notifications in one JSON-RPC payload.
  • Cancellation and robust error handling: Propagates cancellation and distinguishes malformed protocol messages from application failures.
  • Ordered dispatch: Inbound requests start in the order sent, while running concurrently.
  • Deadlock mitigation: Propagates JoinableTaskFactory context across processes, compatible with StreamJsonRpc.
  • Exotic types: Marshal interfaces, observers, progress, streams, and async sequences by reference.

Quick start

Define a contract shared by both parties:

using Nerdbank.JsonRpc;
using PolyType;

[GenerateJsonRpcProxy]
[GenerateShape(IncludeMethods = MethodShapeFlags.PublicInstance)]
public partial interface ICalculator
{
    ValueTask<int> AddAsync(int a, int b, CancellationToken cancellationToken);
}

public class Calculator : ICalculator
{
    public ValueTask<int> AddAsync(int a, int b, CancellationToken cancellationToken) => new(a + b);
}

Connect over any bidirectional stream, expose a local target, and call the remote party through a proxy:

using Nerdbank.Streams;

using JsonRpc rpc = new(new JsonRpcMessagePackChannel(stream.UsePipe()));

// Expose a local target the remote party can call.
rpc.AddRpcTarget<ICalculator>(new Calculator());
rpc.Start();

// Invoke a method on the remote party.
ICalculator remote = rpc.Attach<ICalculator>();
int sum = await remote.AddAsync(1, 2, CancellationToken.None);

Learn more

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.48-alpha 70 10/23/2026
0.2.33-alpha 59 10/22/2026
0.2.19-alpha 60 10/17/2026
0.2.1-alpha 82 10/4/2026
0.1.1171-alpha 69 9/29/2026