Skip to content

Add AOT-first ProMvvm WhenAnyValue parity through arity 12 - #1

Merged
wieslawsoltes merged 24 commits into
mainfrom
agent/add-promvvm-whenanyvalue-runtime
Aug 19, 2026
Merged

wieslawsoltes merged 24 commits into
mainfrom
agent/add-promvvm-whenanyvalue-runtime

Conversation

@wieslawsoltes

@wieslawsoltes wieslawsoltes commented Aug 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

Build the first production-ready ProMvvm WhenAnyValue slice: a .NET 10-first, dependency-free property-observation runtime with AOT-safe typed APIs and a ReactiveUI-compatible migration surface.

  • Add typed, expression, and direct string selector/tuple overloads through arity 12.
  • Match ReactiveUI 24 multi-selector semantics: distinct inputs, unsuppressed equal projected results, with explicit expression comparers opting into result filtering.
  • Generate fixed-arity typed sinks without update-time arrays or boxing and avoid retaining an unused last result.
  • Generate terse, reusable property descriptors for ordinary, CommunityToolkit.Mvvm, and ReactiveUI.SourceGenerators properties.
  • Add explicit custom-event and observable notification adapters without a registry or service locator.
  • Add typed and expression samples for both ReactiveUI 24 and CommunityToolkit.Mvvm.
  • Specialize one-, two-, and three-link paths and structurally cache member/indexer expression shapes.
  • Add ReactiveUI-compatible constant indexers, Item[]/custom indexer notification names, nested rewiring, array-length support, and matching captured/array error behavior.
  • Validate both ReactiveUI core and ReactiveUI.Reactive 24.0.0 separately.
  • Expand concurrency, trimming, NativeAOT, packaging, architecture, and benchmark coverage.

Design and compatibility

The runtime package has no ReactiveUI, CommunityToolkit.Mvvm, or System.Reactive dependency. Typed getters and generated/reusable PropertyPath descriptors use normal closed generic code, delegates, and notification subscriptions, so they remain trim-safe and NativeAOT-safe. Expression and runtime string-name overloads are explicitly marked RequiresUnreferencedCode for migration use.

Direct indexers with int, string, and (int,int) arguments bind typed delegates. Other constant signatures use .NET 10 MethodInvoker, with fixed-argument calls through arity four and a span fallback above that. A value-type structural cache key preserves constant value/type or object-identity semantics, and the atomic last-entry path compares constants before allocating copied arguments.

Two- and three-link expressions reuse compact subscription engines; four-or-more-link paths use the general watcher graph. All variants retain synchronous initial delivery, nested suffix rewiring, null rules, deterministic disposal, serialized notifications, and error termination.

Performance

BenchmarkDotNet 0.15.8, .NET 10.0.5, Apple M3 Pro; ReactiveUI and ReactiveUI.Reactive 24.0.0. Each result is mean time / managed allocation.

Scenario ProMvvm typed ProMvvm expression ReactiveUI core ReactiveUI.Reactive
Direct hot start 45.194 ns / 232 B 244.856 ns / 792 B 362.789 ns / 1,440 B 373.471 ns / 1,440 B
Direct emission 8.413 ns / 24 B 10.261 ns / 24 B 27.458 ns / 88 B 27.490 ns / 88 B
Direct indexer hot start 42.857 ns / 232 B 257.366 ns / 888 B 464.584 ns / 1,736 B 461.893 ns / 1,736 B
Direct indexer emission 9.499 ns / 24 B 11.416 ns / 24 B 31.944 ns / 88 B 32.085 ns / 88 B
Nested indexer hot start 64.265 ns / 352 B 430.202 ns / 1,424 B 767.082 ns / 2,456 B 778.810 ns / 2,456 B
Nested indexer emission 8.914 ns / 24 B 17.420 ns / 48 B 33.388 ns / 88 B 33.098 ns / 88 B
Nested indexer rewire 18.861 ns / 24 B 30.728 ns / 48 B 120.223 ns / 376 B 114.236 ns / 376 B
Arity-12 update 206.7 ns / 24 B 226.9 ns / 24 B 552.3 ns / 792 B 553.8 ns / 792 B

Structural pre-allocation lookup plus typed indexer delegates reduced direct expression hot start from 281.131 ns / 976 B to 257.366 ns / 888 B and emission from 17.843 ns / 48 B to 11.416 ns / 24 B. The isolated getter benchmark measured PropertyInfo.GetValue at 9.371 ns / 24 B, cached-argument MethodInvoker at 5.845 ns / 24 B, and a bound delegate at 0.257 ns / 0 B.

The full matrix and measurement rules are in benchmarks/README.md.

Validation

  • Release solution build: 0 warnings, 0 errors
  • Runtime tests: 114/114 pass
  • Runtime coverage: 100% line, 99.79% branch, 100% method
  • Source-generator tests: 2/2 pass
  • ReactiveUI.Reactive integration tests: 8/8 pass
  • ReactiveUI core integration tests: 3/3 pass
  • All four typed/expression framework samples execute successfully
  • 108 BenchmarkDotNet cases discovered; focused optimization runs completed
  • Full-trim smoke publish and execution pass locally on osx-arm64
  • NativeAOT smoke and both typed framework sample publishes/executions pass locally on osx-arm64
  • NuGet and symbol package creation passes
  • GitHub CI: 10/10 jobs pass across Linux, Windows, and macOS verification, full trimming, NativeAOT, and framework NativeAOT samples

Latest commit structure

  • 8a18e6f — match ReactiveUI multi-selector semantics
  • 297f61f — optimize constant-indexer expression paths and cover their behavior
  • ebe7b3b — validate both ReactiveUI 24 distributions
  • 2ea172b — add the direct/nested indexer benchmark matrix
  • 51993f8 — document the architecture, compatibility, and results
  • 9af9789 — normalize generator source assertions across LF and CRLF platforms

@wieslawsoltes wieslawsoltes changed the title Add AOT-first ProMvvm property observation runtime Add AOT-first ProMvvm observation through arity 12 Aug 18, 2026
@wieslawsoltes wieslawsoltes changed the title Add AOT-first ProMvvm observation through arity 12 Add AOT-first ProMvvm WhenAnyValue parity through arity 12 Aug 18, 2026
@wieslawsoltes
wieslawsoltes marked this pull request as ready for review August 19, 2026 07:58
@wieslawsoltes
wieslawsoltes merged commit cfbee46 into main Aug 19, 2026
10 checks passed
@wieslawsoltes
wieslawsoltes deleted the agent/add-promvvm-whenanyvalue-runtime branch August 19, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant