From 6c5e3f57262cccdee847a1bc7ca017ecba4954a0 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 11 Feb 2025 10:21:37 +0100 Subject: [PATCH] [net10.0] [dotnet] Disable aggressive attribute trimming when using NativeAOT. Fixes #22065. Aggressive attribute trimming removes attributes used by the trimmer. This is fine as long as we don't run _two_ trimmers - because then the first pass would remove attributes needed by the second pass, which is exactly what happens when we're building using NativeAOT: we first run ILLink, then NativeAOT's trimmer. If aggressive attribute trimming is enabled in this scenario, ILLink will remove attributes required by NativeAOT to work correctly, so disable aggressive attribute trimming. Fixes https://github.com/xamarin/xamarin-macios/issues/22065. --- dotnet/targets/Xamarin.Shared.Sdk.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index 319adce9d9ea..c655a04d4ce8 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -675,7 +675,7 @@ <_AdditionalTaskAssemblyDirectory>$(_XamarinSdkRootDirectoryOnMac)tools/dotnet-linker/ <_AdditionalTaskAssembly>$(_AdditionalTaskAssemblyDirectory)dotnet-linker.dll - true + true <_TrimAttributesLinkDescriptionPath>$(_XamarinSdkRootDirectory)tools/TrimAttributes.LinkDescription.xml <_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --link-attributes $(_TrimAttributesLinkDescriptionPath)