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
Both the Xamarin.iOS and the Xamarin.Mac runtime include support for registering managed types with the Objective-C runtime. It can either be done at build time or at runtime (or partially at build time and the rest at runtime), but if it's completely done at build time, it means the supporting code for doing it at runtime can be removed. This results in a significant decrease in app size, in particular for smaller apps such as extensions or watchOS apps.
This optimization requires both the static registrar and the linker to be enabled.
The linker will attempt to determine if it's safe to remove the dynamic registrar, and if so will try to remove it.
Since Xamarin.Mac supports dynamically loading assemblies at runtime (which were not known at build time), it's impossible to determine at build time whether this is a safe optimization. This means that this optimization is never enabled by default for Xamarin.Mac apps.
The default behavior can be overridden by passing --optimize=[+|-]remove-dynamic-registrar to mtouch/mmp.
If the default is overridden to remove the dynamic registrar, the linker will emit warnings if it detects that it's not safe (but the dynamic registrar will still be removed).
It's possible to force the linker to keep the dynamic registrar by adding --optimize=-remove-dynamic-registrar to the additional mtouch arguments in the project's iOS Build options.
https://docs.microsoft.com/en-us/xamarin/cross-platform/macios/optimizations#remove-the-dynamic-registrar
The text was updated successfully, but these errors were encountered: