Microsoft.Orleans.Serialization
10.4.0
Prefix Reserved
dotnet add package Microsoft.Orleans.Serialization --version 10.4.0
NuGet\Install-Package Microsoft.Orleans.Serialization -Version 10.4.0
<PackageReference Include="Microsoft.Orleans.Serialization" Version="10.4.0" />
<PackageVersion Include="Microsoft.Orleans.Serialization" Version="10.4.0" />
<PackageReference Include="Microsoft.Orleans.Serialization" />
paket add Microsoft.Orleans.Serialization --version 10.4.0
#r "nuget: Microsoft.Orleans.Serialization, 10.4.0"
#:package Microsoft.Orleans.Serialization@10.4.0
#addin nuget:?package=Microsoft.Orleans.Serialization&version=10.4.0
#tool nuget:?package=Microsoft.Orleans.Serialization&version=10.4.0
Microsoft Orleans Serialization
Introduction
Microsoft Orleans Serialization is a fast, flexible, and version-tolerant serializer for .NET. It provides the core serialization capabilities for Orleans, enabling efficient serialization and deserialization of data across the network and for storage.
Getting Started
To use this package, install it via NuGet:
dotnet add package Microsoft.Orleans.Serialization
This package is automatically included when you reference the Orleans SDK or the Orleans client/server metapackages.
Example
// Creating a serializer
var services = new ServiceCollection();
services.AddSerializer();
var serviceProvider = services.BuildServiceProvider();
var serializer = serviceProvider.GetRequiredService<Serializer>();
// Serializing an object
var bytes = serializer.SerializeToArray(myObject);
// Deserializing an object
var deserializedObject = serializer.Deserialize<MyType>(bytes);
Supporting your own Types
To make your types serializable in Orleans, mark them with the [GenerateSerializer] attribute and mark each field/property which should be serialized with the [Id(int)] attribute:
[GenerateSerializer]
public class MyClass
{
[Id(0)]
public string Name { get; set; }
[Id(1)]
public int Value { get; set; }
}
When fail-closed type validation is enabled, additional types can be allowed by configuring TypeManifestOptions.AddAllowedType or TypeManifestOptions.AddAllowedAssembly.
Generated serializers and copiers for C# payloads use ref-returning
UnsafeAccessor methods to read and restore private fields, readonly fields,
and auto-property backing fields on supported targets. Non-generic C# payloads
use this access on .NET 8 and later; generic C# payloads use it on .NET 9 and
later, with the payload's generic constraints preserved. Struct receivers are
passed by reference. This allows NativeAOT-compiled generated code for C#
payloads to restore get-only and init-only properties and to deep-copy values
stored in readonly fields.
Generated C# codecs and copiers emit one ref-returning accessor per field for both reading and writing on supported targets.
The generator selects these capabilities from the SDK's target-framework
identifier and version and verifies that UnsafeAccessorAttribute is available
in the compilation references.
For C# payloads, legacy targets and .NET 8 generic payloads use generated
field-access delegates. Setting OrleansHotReload=true retains lazily
initialized delegates for fields, so existing serializer and copier instances
can access members added by hot reload.
Volatile fields use ref-returning accessors on .NET 10 and later. Earlier targets restore private volatile fields through generated delegates, preserving compatibility with runtimes affected by volatile-field signature matching.
F# record and union field restoration uses the existing generated-delegate strategy on JIT-enabled runtimes.
NativeAOT applications also need statically available codecs, copiers, and activators for their closed payload types.
Documentation
For more comprehensive documentation, please refer to:
Feedback & Contributing
- If you have any issues or would like to provide feedback, please open an issue on GitHub
- Join our community on Discord
- Follow the @msftorleans Twitter account for Orleans announcements
- Contributions are welcome! Please review our contribution guidelines
- This project is licensed under the MIT license
| Product | Versions 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 was computed. 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 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.CodeAnalysis.Analyzers (>= 5.9.0)
- Microsoft.CodeAnalysis.Common (>= 4.5.0)
- Microsoft.CodeAnalysis.Workspaces.Common (>= 4.5.0)
- Microsoft.DotNet.PlatformAbstractions (>= 3.1.6)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.DependencyModel (>= 8.0.2)
- Microsoft.Extensions.ObjectPool (>= 8.0.24)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Orleans.Serialization.Abstractions (>= 10.4.0)
- System.Collections.Immutable (>= 8.0.0)
- System.IO.Hashing (>= 10.0.3)
- System.IO.Pipelines (>= 8.0.0)
- System.Text.Json (>= 8.0.5)
-
net10.0
- Microsoft.CodeAnalysis.Analyzers (>= 5.9.0)
- Microsoft.CodeAnalysis.Common (>= 5.0.0)
- Microsoft.CodeAnalysis.Workspaces.Common (>= 5.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.DependencyModel (>= 10.0.5)
- Microsoft.Extensions.ObjectPool (>= 10.0.5)
- Microsoft.Extensions.Options (>= 10.0.5)
- Microsoft.Orleans.Serialization.Abstractions (>= 10.4.0)
- System.IO.Hashing (>= 10.0.3)
-
net8.0
- Microsoft.CodeAnalysis.Analyzers (>= 5.9.0)
- Microsoft.CodeAnalysis.Common (>= 4.5.0)
- Microsoft.CodeAnalysis.Workspaces.Common (>= 4.5.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.DependencyModel (>= 8.0.2)
- Microsoft.Extensions.ObjectPool (>= 8.0.24)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Orleans.Serialization.Abstractions (>= 10.4.0)
- System.IO.Hashing (>= 10.0.3)
- System.IO.Pipelines (>= 8.0.0)
NuGet packages (34)
Showing the top 5 NuGet packages that depend on Microsoft.Orleans.Serialization:
| Package | Downloads |
|---|---|
|
Microsoft.Orleans.Core.Abstractions
Core abstractions library of Microsoft Orleans |
|
|
Microsoft.Orleans.Serialization.SystemTextJson
System.Text.Json integration for Orleans.Serialization |
|
|
Microsoft.Orleans.Serialization.NewtonsoftJson
Newtonsoft.Json integration for Orleans.Serialization |
|
|
Microsoft.Orleans.Serialization.Protobuf
Google.Protobuf integration for Orleans.Serialization |
|
|
Microsoft.Orleans.Journaling
Extensible persistence for grains based on replicated states, including a default System.Text.Json journal format. |
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on Microsoft.Orleans.Serialization:
| Repository | Stars |
|---|---|
|
Cysharp/MemoryPack
Zero encoding extreme performance binary serializer for C# and Unity.
|
|
|
J-Tech-Japan/Sekiban
Sekiban - an Opinionated Event Sourcing and CQRS Framework using C#. It can store data into Azure Cosmos DB, AWS Dynamo DB or Postgres
|
|
|
Cysharp/NativeCompressions
NativeCompressions is the native binding and high-level API of ZStandard, LZ4 and OpenZL compression library for .NET and Unity.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 10.4.0 | 3,562 | 10/3/2026 |
| 10.3.1 | 201,335 | 8/28/2026 |
| 10.3.0 | 8,072 | 8/27/2026 |
| 10.3.0-rc.1 | 730 | 8/25/2026 |
| 10.2.2 | 249,927 | 7/21/2026 |
| 10.2.2-rc.2 | 5,068 | 7/15/2026 |
| 10.2.2-rc.1 | 405 | 7/10/2026 |
| 10.2.1 | 212,252 | 6/24/2026 |
| 10.2.1-preview.1 | 610 | 6/19/2026 |
| 10.2.0 | 75,668 | 6/12/2026 |
| 10.1.1-preview.1 | 1,080 | 5/13/2026 |
| 10.1.0 | 576,854 | 4/14/2026 |
| 10.0.1 | 910,023 | 2/7/2026 |
| 10.0.0 | 170,167 | 1/20/2026 |
| 10.0.0-rc.2 | 13,916 | 12/31/2025 |
| 9.2.1 | 1,265,507 | 7/16/2025 |
| 9.2.0 | 25,760 | 7/14/2025 |
| 9.2.0-preview3 | 11,452 | 6/10/2025 |
| 9.2.0-preview2 | 1,616 | 6/4/2025 |
| 9.2.0-preview1 | 38,753 | 4/4/2025 |