Repository navigation
Update the MAUI sample to CSLA 11 with trimming and NativeAOT #4970
Copy link
Copy link
Open
Description
Background
CSLA 11 makes the framework, including Csla.Xaml for MAUI, trim and NativeAOT compatible (#3347, #4955, #4962). Samples/MauiExample still targets CSLA 10 packages and doesn't publish with trimming or NativeAOT, so it doesn't show how to build a MAUI app on CSLA 11 that does.
This issue covers the trimming and NativeAOT part of moving the MAUI sample to CSLA 11. The general sample changes, such as the RefreshAsync updates and the #1766 view model behavior changes, are tracked in #4961.
Work
- Move to CSLA 11 packages.
BusinessLibraryreferencesCslaand the retiredCsla.Generator.AutoImplementProperties.CSharp10.0.0 beta, andMauiExamplereferencesCsla.Maui10.0.0 beta. Remove the generator package (it fails the build withCSLABUILD001in CSLA 11) and reference the CSLA 11CslaandCsla.Mauipackages. This depends on a published Csla 11 package and on Add MAUI support for version 11 #4924. - Business classes.
- Declare
PersonListpartial(CSLA0024), so the operations generator handles its data portal methods. - Replace
Csla.Data.DataMapper.Map(data, this)inPersonEditwith explicit property assignments.DataMapper.Mapis[RequiresUnreferencedCode].
- Declare
- Publish with trimming and NativeAOT.
- Enable full trimming (
TrimMode=full) for Android and iOS. - Enable NativeAOT where MAUI supports it (
PublishAoton iOS and Mac Catalyst). - Set
TrimmerSingleWarn=falseso warnings are reported per member. - Set
IsAotCompatibleonBusinessLibraryandDataAccess, so they are analyzed at build time. - Remove the stale
net9.0property groups fromMauiExample.csproj.
- Enable full trimming (
- Get to zero
ILwarnings.PersonEditPage.xamlusescsla:PropertyInfo, which CSLA 11 marks[RequiresUnreferencedCode]because it walks a string binding path. Decide whether the sample keeps it and documents the warning (the binding source is a business object, so it is preserved), or shows an alternative.- Keep compiled bindings (
x:DataType) everywhere.
- Verify. Publish a Release build for at least Android and one Apple target with NativeAOT. Then run the app and exercise list, edit, save and validation.
- Readme. Update the sample's readme with the project settings and the CSLA-specific rules.
References
- Trimming and NativeAOT guide for CSLA 11 (csla-mcp):
csla-examples/v11/TrimmingAndNativeAot.md - "Trimming and NativeAOT annotations" in
docs/Upgrading to CSLA 11.md - Related: Add MAUI support for version 11 #4924 (MAUI support for CSLA 11), Use non-generic RefreshAsync in samples when they move to CSLA 11 #4961 (sample updates for CSLA 11), Resolve trimming and NativeAOT warnings in the other CSLA assemblies #4962 / Resolve trim and NativeAOT warnings in the other CSLA assemblies #4969 (trim and NativeAOT support in the other CSLA assemblies)
Activity
#4970 Set TrimMode only on Android; NativeAOT builds for the iOS simu…
#4970 TEMPORARY: use Xcode 26.0 for the net10.0 app build
#4970 TEMPORARY: select Xcode 26.0.1 directly
#4970 TEMPORARY: Xcode 26.5 with ValidateXcodeVersion=false
#4970 TEMPORARY: fix the IL warning check's exit status