TinyDispatcher 1.1.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package TinyDispatcher --version 1.1.0
                    
NuGet\Install-Package TinyDispatcher -Version 1.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="TinyDispatcher" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TinyDispatcher" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="TinyDispatcher" />
                    
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 TinyDispatcher --version 1.1.0
                    
#r "nuget: TinyDispatcher, 1.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 TinyDispatcher@1.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=TinyDispatcher&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=TinyDispatcher&version=1.1.0
                    
Install as a Cake Tool

TinyDispatcher

TinyDispatcher is a small, compile-time oriented dispatcher for .NET.

It provides a predictable, explicit, and performant command/query dispatch core by moving:

  • handler discovery to build time
  • middleware pipeline composition to generated code (also build time)

...while keeping runtime execution simple and scope-friendly.

What you get

  • Compile-time handler discovery (no runtime scanning/reflection)
  • Generated pipelines (global middleware → policy middleware → per-command middleware → handler)
  • Deterministic ordering and precedence rules (predictable output)
  • Explicit context (TContext) for command handlers
  • Multi-assembly composition with host-owned final pipeline generation
  • Pluggable context factory (pass a delegate or register IContextFactory<TContext>)
  • Feature-friendly AppContext (optional IFeatureInitializer-based composition)
  • Source-generator diagnostics for invalid shapes/config (fail fast, no guessing)

Install

dotnet add package TinyDispatcher

Quick start

Define a command:

public sealed record CreateOrder(string OrderId) : ICommand;

Define a context-aware handler:

public sealed class CreateOrderHandler : ICommandHandler<CreateOrder, AppContext>
{
    public Task HandleAsync(CreateOrder command, AppContext ctx, CancellationToken ct = default)
        => Task.CompletedTask;
}

Register:

services.UseTinyDispatcher<AppContext>(tiny =>
{
    // optional: middleware, policies, features
});

Dispatch:

await dispatcher.DispatchAsync(new CreateOrder("123"), ct);

Multi-assembly composition

TinyDispatcher supports a modular setup where:

  • handlers can live in referenced class libraries
  • middleware and policies can also live outside the host assembly
  • contributing assemblies publish structured compile-time metadata
  • the host remains the sole final composer of pipelines

This keeps the runtime simple while letting the generator build final pipelines for the full command universe visible to the host.

Documentation

When to use

TinyDispatcher is a good fit when you want:

  • explicit execution flow you can read and debug
  • deterministic middleware precedence
  • compile-time discovery (no runtime scanning)
  • a small, focused dispatch core rather than a full framework
  • aot friendly.
  • microservices, minimal Api and Azure functions.

Test Coverage & Hardening

TinyDispatcher includes a comprehensive automated test suite covering both the runtime dispatcher and the Roslyn source generator.

Current coverage (March 2026):

Component Line Coverage Branch Coverage
Overall ~89% ~76%
Runtime (TinyDispatcher) ~84% ~68%
Source Generator (TinyDispatcher.SourceGen) ~90% ~77%

Critical runtime infrastructure is fully covered, including:

  • AppContext
  • FeatureCollection
  • DefaultAppContextFactory
  • ServiceCollectionExtensions
  • TinyBootstrap
  • PipelineContributionStore

These components form the core execution and configuration model of TinyDispatcher.

Hardening Sessions

Leading up after the first stable release, the project is undergoing a short series of hardening sessions focused on strengthening runtime guarantees and improving branch coverage.

These sessions concentrate on:

  • improving branch coverage for the dispatcher execution paths
  • validating middleware and policy registration behavior
  • verifying cancellation propagation through the dispatcher pipeline
  • testing error scenarios and diagnostics generated by the source generator
  • increasing coverage for generator validation paths

All tests focus on observable behavior rather than internal implementation details, ensuring the dispatcher can evolve safely without breaking public guarantees.

The goal is to keep TinyDispatcher:

  • predictable
  • explicit
  • well-tested
  • safe to evolve

Samples

The repository contains runnable samples under samples/, including:

  • ASP.NET and custom context setups
  • context factory and closed-context middleware examples
  • a multi-project sample showing cross-assembly handler and pipeline composition
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.2.0-alpha.1 53 5/18/2026
1.1.0 128 5/18/2026
1.1.0-rc3 98 5/8/2026
1.1.0-rc2 87 4/30/2026
1.1.0-rc1 98 4/23/2026
1.0.4 113 2/27/2026
1.0.3 110 2/26/2026
1.0.2 114 2/24/2026
1.0.0 109 2/22/2026
0.1.103-alpha-g6d84474285 103 2/18/2026
0.1.95-alpha-g1af6552045 97 2/17/2026
0.1.92-alpha-g79c3d573d0 107 2/17/2026
0.1.75-alpha-gedad2aaa3d 105 2/14/2026
0.1.74-alpha-g62dc7240c6 102 2/14/2026
0.1.72-alpha-g7b6aee462b 104 2/14/2026
0.1.62-alpha-gee4b863caa 101 2/13/2026
0.1.58-alpha-g074b6009d7 102 2/11/2026
0.1.53-alpha-g68bf9bd71f 127 2/9/2026
0.1.28-alpha-g81295fddf9 112 2/5/2026
0.1.21-alpha-ge2922c0023 111 2/4/2026
Loading failed

TinyDispatcher 1.1.0

     Added
     - Multi-assembly composition support with structured assembly contributions.
     - Host-side pipeline generation for commands contributed by referenced assemblies.
     - Assembly-level contribution attributes for compile-time cross-assembly composition.

     Changed
     - Generated ModuleInitializers now publish ThisAssemblyContribution.Create().
     - DispatcherPipelineBootstrap stores structured contribution snapshots while preserving DI application behavior.
     - Source generator validation now reports referenced assembly conflicts with clearer provenance.

     Fixed
     - Referenced assemblies can now contribute global middleware to host-generated pipelines.
     - Non-host projects skip redundant referenced contribution validation.