![]() |
VOOZH | about |
dotnet add package ZeroAlloc.Pipeline --version 1.2.1
NuGet\Install-Package ZeroAlloc.Pipeline -Version 1.2.1
<PackageReference Include="ZeroAlloc.Pipeline" Version="1.2.1" />
<PackageVersion Include="ZeroAlloc.Pipeline" Version="1.2.1" />Directory.Packages.props
<PackageReference Include="ZeroAlloc.Pipeline" />Project file
paket add ZeroAlloc.Pipeline --version 1.2.1
#r "nuget: ZeroAlloc.Pipeline, 1.2.1"
#:package ZeroAlloc.Pipeline@1.2.1
#addin nuget:?package=ZeroAlloc.Pipeline&version=1.2.1Install as a Cake Addin
#tool nuget:?package=ZeroAlloc.Pipeline&version=1.2.1Install as a Cake Tool
👁 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.
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" />
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.
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
IPipelineBehavior — marker interface; no contract imposed on Handle signaturePipelineBehaviorAttribute — Order (execution position) and AppliesTo (type scoping)PipelineBehaviorDiscoverer and FromAttributeSyntaxContext for incremental generatorsPipelineEmitter.EmitChain generates a nested static lambda chain from a behavior list and a PipelineShapePipelineShape — describes type arguments, parameter names, and the innermost body; supports a factory delegate when the body embeds depth-indexed lambda namesPipelineDiagnosticRules.FindMissingHandleMethod and FindDuplicateOrders return offending behaviors; the caller maps them to framework-specific diagnostic IDs| 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 |
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. |
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. |
This package is not used by any popular GitHub repositories.