SbeSourceGenerator 1.1.3
See the version list below for details.
dotnet add package SbeSourceGenerator --version 1.1.3
NuGet\Install-Package SbeSourceGenerator -Version 1.1.3
<PackageReference Include="SbeSourceGenerator" Version="1.1.3"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="SbeSourceGenerator" Version="1.1.3" />
<PackageReference Include="SbeSourceGenerator"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add SbeSourceGenerator --version 1.1.3
#r "nuget: SbeSourceGenerator, 1.1.3"
#:package SbeSourceGenerator@1.1.3
#addin nuget:?package=SbeSourceGenerator&version=1.1.3
#tool nuget:?package=SbeSourceGenerator&version=1.1.3
SBE Source Generator
A Roslyn incremental source generator that converts FIX Simple Binary Encoding (SBE) XML schemas into high-performance, zero-allocation C# structs. Ideal for real-time market data, trading systems, and any latency-sensitive binary protocol.
Getting Started
Install the package:
dotnet add package SbeSourceGeneratorAdd your SBE schema files as
AdditionalFiles:<ItemGroup> <AdditionalFiles Include="Schemas\*.xml" /> </ItemGroup>Build. Generated code is available at compile time — no runtime reflection, no code-behind files.
Quick Example
// Decode (with groups and varData) — zero-copy via MessageDataReader
if (OrderData.TryParse(buffer, out var reader))
{
Console.WriteLine($"Order {reader.Data.OrderId} @ {reader.Data.Price}");
reader.ReadGroups(/* group/varData callbacks */);
}
// Encode (simple message — no groups)
OrderData order = default;
order.OrderId = 42;
order.Price = 100_00;
order.TryEncode(buffer, out int bytesWritten);
// Encode (with groups)
OrderBookData.TryEncode(orderBook, buffer, bids, asks, out int bytesWritten);
Features
- Zero-copy blittable structs —
[StructLayout(Explicit)]with[FieldOffset], directly overlay on buffers TryParse/TryEncode— safe decode/encode with zero-copyMessageDataReaderand group/varData support- Zero-copy decode —
TryReadBlock<T>andReadBlockRef<T>read directly from spans indelegate callbacks — group iteration passes structs by readonly reference (no copies)- Schema evolution —
TryReadBlockhandlesblockLengthmismatches (forward/backward compat) - Big-endian support — automatic byte swapping for big-endian schemas
- Enums, sets, composites — full SBE type system with optional field support
- Nested groups — recursive group generation to any depth
- SpanReader / SpanWriter — embedded sequential binary reader/writer (no manual offset tracking)
- Cross-schema coexistence — multiple schemas generate isolated namespaces, no conflicts
- AOT / trimming compatible — no reflection, no dynamic code generation
- Roslyn diagnostics —
SBE001–SBE014for schema validation at build time
Requirements
- .NET 6.0+ for consumer projects (generator itself targets netstandard2.0)
- SBE XML schema using the FIX SBE 1.0 namespace (
http://fixprotocol.io/2016/sbe)
Performance
All generated code targets zero allocations on hot paths:
- Structs are stack-allocated value types
readonlyproperty getters prevent defensive copies throughin/ref readonly- Group callbacks use
indelegates — no boxing, no struct copies - SpanReader/SpanWriter are
ref structwith[MethodImpl(AggressiveInlining)]
Documentation
Full documentation at github.com/pedrosakuma/SbeSourceGenerator:
Contributing
Issues and pull requests are welcome at github.com/pedrosakuma/SbeSourceGenerator.
License
Distributed under the MIT License. See LICENSE.txt for details.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SbeSourceGenerator:
| Package | Downloads |
|---|---|
|
B3.EntryPoint.Sbe
Source-generated SBE codecs for the B3 EntryPoint (FIXP 8.4.2) wire protocol. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.6.1 | 3,506 | 4/30/2026 |
| 1.6.0 | 107 | 4/29/2026 |
| 1.5.0 | 123 | 4/25/2026 |
| 1.4.0 | 90 | 4/25/2026 |
| 1.3.0 | 106 | 4/25/2026 |
| 1.2.1 | 95 | 4/25/2026 |
| 1.2.0 | 92 | 4/25/2026 |
| 1.1.4 | 242 | 4/15/2026 |
| 1.1.3 | 98 | 4/15/2026 |
| 1.1.2 | 112 | 4/15/2026 |
| 1.1.1 | 91 | 4/15/2026 |
| 1.1.0 | 93 | 4/15/2026 |
| 1.0.2 | 244 | 4/10/2026 |
| 1.0.1 | 99 | 4/10/2026 |
| 1.0.0 | 96 | 4/10/2026 |
| 0.9.1 | 94 | 4/10/2026 |
| 0.9.0 | 93 | 4/10/2026 |
| 0.8.0 | 96 | 4/10/2026 |
| 0.7.0 | 97 | 4/9/2026 |
| 0.5.0 | 98 | 4/9/2026 |