VOOZH about

URL: https://www.nuget.org/packages/ZeroAlloc.Pipeline/

⇱ NuGet Gallery | ZeroAlloc.Pipeline 1.2.1




👁 Image
ZeroAlloc.Pipeline 1.2.1

dotnet add package ZeroAlloc.Pipeline --version 1.2.1
 
 
NuGet\Install-Package ZeroAlloc.Pipeline -Version 1.2.1
 
 
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="ZeroAlloc.Pipeline" Version="1.2.1" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZeroAlloc.Pipeline" Version="1.2.1" />
 
Directory.Packages.props
<PackageReference Include="ZeroAlloc.Pipeline" />
 
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 ZeroAlloc.Pipeline --version 1.2.1
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ZeroAlloc.Pipeline, 1.2.1"
 
 
#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 ZeroAlloc.Pipeline@1.2.1
 
 
#: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=ZeroAlloc.Pipeline&version=1.2.1
 
Install as a Cake Addin
#tool nuget:?package=ZeroAlloc.Pipeline&version=1.2.1
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

ZeroAlloc.Pipeline

👁 NuGet
👁 Build
👁 AOT
👁 GitHub Sponsors

ZeroAlloc.Pipeline is the shared building block for pipeline-aware source generators in the ZeroAlloc ecosystem. It provides the IPipelineBehavior marker interface, PipelineBehaviorAttribute, and the Roslyn-based discovery, validation, and code-emission utilities that generators like ZeroAlloc.Mediator and ZeroAlloc.Validation build on. All pipeline wiring is resolved at compile time — no reflection, no virtual dispatch, no heap allocation per call.

Multiple packages in this family — see Documentation or NuGet for the full list.

Install

dotnet add package ZeroAlloc.Pipeline
dotnet add package ZeroAlloc.Pipeline.Generators
<PackageReference Include="ZeroAlloc.Pipeline" Version="*" />
<PackageReference Include="ZeroAlloc.Pipeline.Generators" Version="*"
 OutputItemType="Analyzer"
 ReferenceOutputAssembly="false" />

Example

using ZeroAlloc.Pipeline;

// 1. Implement IPipelineBehavior and decorate with [PipelineBehavior]
[PipelineBehavior(Order = 1)]
public class LoggingBehavior : IPipelineBehavior
{
 // 2. Expose a public static Handle method matching the host framework's delegate shape
 public static async ValueTask<TResponse> Handle<TRequest, TResponse>(
 TRequest request,
 CancellationToken ct,
 Func<TRequest, CancellationToken, ValueTask<TResponse>> next)
 {
 Console.WriteLine($"Handling {typeof(TRequest).Name}");
 var response = await next(request, ct);
 Console.WriteLine($"Handled {typeof(TRequest).Name}");
 return response;
 }
}

// 3. The host generator (e.g. ZeroAlloc.Mediator) picks this up at compile time
// and wires it into the generated pipeline — no registration required.

Performance

ZeroAlloc.Pipeline emits static nested lambda chains. Static lambdas carry no closure allocation, and the JIT inlines static call chains aggressively — collapsing N behaviors into straight-line code.

1 behavior 3 behaviors 5 behaviors Allocated
Static chain 4.1 ns 2.3 ns 2.8 ns 0 B
Pre-built delegate chain 2.2 ns 9.9 ns 17.6 ns 0 B
Speedup 0.5× 4.3× 6.4×

BenchmarkDotNet v0.15.8, .NET 10.0.4, 12th Gen Intel Core i9-12900HK — tests/ZeroAlloc.Pipeline.Benchmarks

Features

  • IPipelineBehavior — marker interface; no contract imposed on Handle signature
  • PipelineBehaviorAttributeOrder (execution position) and AppliesTo (type scoping)
  • Attribute subclassing — framework packages define their own alias; discovery follows the inheritance chain
  • Compile-time discoveryPipelineBehaviorDiscoverer and FromAttributeSyntaxContext for incremental generators
  • Static emitterPipelineEmitter.EmitChain generates a nested static lambda chain from a behavior list and a PipelineShape
  • PipelineShape — describes type arguments, parameter names, and the innermost body; supports a factory delegate when the body embeds depth-indexed lambda names
  • Diagnostic helpersPipelineDiagnosticRules.FindMissingHandleMethod and FindDuplicateOrders return offending behaviors; the caller maps them to framework-specific diagnostic IDs
  • Zero allocation — no reflection, no boxing, no delegate list per call
  • netstandard2.0 + Native AOT — works in trimmed, ahead-of-time compiled applications

Documentation

Page Description
Getting Started Write your first behavior and see it get picked up
Pipeline Behaviors IPipelineBehavior, PipelineBehaviorAttribute, ordering, scoping
Pipeline Shape Describe the delegate shape for code generation
Pipeline Emitter Generate a nested static lambda call chain
Pipeline Discoverer Discover behaviors at compile time
Diagnostics ZAP001, ZAP002 diagnostic rules reference
Performance Why static lambda chains allocate nothing
Testing Test behaviors and generators built on this library

License

MIT

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 was computed. 
.NET Framework net461 net461 was computed.  net462 net462 was computed.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on ZeroAlloc.Pipeline:

Package Downloads
ZeroAlloc.Mediator

A zero-allocation mediator library for .NET. Roslyn source generator wires all dispatch at compile time — no reflection, no dictionaries, no virtual dispatch.

ZeroAlloc.Resilience

Source-generated, zero-allocation resilience policies for .NET. Add [Retry], [Timeout], [RateLimit], and [CircuitBreaker] to an interface; the generator emits a proxy composing all policies in declaration order. AOT-safe.

ZeroAlloc.Validation

A zero-allocation validation library for .NET. Roslyn source generator wires all rule evaluation at compile time — no reflection, no boxing, no runtime overhead.

ZeroAlloc.Pipeline.Generators

Roslyn helper library for generator authors — pipeline behavior discovery and emission.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.1 140 5/12/2026
1.2.0 3,894 5/3/2026
1.1.0 142 5/1/2026
1.0.1 133 4/29/2026
1.0.0 142 4/28/2026
0.1.6 3,251 4/20/2026
0.1.5 154 3/22/2026
0.1.4 145 3/20/2026
0.1.3 148 3/19/2026
0.1.2 149 3/17/2026
0.1.1 10,817 3/17/2026