FixSourceGenerator 0.1.0

dotnet add package FixSourceGenerator --version 0.1.0
                    
NuGet\Install-Package FixSourceGenerator -Version 0.1.0
                    
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="FixSourceGenerator" Version="0.1.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FixSourceGenerator" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="FixSourceGenerator">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 FixSourceGenerator --version 0.1.0
                    
#r "nuget: FixSourceGenerator, 0.1.0"
                    
#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 FixSourceGenerator@0.1.0
                    
#: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=FixSourceGenerator&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=FixSourceGenerator&version=0.1.0
                    
Install as a Cake Tool

FIX Source Generator

A Roslyn-based source generator that converts FIX tag=value DataDictionary XML schemas (the classic QuickFIX/QuickFIX-J/QuickFIX-n format) into allocation-minimal C# reader/writer types, in the spirit of SbeSourceGenerator but for the tag=value wire format instead of Simple Binary Encoding.

See docs/CONTRACT.md for the full design contract (input schema shape, C# output shape, type mapping, versioning, diagnostics) and docs/USAGE.md for a getting-started guide, a worked example, and the schema-versioning guide. The tracking issue #1 has the overall roadmap.

Design highlights

  • Allocation-minimal by default. The generated API is a pair of ref struct reader/writer types over Span<byte> / ReadOnlySpan<byte> (analogous to System.Text.Json.Utf8JsonReader/ Utf8JsonWriter), not heap-allocated DTOs. Strings are exposed as spans by default and only materialize a string when the consumer explicitly asks for one.
  • Repeating groups without materialization, matching the same principle used by SbeSourceGenerator: groups are exposed via foreach-style enumerators over the underlying buffer, not List<T>.
  • Decode and encode. The generator emits both a reader (parses a buffer into typed field access) and a writer (writes fields directly into a caller-supplied buffer, computing BodyLength/CheckSum via backpatch).
  • Schema-driven, zero-lookup groups. Group delimiter tags are known at compile time from the schema and embedded as constants in the generated code — no runtime dictionary lookup is needed to find group boundaries.
  • Namespace-isolated versioning, so multiple FIX dictionary versions (e.g. 4.2 and 4.4) can coexist in the same consumer project.

Quick start

  1. Reference the package and add your DataDictionary XML as an AdditionalFiles item:

    <ItemGroup>
      <PackageReference Include="FixSourceGenerator" Version="0.1.0" PrivateAssets="all" />
      <AdditionalFiles Include="Schemas\FIX44.xml" />
    </ItemGroup>
    
  2. Build. The generator produces a reader/writer per message in a namespace derived from your project's RootNamespace (or the FixGeneratorNamespace property) plus a version token, e.g. Acme.Fix.V44.NewOrderSingleReader / ...NewOrderSingleWriter.

  3. Decode:

    using Acme.Fix.V44;
    
    var reader = new NewOrderSingleReader(buffer); // ReadOnlySpan<byte>
    string clOrdId = Encoding.ASCII.GetString(reader.ClOrdID);
    decimal? price = reader.Price;      // T? for optional value fields
    foreach (var alloc in reader.NoAllocs)   // groups are enumerated, never materialized
    {
        decimal qty = alloc.AllocQty;
    }
    
  4. Encode:

    Span<byte> destination = stackalloc byte[512];
    var writer = new NewOrderSingleWriter(destination);
    writer.WriteClOrdID("ORD-1"u8);
    writer.WriteSide(Side.Buy);
    writer.WriteOrderQty(100m);
    int length = writer.Finish(); // backpatches BodyLength + CheckSum
    

See docs/USAGE.md for the full worked example (including components and nested groups) and guidance on versioning schemas over time.

Repository layout

  • src/FixSourceGenerator — the Roslyn incremental source generator (netstandard2.0).
    • Schema/ — the parsed/resolved schema model (SchemaReader + FixDictionary and friends).
    • Generators/ — codegen for readers, writers, enums, components, and the embedded runtime.
    • Diff/SchemaDiffer, for comparing two dictionary versions and flagging breaking changes.
  • tests/FixSourceGenerator.Tests — unit, generator-driver, and real-schema conformance tests.
  • docs/CONTRACT.md — the normative design contract for input schema and generated output.
  • docs/USAGE.md — getting-started guide, worked example, and schema-versioning guide.
  • CHANGELOG.md — release history.

License

MIT — see LICENSE.txt.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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
0.1.0 77 8/27/2026