feat: bump TodoApp.Avalonia sample from Avalonia 11 to 12 (12.1.0)#571
Merged
Conversation
added 2 commits
July 11, 2026 12:15
Bumps the shared AvaloniaVersion property (Directory.Build.props) from 11.3.18 to 12.1.0 and updates the sample for Avalonia 12's breaking changes: - Avalonia.Diagnostics package removed in v12: drop the Debug-only PackageReference from TodoApp.Avalonia and TodoApp.Avalonia.Desktop (no AttachDevTools() call exists in the sample). - Binding plugins removed in v12: drop the BindingPlugins.DataValidators.RemoveAt(0) call and its Avalonia.Data.Core* usings from App.axaml.cs; behavior is preserved since v12 disables the data-annotations validation plugin by default. - Android now implements IActivityApplicationLifetime instead of ISingleViewApplicationLifetime: add a MainViewFactory branch before the existing ISingleViewApplicationLifetime check (still required for iOS/browser/embedded Linux) in App.axaml.cs. - Android app initialization reworked: add TodoApp.Avalonia.Android/Application.cs (AvaloniaAndroidApplication<App> with the [Application] attribute, hosting the CustomizeAppBuilder override moved from MainActivity), change MainActivity to the non-generic AvaloniaMainActivity (CreateAppBuilder/CustomizeAppBuilder were removed from the generic base class), and wire up android:name=".Application" in AndroidManifest.xml. - Rename TextBox.Watermark to the non-obsolete PlaceholderText in MainView.axaml. - Drop the now-stale BindingPlugins.DataValidators mention from the SuppressTrimAnalysisWarnings comment in the Android/iOS csproj files (EF Core's DbContext(DbContextOptions) ctor remains the relevant trim-analyzer noise source). The TodoApp.Avalonia.iOS AppDelegate requires no changes: its CustomizeAppBuilder override was not removed for iOS in Avalonia 12. Verified locally: dotnet build succeeds (Debug and Release) for the shared TodoApp.Avalonia and TodoApp.Avalonia.Desktop projects. The Android and iOS heads require their respective mobile workloads, which are validated via the build-samples.yml CI workflow rather than locally. Fixes CommunityToolkit#507
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
Bumps the
TodoApp.Avaloniasample from Avalonia 11 to 12.1.0 (the latest release at time of implementation) for general currency, since 11.x will presumably reach end-of-support once 12 is established. This is a follow-up to #499 (which fixed NU1903 via an 11.3.18 patch bump only) and is its own scoped change per #507.Closes #507
Changes
All changes verified against the official Avalonia 12 breaking changes doc:
AvaloniaVersionproperty (Directory.Build.props) from11.3.18to12.1.0, used by allAvalonia.*PackageReferences across the shared, Desktop, Android, and iOS projects.Avalonia.Diagnosticsremoved in v12: drop the Debug-onlyPackageReferencefromTodoApp.Avalonia.csprojandTodoApp.Avalonia.Desktop.csproj(noAttachDevTools()call exists in the sample, so this is a clean removal).BindingPlugins.DataValidators.RemoveAt(0);and itsAvalonia.Data.Core*usings fromApp.axaml.cs. Behavior is preserved because v12 disables the data-annotations validation plugin by default.IActivityApplicationLifetimeinstead ofISingleViewApplicationLifetime: add aMainViewFactory-based branch inApp.axaml.cs, ordered before the existingISingleViewApplicationLifetimecheck (which is still required for iOS/browser/embedded Linux, per Avalonia's own migration guidance).TodoApp.Avalonia.Android/Application.cs: a new[Application]-attributedApplication : AvaloniaAndroidApplication<App>class hosting theCustomizeAppBuilderoverride (.WithInterFont()).MainActivityfrom genericAvaloniaMainActivity<App>to non-genericAvaloniaMainActivity(theCreateAppBuilder/CustomizeAppBuildervirtual methods were removed from the generic base class in v12; that logic now lives inApplication.cs).android:name=".Application"on the<application>element inAndroidManifest.xml.MainView.axaml: renameWatermark="Add a new Item"→PlaceholderText="Add a new Item"(old property is kept but obsolete in v12).BindingPlugins.DataValidators" mention from theSuppressTrimAnalysisWarningsjustification comment in the Android/iOS.csprojfiles, since that code path no longer exists — only EF Core'sDbContext(DbContextOptions)ctor remains a relevant trim-analyzer noise source.AppDelegate.cs: no changes required — confirmed against the breaking-changes doc thatAvaloniaAppDelegate.CustomizeAppBuilderwas not removed for iOS (onlyWindowbecomingnull-until-scene-attached, which this sample doesn't touch), and confirmed via a real CI build that it still compiles unchanged.Confirmed NOT applicable (verified via source grep against the breaking-changes doc)
Gestures.*attached events, clipboard/IDataObjectAPIs,GotFocusEventArgs,WindowState-in-styles,TextBlock.LetterSpacing,SystemDecorations/ExtendClientAreaChromeHints,KeyboardNavigationHandler, customScreenconstruction, Direct2D1/Blazor/Tizen backends, headless xUnit/NUnit tests — no matches found in the sample source.Related
TodoApp.Avalonia.AndroidXA0141(libSkiaSharp.sonot 16 KB page-size aligned), closed as won't-fix pending this migration. Verified as part of this PR: the CI Android build log for this change shows0 Warning(s)— theXA0141warning is gone now that Avalonia 12.1.0 pulls inSkiaSharp 3.119.4(up from the 2.x line pinned by Avalonia 11.3.18).Testing
dotnet build(Debug and Release) succeeds locally for the sharedTodoApp.AvaloniaandTodoApp.Avalonia.Desktopprojects.Build SamplesGitHub Actions workflow instead:todoapp-avalonia / desktop✅todoapp-avalonia / android✅ (0 warnings — confirms the TodoApp.Avalonia.Android: SkiaSharp native library not 16 KB page-size aligned (XA0141) #522XA0141fix)todoapp-avalonia / ios✅all-samples-built✅tests/project referencesTodoApp.Avalonia, sodotnet testis unaffected by this change (build-only verification, matching CI's own scope for this sample).