ZeroAlloc.Notify
0.1.0
dotnet add package ZeroAlloc.Notify --version 0.1.0
NuGet\Install-Package ZeroAlloc.Notify -Version 0.1.0
<PackageReference Include="ZeroAlloc.Notify" Version="0.1.0" />
<PackageVersion Include="ZeroAlloc.Notify" Version="0.1.0" />
<PackageReference Include="ZeroAlloc.Notify" />
paket add ZeroAlloc.Notify --version 0.1.0
#r "nuget: ZeroAlloc.Notify, 0.1.0"
#:package ZeroAlloc.Notify@0.1.0
#addin nuget:?package=ZeroAlloc.Notify&version=0.1.0
#tool nuget:?package=ZeroAlloc.Notify&version=0.1.0
ZeroAlloc.Notify
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
dotnet add package ZeroAlloc.Notify
The generator package must also be added as an analyzer:
<ItemGroup>
<PackageReference Include="ZeroAlloc.Notify.Generator" Version="*" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
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. The async path runs at competitive speed with modest allocation (.NET 10, i9-12900HK, BenchmarkDotNet).
| Method | Mean | Alloc | vs Baseline |
|---|---|---|---|
Sync_INotifyPropertyChanged (baseline) |
21.41 ns | 24 B | — |
CommunityToolkit_SetName |
31.27 ns | 0 B | 1.47x slower |
Fody_SetName |
17.57 ns | 0 B | 1.22x faster |
ZeroAlloc_SetNameAsync |
61.84 ns | 48 B | 2.9x slower baseline, fully awaitable |
CommunityToolkit.Mvvm and PropertyChanged.Fody support sync notifications only — they cannot await async handlers. ZeroAlloc.Notify is the only framework in this comparison with first-class
ValueTaskhandler dispatch.
See docs/performance.md for detailed benchmark results and zero-allocation design explanation.
Features
- Property Notifications — Strongly-typed, fully async
PropertyChangedAsyncevents - Collection Changes —
CollectionChangedAsyncwith observable property support - Data Validation —
INotifyDataErrorInfoAsyncfor async error collection - Sequential & Parallel —
[InvokeSequentially]attribute for handler ordering - Compiler Diagnostics — Missing handlers and misconfigurations caught at build time
- Async-First — Fully awaitable
ValueTaskhandlers; 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 | Versions 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. |
-
.NETStandard 2.0
- ZeroAlloc.AsyncEvents (>= 0.2.1)
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 | 39 | 3/27/2026 |