Conversation
Upgrades Avalonia from 11.3.x to 12.0.1 across Core/Desktop/Browser/iOS/Android. Migrates off deprecated Avalonia.ReactiveUI to ReactiveUI core with a custom AvaloniaDispatcherScheduler shim. Bumps iOS/Android target frameworks to net10 and rewrites the Android entry point for the new AvaloniaAndroidApplication model. Also drops v12-incompatible APIs (DataAnnotations plugin, clipboard text helpers, attachDevTools parameter) and removes the unused CommunityToolkit.Mvvm reference.
|
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
Upgrades Avalonia from 11.3.x to 12.0.1 across all six Avalonia projects (Core library + Desktop/Browser/iOS/Android apps).
Priority per the upgrade plan: Desktop and Browser must run; iOS and Android only need to compile.
Package changes
Avalonia.*packages →12.0.1(includingAvalonia.Skia,Avalonia.Android,Avalonia.iOS,Avalonia.Browser).3.119.3-preview.1.1line (Avalonia 12 Skia requires it).Avalonia.Diagnostics(no 12.x release yet — temporarily removes Ctrl+F12 DevTools in Debug desktop builds).Avalonia.ReactiveUI(deprecated for v12) and replaced it with theReactiveUIcore package (not deprecated, actively maintained).CommunityToolkit.Mvvmreference.ReactiveUI migration
Avalonia.ReactiveUI's only real contribution in this codebase was registeringAvaloniaSchedulerasRxApp.MainThreadSchedulervia.UseReactiveUI(). It's replaced with:AvaloniaDispatcherSchedulershim (~30 lines, posts toDispatcher.UIThread).RxAppBuilder.CreateReactiveUIBuilder()...BuildApp()inApp.OnFrameworkInitializationCompleted. (ReactiveUI 23 no longer auto-initializes — first use ofReactiveObjectthrowsTypeInitializationExceptionwithout this.)RxApp.MainThreadScheduler→RxSchedulers.MainThreadScheduler(theRxAppclass was split intoRxSchedulers/RxStatein ReactiveUI 23)..csprojadds<TrimmerRootAssembly Include="ReactiveUI" />— the WASM AOT trimmer otherwise stripsRxSchedulers/RxAppBuilderand the app throwsTypeLoadExceptionat load time.All existing
ReactiveObject/RaiseAndSetIfChanged/ReactiveCommand/ObservableAsPropertyHelperusage is unchanged.v12 breaking-change fixes
App.axaml.cs: removed theDisableAvaloniaDataAnnotationValidationmethod and its call — the data-annotations binding plugin was removed in v12 (compiled bindings are now the default).C64MenuView.axaml.cs: migrated clipboard fromGetTextAsync/SetTextAsyncto the newIAsyncDataTransfer/DataTransferItemAPI.OverlayDialogHelper.cs:GetVisualRoot()→TopLevel.GetTopLevel(...)(the visual-tree helper extension is gone).MainWindow.axaml.cs: removedInitializeComponent(attachDevTools: false)— the parameter was removed in v12.MainActivity.cs: rewritten for the v12 model — non-genericAvaloniaMainActivity+ a newAvaloniaAndroidApplication<App>subclass hostingCustomizeAppBuilder..csprojtarget frameworks:net9.0-ios/net9.0-android→net10.0-ios/net10.0-android(Avalonia 12 mobile requires .NET 10).Test plan
Known follow-ups
Avalonia.Diagnostics(DevTools) once a 12.x release is published — marker comment left inCore.csproj.SkiaSharp.NativeAssets.*are pinned to a prerelease; bump to stable when one compatible with Avalonia 12 ships.TrimmerRootAssembly Include="ReactiveUI"in the Browser project preserves ~150KB of ReactiveUI IL from trimming. If WASM payload size becomes a concern, this is the first thing to revisit.