dotnet/runtime

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

Open

#108,269 opened on 2024年9月26日

GitHub で見る
 (11 comments) (1 reaction) (0 assignees)C# (5,445 forks)batch import
area-Tools-ILLinkgood first issueos-ios

Repository metrics

Stars
 (17,886 stars)
PR merge metrics
 (平均マージ 12d 11h) (30d で 661 merged PRs)

説明

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.

コントリビューターガイド