dotnet/runtime

[illink][ios] Explicitly setting `PublishTrimmed=true` changes the default feature switch configuration

Open

#108.269 aperta il 26 set 2024

Vedi su GitHub
 (11 commenti) (1 reazione) (0 assegnatari)C# (5445 fork)batch import
area-Tools-ILLinkgood first issueos-ios

Metriche repository

Star
 (17.886 star)
Metriche merge PR
 (Merge medio 12g 11h) (661 PR mergiate in 30 g)

Descrizione

Description

As called out in: https://github.com/dotnet/runtime/issues/108108#issuecomment-2375220090 iOS apps built with PublishTrimmed=true set on a project level end up with different set of feature switches configured during the build. For example consider the difference in the input to the trimmer with and without setting the property value explicitly:

--feature Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability false->true
--feature System.ComponentModel.DefaultValueAttribute.IsSupported ->false
--feature System.ComponentModel.Design.IDesignerHost.IsSupported ->false
--feature System.Resources.UseSystemResourceKeys true->false
--feature System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported false->true
--feature System.Runtime.InteropServices.Marshalling.EnableGeneratedComInterfaceComImportInterop ->false

Problem

The problem comes from the order of importing MSBuild targets and property evaluation:

Proposal

We should investigate setting the feature switch defaults (and possibly other trimmer setting) in an MSBuild target so that mobile SDKs can provide different defaults earlier in the build.

Guida contributor