Repository navigation
fix: make ReactiveUserControl and ReactiveWindow trim and AOT safe; build without runtime-async - #221
Merged
Merged
Conversation
glennawatson
marked this pull request as draft
October 3, 2026 04:58
glennawatson
force-pushed
the
fix/aot-safe-reactive-controls
branch
3 times, most recently
from
October 3, 2026 10:38
57fcccc to
34a7893
Compare
glennawatson
marked this pull request as ready for review
October 3, 2026 10:38
glennawatson
force-pushed
the
fix/aot-safe-reactive-controls
branch
from
October 3, 2026 10:58
34a7893 to
a6c96a1
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #221 +/- ##
==========================================
+ Coverage 98.31% 99.42% +1.10%
==========================================
Files 51 54 +3
Lines 1010 1042 +32
Branches 110 114 +4
==========================================
+ Hits 993 1036 +43
+ Misses 13 3 -10
+ Partials 4 3 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Forward view model activation with the view's ViewModelProperty observable, not reflection. - Remove RequiresUnreferencedCode from the reactive control and window constructors. - Turn on IsAotCompatible for ReactiveUI.Avalonia and ReactiveUI.Avalonia.Reactive. - Mark the ViewRegistrar Activator fallback as RequiresUnreferencedCode, as its callers already are. - Add a test for swapping the view model while the control is shown. - Build the .NET 11 assemblies without runtime-async. Mono does not support it, so it breaks Avalonia browser, Android and iOS apps. - Split the example into a shared library with Desktop, Browser, Android and iOS heads. - Test the example's desktop, browser and no-storage paths. - Install workloads in CI and run tests through ReactiveUI.Avalonia.Tests.slnf. - Update ReactiveUI to 26.0.0, ReactiveUI.Binding to 9.0.0 and TUnit to 1.72.16.
glennawatson
force-pushed
the
fix/aot-safe-reactive-controls
branch
from
October 3, 2026 12:14
a6c96a1 to
f879d84
Compare
|
glennawatson
enabled auto-merge (squash)
October 3, 2026 13:26
glennawatson
disabled auto-merge
October 3, 2026 13:51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
ReactiveUserControlandReactiveWindoware now trim and AOT safe. The .NET 11 build no longer uses runtime-async, and the example runs on every Avalonia platform.[RequiresUnreferencedCode]. They pass the view'sViewModelPropertyobservable to ReactiveUI's reflection-freeWhenActivatedoverload.ReactiveUI.AvaloniaandReactiveUI.Avalonia.Reactiveare now marked AOT compatible, so the trim and AOT analyzers check them.ViewRegistrarActivator fallback gains the[RequiresUnreferencedCode]that its callers already carry.$(AvaloniaVersion).ReactiveUI.Avalonia.Tests.slnf, because the solution now contains app heads.Why
Every view that derived from
ReactiveUserControlorReactiveWindowproduced trim warnings under Native AOT, because activation found the view model by reflection. Separately, Avalonia's browser, Android and iOS apps run on Mono, where a runtime-async build can fail.Breaking changes
None. The constructors lose an attribute, and the public API is otherwise unchanged. This ships as a patch release to keep in step with Avalonia's version numbers.
How this was verified
New tests cover swapping the view model while a control is shown, and the example's desktop, single-view, browser and no-storage paths. The iOS head was compiled for
net10.0-ioson a host with the iOS workload. The Browser, Android and iOS apps were not run in a browser, emulator or simulator.Notes for the reviewer
Start with
ViewModelPropertySync.ForwardActivationand the two base constructors. The example split, the platform heads and the public API baseline changes are mostly mechanical. The iOS head builds its iOS target only whenBuildAppleHeadis true, which defaults to macOS hosts. CI and SonarCloud test only the test projects, becausedotnet testasks the app heads for a device.Checklist