BareWire.Serialization.MsgPack 2.0.4

dotnet add package BareWire.Serialization.MsgPack --version 2.0.4
                    
NuGet\Install-Package BareWire.Serialization.MsgPack -Version 2.0.4
                    
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="BareWire.Serialization.MsgPack" Version="2.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BareWire.Serialization.MsgPack" Version="2.0.4" />
                    
Directory.Packages.props
<PackageReference Include="BareWire.Serialization.MsgPack" />
                    
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 BareWire.Serialization.MsgPack --version 2.0.4
                    
#r "nuget: BareWire.Serialization.MsgPack, 2.0.4"
                    
#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 BareWire.Serialization.MsgPack@2.0.4
                    
#: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=BareWire.Serialization.MsgPack&version=2.0.4
                    
Install as a Cake Addin
#tool nuget:?package=BareWire.Serialization.MsgPack&version=2.0.4
                    
Install as a Cake Tool

BareWire.Serialization.MsgPack

Zero-copy MessagePack serializer and deserializer for BareWire. Backed by MessagePack-CSharp with the ContractlessStandardResolver and an UntrustedData security profile.

Installation

dotnet add package BareWire.Serialization.MsgPack

Usage

Serializer only (publish path)

// Registers IMessageSerializer + IMessageDeserializer + concrete MessagePackDeserializer
services.AddBareWireMessagePackSerializer();

With Content-Type routing (consume path)

To route inbound messages whose Content-Type is application/x-msgpack to the MessagePack deserializer, register the routing decorator after the base JSON deserializer resolver:

// 1. Register the base IDeserializerResolver (raw-JSON, ADR-001)
services.AddBareWireJsonSerializer();

// 2. Optionally register the MsgPack serializer for the publish path
services.AddBareWireMessagePackSerializer();

// 3. Activate Content-Type routing — decorates the existing IDeserializerResolver
services.AddBareWireMessagePackDeserializerRouting();

Registration order matters. AddBareWireMessagePackDeserializerRouting() must be called after AddBareWireJsonSerializer() (or any other method that registers an IDeserializerResolver). Calling it first throws InvalidOperationException.

Per-endpoint override

To force all messages on a specific endpoint to use MessagePack regardless of Content-Type:

wire.ReceiveEndpoint("my-queue", ep =>
{
    ep.UseDeserializer<MessagePackDeserializer>();
    ep.Consumer<MyConsumer, MyMessage>();
});

This requires AddBareWireMessagePackSerializer() to be registered (the concrete type must be resolvable from DI).

Features

  • Zero-copy serialization via IBufferWriter<byte> (ADR-003)
  • Zero-copy deserialization via ReadOnlySequence<byte> including multi-segment sequences
  • Content-Type routing: application/x-msgpackMessagePackDeserializer (fail-closed exact-match — parameterised variants such as application/x-msgpack; charset=utf-8 fall through to raw-JSON)
  • UntrustedData security profile: SipHash seed, recursion-depth limit, no Typeless/LZ4 (ADR-013)
  • Raw-first default preserved: unregistered or null Content-Type falls back to raw-JSON (ADR-001)
  • Idempotent registration: calling AddBareWireMessagePackDeserializerRouting() multiple times is safe

Note: Message types used with MessagePack must be public. The ContractlessStandardResolver generates formatters only for public types at runtime.

Documentation

Full documentation: barewire.wizardsoftware.pl

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on BareWire.Serialization.MsgPack:

Package Downloads
BareWire.Benchmarks

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.4 142 6/29/2026
2.0.3 123 6/28/2026
2.0.2 116 6/28/2026
2.0.1 120 6/28/2026
2.0.0 130 6/27/2026
1.5.1 131 6/23/2026
1.4.0 132 6/18/2026