xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.43k stars 505 forks source link

NativeAOT: Should we trim MacOS apps #19864

Closed ivanpovazan closed 7 months ago

ivanpovazan commented 7 months ago

This is more of a question, as I am not aware what is the background, but customers reported large __LINKEDIT segments in their release mode NativeAOT MacOS applications: https://github.com/dotnet/runtime/issues/96997

It turns out that we set NoSymbolStrip=true when building MacOS apps: https://github.com/xamarin/xamarin-macios/blob/d00a1907666ff0ceabcc21ff0ceb83b44f689b54/msbuild/Xamarin.Shared/Xamarin.Shared.props#L238-L241 which as a result does not trim the application and affects the overall output.

Setting <NoSymbolStrip>false</NoSymbolStrip> on a project level solves the issue for the customer, but the question is, should we make it as a new default for NativeAOT?

rolfbjarne commented 7 months ago

The history is basically that mobile apps are much more sensitive to app size, and stripping native symbols makes crash reports (before symbolication) much less useful - and symbolication only works if the developer saved the .dSYM somewhere.

Turning it on for NativeAOT builds seems like a good idea to me.

ivanpovazan commented 7 months ago

Closing as fixed via https://github.com/xamarin/xamarin-macios/commit/197caed38c05bd47f5545aa8a0b9fa481b2e2b12