ViShap.Viper
1.0.0
Prefix Reserved
See the version list below for details.
dotnet add package ViShap.Viper --version 1.0.0
NuGet\Install-Package ViShap.Viper -Version 1.0.0
<PackageReference Include="ViShap.Viper" Version="1.0.0" />
<PackageVersion Include="ViShap.Viper" Version="1.0.0" />
<PackageReference Include="ViShap.Viper" />
paket add ViShap.Viper --version 1.0.0
#r "nuget: ViShap.Viper, 1.0.0"
#:package ViShap.Viper@1.0.0
#addin nuget:?package=ViShap.Viper&version=1.0.0
#tool nuget:?package=ViShap.Viper&version=1.0.0
ViShap.Viper
A binary serializer for .NET 10. Viper writes objects as self-describing frames, reads them from memory, streams and pipes, and can compress, checksum and encrypt a frame. It is built to read bytes it does not trust: every declared length, count and nesting level is bounded before anything is allocated for it, and every failure is an exception from one hierarchy.
This is the meta-package. It ships no code of its own; it references the three packages that do:
| Package | Contains |
|---|---|
ViShap.Viper.Core |
the attributes, the algorithm and key contracts, the exception hierarchy |
ViShap.Viper.Serialization |
the serializer, its options and limits, the built-in algorithms and key providers, the diagnostics |
ViShap.Viper.Generator |
the build-time source generator of type contracts; it runs in the compiler and ships nothing with your application |
dotnet add package ViShap.Viper
Getting started
using ViShap.Viper;
var serializer = new BinarySerializer();
var order = new Order
{
Id = 1001,
Customer = "Ada Lovelace",
Lines = [new OrderLine { Sku = "ANL-1", Quantity = 2 }]
};
byte[] bytes = serializer.Serialize(order);
Order? copy = serializer.Deserialize<Order>(bytes);
Console.WriteLine(copy!.Lines[0].Sku);
public sealed class Order
{
public int Id { get; set; }
public string Customer { get; set; } = "";
public List<OrderLine> Lines { get; set; } = [];
}
public sealed class OrderLine
{
public string Sku { get; set; } = "";
public int Quantity { get; set; }
}
Serialize returns one frame: a header that records the format version and any compression, checksum and
encryption, followed by the payload. Deserialize reads all of that from the bytes.
What it offers
- Buffers, streams and pipes.
byte[],IBufferWriter<byte>, pooled payloads,ReadOnlySpan<byte>,ReadOnlySequence<byte>,StreamandSystem.IO.Pipelines, with asynchronous methods,Populateinto an existing object, and a stream of frames. - Explicit layouts. Positional by default; keyed contracts with
[BinaryContract]and[BinaryKey(n)]so a type can evolve without breaking stored data. - Declared polymorphism.
[BinaryUnion(tag, typeof(Derived))]; only tags travel, never type names. - Shared and cyclic references with
PreserveReferences(). - Data protection. Deflate and Brotli compression, CRC-32 and XXH3 checksums, AES-256-GCM and
ChaCha20-Poly1305 encryption with an authenticated header, key providers with key ids, and
RequireEncryptionandRequireChecksumpolicies. - Two formats. V1, the self-describing frame, and V0, the headerless payload for protocols that already frame their messages.
- Limits. Bounds on depth, sizes, cumulative budgets and the size of every phase, checked before the memory they protect is allocated.
- Diagnostics.
BinaryFormatInspectorreads a header;BinaryFormatDumperrenders a frame as a tree and points at the value that failed.
Documentation
- Getting started
- Entry points
- Options and limits
- Formats: V1 and V0
- Contracts and schema evolution
- Algorithms and keys
- Exceptions
- All pages
The public API is documented in XML that ships beside the assemblies. Viper is released under the MIT License.
| Product | Versions 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. |
-
net10.0
- ViShap.Viper.Core (>= 1.0.0)
- ViShap.Viper.Generator (>= 1.0.0)
- ViShap.Viper.Serialization (>= 1.0.0)
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 |
|---|---|---|
| 1.1.0-rc.1 | 54 | 11/17/2026 |
| 1.0.4 | 95 | 11/16/2026 |
| 1.0.3 | 92 | 11/16/2026 |
| 1.0.2 | 95 | 11/13/2026 |
| 1.0.1 | 110 | 10/27/2026 |
| 1.0.0 | 99 | 10/26/2026 |
| 1.0.0-rc.2 | 63 | 10/26/2026 |
| 1.0.0-rc.1 | 76 | 9/29/2026 |