Excalibur.Dispatch.Serialization.MemoryPack 10.0.0-alpha.10

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

Excalibur.Dispatch.Serialization.MemoryPack

High-performance MemoryPack binary serialization for Excalibur framework.

Purpose

Provides opt-in high-performance binary serialization for:

  • Maximum throughput scenarios
  • .NET-to-.NET communication
  • Internal persistence (Outbox, Inbox, Event Store)
  • AOT/NativeAOT deployment

Key Features

  • Opt-In: JSON (System.Text.Json) is the default serializer. Install this package and register explicitly when you need maximum .NET performance.
  • Serializer ID 1: Magic byte 0x01 in persisted payloads
  • Zero-Allocation: ReadOnlySpan-based deserialization
  • AOT-Compatible: Full NativeAOT and trimming support via source generation
  • No consumer attributes needed: Consumer event types do NOT need [MemoryPackable]. Only the internal envelope wrapper uses MemoryPack attributes.

Usage

Registration

One call does everything -- DI registration, serializer registry entry, and setting MemoryPack as the current serializer:

services.AddMemoryPackSerializer();

That is all you need. JSON is the default serializer; calling AddMemoryPackSerializer() opts you into MemoryPack for high-performance binary serialization.

Performance Characteristics

Metric Value Notes
Serialization ~150ns/1KB Fastest .NET binary format
Deserialization ~120ns/1KB Zero-allocation span slicing
Payload Size Smallest Optimal binary encoding
Memory Pressure Minimal No GC allocations in hot path

Pluggable Serialization Integration

MemoryPack is assigned Serializer ID 1 in the pluggable serialization system. The magic byte 0x01 prefixes all MemoryPack-serialized payloads.

Stored Payload: [0x01][MemoryPack binary data...]
                  ^
                  Magic byte identifies serializer

When to Use MemoryPack

Best For:

  • Internal .NET-to-.NET communication
  • Maximum performance requirements
  • Event sourcing and Outbox persistence
  • AOT/NativeAOT deployments

Consider Alternatives When:

  • Cross-language consumers (use MessagePack - ID: 3)
  • Debugging/human-readable storage (use System.Text.Json - ID: 2, the default)
  • Schema-based contracts (use Protobuf - ID: 4)

Migration

From JSON to MemoryPack

// One call switches new messages to MemoryPack.
// Old JSON data remains readable via its magic byte.
services.AddMemoryPackSerializer();

From MemoryPack to Another Serializer

// Switch to a different serializer. Old MemoryPack data remains
// readable because the magic byte tells the system which deserializer to use.
services.AddMessagePackSerializer();

Package Dependencies

  • MemoryPack - Core MemoryPack serialization runtime
  • Excalibur.Dispatch.Abstractions - Core contracts

AOT Compatibility

Full NativeAOT support with source-generated serializers.

The internal envelope types use [MemoryPackable] with partial class declarations for source generation. Consumer event types do not need any attributes.

See Also

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 (6)

Showing the top 5 NuGet packages that depend on Excalibur.Dispatch.Serialization.MemoryPack:

Package Downloads
Excalibur.Data.MongoDB

MongoDB database provider implementation for Excalibur data access layer. PRE-RELEASE: the public API is not frozen and may change between pre-release builds. Not recommended for production use. Known issues: https://docs.excalibur-dispatch.dev/docs/known-issues

Excalibur.EventSourcing.SqlServer

SQL Server implementations for Excalibur event sourcing, including event store, snapshot store, and outbox store. PRE-RELEASE: the public API is not frozen and may change between pre-release builds. Not recommended for production use. Known issues: https://docs.excalibur-dispatch.dev/docs/known-issues

Excalibur.EventSourcing.Postgres

Postgres implementations for Excalibur event sourcing, including event store, snapshot store, and outbox store. PRE-RELEASE: the public API is not frozen and may change between pre-release builds. Not recommended for production use. Known issues: https://docs.excalibur-dispatch.dev/docs/known-issues

Excalibur.Data.Postgres

Postgres database provider implementation for Excalibur data access layer. PRE-RELEASE: the public API is not frozen and may change between pre-release builds. Not recommended for production use. Known issues: https://docs.excalibur-dispatch.dev/docs/known-issues

Excalibur.EventSourcing.Sqlite

SQLite implementations for Excalibur event sourcing. Lightweight event store and snapshot store for local development, testing, and embedded scenarios. Zero Docker dependency. PRE-RELEASE: the public API is not frozen and may change between pre-release builds. Not recommended for production use. Known issues: https://docs.excalibur-dispatch.dev/docs/known-issues

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.0-alpha.10 0 9/6/2026
10.0.0-alpha.9 123 8/31/2026
10.0.0-alpha.8 148 8/14/2026
10.0.0-alpha.7 153 8/13/2026
10.0.0-alpha.6 153 8/11/2026
10.0.0-alpha.5 150 8/10/2026
10.0.0-alpha.4 138 8/10/2026
3.0.0-alpha.216 154 6/30/2026
3.0.0-alpha.215 149 6/23/2026
3.0.0-alpha.214 156 6/23/2026
3.0.0-alpha.208 151 6/11/2026
3.0.0-alpha.207 152 6/11/2026
3.0.0-alpha.205 150 6/10/2026
3.0.0-alpha.204 150 6/8/2026
3.0.0-alpha.203 149 6/8/2026
3.0.0-alpha.202 152 6/8/2026
3.0.0-alpha.201 147 6/8/2026
3.0.0-alpha.199 153 6/8/2026
3.0.0-alpha.198 137 5/28/2026
3.0.0-alpha.197 156 5/28/2026
Loading failed