ZeroAlloc.Notify 1.2.2

dotnet add package ZeroAlloc.Notify --version 1.2.2
                    
NuGet\Install-Package ZeroAlloc.Notify -Version 1.2.2
                    
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.Notify" Version="1.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZeroAlloc.Notify" Version="1.2.2" />
                    
Directory.Packages.props
<PackageReference Include="ZeroAlloc.Notify" />
                    
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.Notify --version 1.2.2
                    
#r "nuget: ZeroAlloc.Notify, 1.2.2"
                    
#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.Notify@1.2.2
                    
#: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.Notify&version=1.2.2
                    
Install as a Cake Addin
#tool nuget:?package=ZeroAlloc.Notify&version=1.2.2
                    
Install as a Cake Tool

ZeroAlloc.Notify

NuGet Build License: MIT AOT GitHub Sponsors

ZeroAlloc.Notify is a source-generated notification library for .NET 8 and .NET 10. It provides async-first property and collection change notifications without reflection or dynamic dispatch. The Roslyn source generator eliminates runtime overhead by wiring all dispatch at compile time — no virtual dispatch, fully awaitable handlers.

Install

The source generator is bundled into the main package — a single PackageReference is all you need:

dotnet add package ZeroAlloc.Notify

The standalone ZeroAlloc.Notify.Generator package is still published for backwards compatibility with existing direct PackageReferences, but new consumers should reference only ZeroAlloc.Notify.

Quick Example

// 1. Define a ViewModel with observable properties
[NotifyPropertyChangedAsync]
public partial class UserViewModel
{
    [ObservableProperty]
    private string _name = "";

    [ObservableProperty]
    private int _age;
}

// 2. Subscribe to async notifications
var vm = new UserViewModel();
vm.PropertyChangedAsync += async (args, ct) =>
{
    Console.WriteLine($"Property '{args.PropertyName}' changed from {args.OldValue} to {args.NewValue}");
    await Task.Delay(100, ct); // Non-blocking handler execution
};

// 3. Set properties — fully awaitable
await vm.SetNameAsync("Alice");
await vm.SetAgeAsync(30);

Performance

ZeroAlloc.Notify provides async-first, fully awaitable handler dispatch — the only framework in this comparison where await vm.SetNameAsync(...) truly awaits all handlers. Refreshed benchmarks (.NET 10.0.7, i9-12900HK, BenchmarkDotNet v0.15.8, 5 attached handlers):

Library Time Allocated Async support
Manual INotifyPropertyChanged (baseline) 33.6 ns 24 B
PropertyChanged.Fody 30.2 ns 0 B
CommunityToolkit.Mvvm 55.2 ns 0 B
ZeroAlloc.Notify 124.7 ns 80 B

Honest framing: ZA.Notify is the slowest of the four and the only one that allocates — the 80 B is the ValueTask state machine for fan-out to async handlers. For pure-sync view models, Fody is the right choice (fastest, 0 B). ZA.Notify is the only library here that supports async handlers; the trade-off is the cost of that capability. At 124.7 ns / 80 B per setter, it still scales to ~8M property changes per second per thread.

See docs/performance.md for detailed benchmark results and zero-allocation design explanation.

Features

  • Property Notifications — Strongly-typed, fully async PropertyChangedAsync events
  • Collection ChangesCollectionChangedAsync with observable property support
  • Data ValidationINotifyDataErrorInfoAsync for async error collection
  • Sequential & Parallel[InvokeSequentially] attribute for handler ordering
  • Compiler Diagnostics — Missing handlers and misconfigurations caught at build time
  • Async-First — Fully awaitable ValueTask handlers; no fire-and-forget, no callbacks
  • Native AOT Compatible — No reflection at runtime; all dispatch resolved at compile time
  • Source Generated — Full type safety with compile-time verification

Documentation

Topic Description
Getting Started Install and send your first notification in five minutes
Observable Properties Defining and using observable properties
Async Notifications Property and collection changed notifications with await support
Collection Changes Observable collections with async event dispatch
Validation INotifyDataErrorInfoAsync with async error handling
Performance Zero-alloc internals, detailed benchmarks, Native AOT
Diagnostics ZAN001–ZAN010 source generator warnings and errors
Advanced Patterns Cancellation, scoped bindings, parallel handlers
Testing Unit-testing observable models and notification flows

Examples

See the samples directory for complete working examples:

  • WPF MVVM application
  • ASP.NET Core data binding
  • Console property notifications
  • Collection change handling

License

MIT

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.2 97 5/13/2026
1.2.1 101 5/12/2026
1.2.0 108 5/3/2026
1.1.1 103 5/2/2026
1.1.0 91 5/1/2026
1.0.1 101 4/16/2026
1.0.0 117 4/1/2026
0.1.0 111 3/27/2026