ZeroAlloc.Notify
1.3.0
See the version list below for details.
dotnet add package ZeroAlloc.Notify --version 1.3.0
NuGet\Install-Package ZeroAlloc.Notify -Version 1.3.0
<PackageReference Include="ZeroAlloc.Notify" Version="1.3.0" />
<PackageVersion Include="ZeroAlloc.Notify" Version="1.3.0" />
<PackageReference Include="ZeroAlloc.Notify" />
paket add ZeroAlloc.Notify --version 1.3.0
#r "nuget: ZeroAlloc.Notify, 1.3.0"
#:package ZeroAlloc.Notify@1.3.0
#addin nuget:?package=ZeroAlloc.Notify&version=1.3.0
#tool nuget:?package=ZeroAlloc.Notify&version=1.3.0
ZeroAlloc.Notify
Source-generated, awaitable INotifyPropertyChanged for .NET: await vm.SetNameAsync("Alice") returns only after every async handler has finished, with no reflection and NativeAOT support.
Why ZeroAlloc.Notify
- Setters you can
await. Async validation, saving or coordinated state changes complete before the setter returns. CommunityToolkit.Mvvm and PropertyChanged.Fody only offer synchronous notifications. - 0 B when nobody listens. The generated setter creates event args only when there are subscribers; tests assert 0 B for reference-type and value-type properties. With subscribers, a change costs its args object, 40 B, plus a box per value-type value; tests pin both figures.
- Works under NativeAOT and trimming. All plumbing is generated at compile time; CI publishes and runs a NativeAOT sample on every build.
- Compile-time diagnostics. A class that is not
partial, a record, or a stray[ObservableProperty]is reported by the build, not discovered at runtime.
Install
dotnet add package ZeroAlloc.Notify
The source generator ships inside the package.
Quick start
using ZeroAlloc.Notify;
var user = new UserViewModel();
user.PropertyChangedAsync += async (args, ct) =>
{
await Task.Delay(100, ct); // e.g. save to a server
Console.WriteLine($"{args.PropertyName}: {args.OldValue} -> {args.NewValue}, saved");
};
await user.SetNameAsync("Alice"); // returns after the handler has saved
await user.SetAgeAsync(30);
[NotifyPropertyChangedAsync]
public partial class UserViewModel
{
[ObservableProperty] private string _name = "";
[ObservableProperty] private int _age;
}
The generator writes the Name and Age properties, the SetNameAsync and SetAgeAsync setters and the PropertyChangedAsync event.
What you get
- Async property notifications, before and after a change:
[NotifyPropertyChangedAsync]and[NotifyPropertyChangingAsync]. Observable properties - Async collection notifications with
[NotifyCollectionChangedAsync]. Collection changes - Async validation through
INotifyDataErrorInfoAsync. Validation - Parallel handlers by default, sequential on request with
[InvokeSequentially], and aCancellationTokenon every setter. Async notifications - Build-time checks, ZAN001 to ZAN006. Diagnostics
- Targets
netstandard2.0,net8.0,net10.0andnet11.0. - Built on ZeroAlloc.AsyncEvents, the async event primitive behind every handler.
Performance
One property change with five handlers attached, .NET 10, all four libraries in one BenchmarkDotNet run. Allocations are exact; the ratio is each library's time against a hand-written INotifyPropertyChanged in the same run. Absolute timings are not published.
| Library | Ratio | Allocated | Async handlers |
|---|---|---|---|
Manual INotifyPropertyChanged |
1.00 | 24 B | no |
| PropertyChanged.Fody | 0.93 | 0 B | no |
| CommunityToolkit.Mvvm | 1.81 | 0 B | no |
| ZeroAlloc.Notify | 1.47 | 40 B | yes |
Awaitable handlers have a cost: Notify is slower than hand-written code and Fody, and allocates its args object when someone listens. For purely synchronous view models, Fody is the faster choice. The .NET 8 ratios are in the performance doc. Allocation breakdown, design notes and full numbers: docs/performance.md.
Learn more
- Documentation: notify.zeroalloc.net
- Runnable example:
samples/ZeroAlloc.Notify.AotSmoke, published with NativeAOT in CI - Related packages: ZeroAlloc.AsyncEvents and the rest of the ZeroAlloc family
- Contributing: issues and pull requests are welcome on GitHub
- 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 is compatible. 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 is compatible. 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. net11.0 is compatible. |
| .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 (>= 1.1.12)
-
net10.0
- ZeroAlloc.AsyncEvents (>= 1.1.12)
-
net11.0
- ZeroAlloc.AsyncEvents (>= 1.1.12)
-
net8.0
- ZeroAlloc.AsyncEvents (>= 1.1.12)
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 |
|---|---|---|
| 2.0.2 | 87 | 11/23/2026 |
| 2.0.1 | 140 | 11/22/2026 |
| 2.0.0 | 121 | 11/22/2026 |
| 1.3.1 | 133 | 11/17/2026 |
| 1.3.0 | 158 | 11/11/2026 |
| 1.2.14 | 167 | 10/22/2026 |
| 1.2.13 | 155 | 10/16/2026 |
| 1.2.12 | 120 | 10/15/2026 |
| 1.2.11 | 120 | 10/12/2026 |
| 1.2.10 | 106 | 10/11/2026 |
| 1.2.9 | 138 | 9/30/2026 |
| 1.2.8 | 120 | 9/28/2026 |
| 1.2.7 | 174 | 9/20/2026 |
| 1.2.6 | 127 | 9/20/2026 |
| 1.2.5 | 126 | 9/20/2026 |
| 1.2.4 | 135 | 9/19/2026 |
| 1.2.3 | 274 | 8/7/2026 |
| 1.2.2 | 271 | 5/13/2026 |
| 1.2.1 | 147 | 5/12/2026 |
| 1.2.0 | 148 | 5/3/2026 |