You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Measure performance of NativeAOT targeting iOS platforms, and compare results against MonoAOT, the measurements should include: the application size: disk size (SOD) and bundle size (.ipa), build and startup time
Dynamic registrar with NativeAOT - [NOT A PROBLEM]
We did not detect any need to support dynamic registrar with NativeAOT so far - especially because NativeAOT does not seem to be required for inner-dev loop experience. Nevertheless, bellow are listed findings when dynamic registrar is enabled for NativeAOT:
When building the application with dynamic registrar, the application crashes when ObjC runtime tries to register UIKit.UIGestureRecognizer+Callback`1 type while it is fetching its interface map against Foundation.INSObjectProtocol:
default 12:06:26.833235+0200 HelloMauiiOS *** Terminating app due to uncaught exception 'System.ArgumentException', reason: 'Interface not found. (System.ArgumentException)
at Internal.Reflection.Execution.ExecutionEnvironmentImplementation.VerifyInterfaceIsImplemented(RuntimeTypeHandle, RuntimeTypeHandle) + 0x78
at System.Reflection.Runtime.TypeInfos.RuntimeTypeInfo.GetInterfaceMap(Type) + 0xa8
at Registrar.SharedDynamic.PrepareInterfaceMethodMapping(Type) + 0x114
at Registrar.Registrar.RegisterTypeUnsafe(Type, List`1&) + 0x1fbc
at Registrar.Registrar.RegisterType(Type, List`1&) + 0x44
at Registrar.DynamicRegistrar.Register(Type) + 0x18
at ObjCRuntime.Class.GetClassHandle(Type, Boolean, Boolean&) + 0x168
at Foundation.NSObject.AllocIfNeeded() + 0x40
at UIKit.UIPanGestureRecognizer..ctor(Action`1) + 0x40
at Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutRenderer.Microsoft.Maui.Controls.Platform.Compatibility.IShellFlyoutRenderer.AttachFlyout(IShellContext context, UIViewController content) + 0xf8
GetInterfaceMap does not seem to be supported with uninstantiated generic types in NativeAOT. Only the most mainstream cases seem to be supported which is being tracked here: Type.GetInterfaceMap doesn't work for all cases #89157
The text was updated successfully, but these errors were encountered:
Description
Investigate potential issues and limitations of NativeAOT with .NET MAUI iOS applications:
.NET MAUI template app
.NET MAUI Podcast app
Goals
Preview 6
Our main focus for the initial releases is the application size.
Apps were built and measured using: https://github.com/xamarin/xamarin-macios/tree/release/8.0.1xx-preview6 release
.NET MAUI template app
Building a .NET MAUI iOS sample application
dotnet new maui
gives the following results:Mono-p6
in the table represents results obtained with Mono.NET8 preview6
, whileNAOT-p6
represents results obtained with NativeAOT.NET8 preview6
Identified issues that contribute to the size regression with NativeAOT are:
Estimated savings
Estimated savings in app sizes by applying optimizations for NativeAOT from
Step1
toStep4
NOTE: Results for
StepN
mean that all the previous stepsStep1..N
have been implementedEstimated difference (%) in app sizes compared to
Mono-p6
by applying optimizations for NativeAOT fromStep1
toStep4
NOTE: Diffs in the table mean that if for example we implement
Step1
andStep2
, the .ipa size with NativeAOT will be12,48%
smaller compared to Mono.NET MAUI Podcast app
-dead_strip
to the native linker xamarin/xamarin-macios#18552Estimated savings
Preliminary data (only estimated for
Step3
improvements with NativeAOT):Preview 7
Apps were built and measured using: https://github.com/xamarin/xamarin-macios/tree/release/8.0.1xx-preview7 release. The results show that NativeAOT generates
~30%
smaller applications compared to Mono (as it has been estimated above)..NET MAUI template app
.NET MAUI Podcast app
Other findings
UIKit.UIGestureRecognizer+Callback`1
type while it is fetching its interface map againstFoundation.INSObjectProtocol
:GetInterfaceMap
does not seem to be supported with uninstantiated generic types in NativeAOT. Only the most mainstream cases seem to be supported which is being tracked here: Type.GetInterfaceMap doesn't work for all cases #89157The text was updated successfully, but these errors were encountered: