From b062f9789bf99b8a06d5a77bbbc31b5f0c0db1a1 Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Wed, 3 May 2023 23:16:20 +0000 Subject: [PATCH 1/7] Clean up dead code in illink targets --- .../build/Microsoft.NET.ILLink.targets | 53 ++----------------- 1 file changed, 4 insertions(+), 49 deletions(-) diff --git a/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets b/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets index b46c700b8ad4a..af0ac935ad9f9 100644 --- a/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets +++ b/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets @@ -31,8 +31,7 @@ Copyright (c) .NET Foundation. All rights reserved. switches can flow to the runtimeconfig.json. Features are disabled by default since they may require assemblies, types or members that could be removed by the ILLink, causing a trimmed app to crash. --> - + false false false @@ -49,8 +48,6 @@ Copyright (c) .NET Foundation. All rights reserved. - - true true @@ -80,7 +77,7 @@ Copyright (c) .NET Foundation. All rights reserved. @@ -202,28 +199,16 @@ Copyright (c) .NET Foundation. All rights reserved. - - - - <_ILLinkSuppressions Include="$(MSBuildThisFileDirectory)6.0_suppressions.xml" /> - - <_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --link-attributes "@(_ILLinkSuppressions->'%(Identity)', '" --link-attributes "')" - + - copyused - partial full - - - <_TrimmerDefaultAction Condition="$([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '7.0'))">$(TrimmerDefaultAction) - <_TrimmerDefaultAction Condition="'$(_TrimmerDefaultAction)' == '' And $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '6.0'))">$(TrimMode) - <_TrimmerDefaultAction Condition="'$(_TrimmerDefaultAction)' == '' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '6.0'))">copy @@ -232,22 +217,6 @@ Copyright (c) .NET Foundation. All rights reserved. true - - - - $(NoWarn);IL2008 - $(NoWarn);IL2009 - - $(NoWarn);IL2037 - - $(NoWarn);IL2009;IL2012 - - - - - <_ExtraTrimmerArgs>--enable-serialization-discovery $(_ExtraTrimmerArgs) - - @@ -255,12 +224,6 @@ Copyright (c) .NET Foundation. All rights reserved. false - - <_TrimmerUnreachableBodies>false - - @@ -284,14 +247,6 @@ Copyright (c) .NET Foundation. All rights reserved. - - - - - copy - - - From 174e5e0a1b4cb997e8ba2d382d4372626d1deb35 Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Wed, 3 May 2023 23:36:35 +0000 Subject: [PATCH 2/7] Remove 6.0 suppressions xml --- .../src/ILLink.Tasks/ILLink.Tasks.csproj | 1 - .../ILLink.Tasks/build/6.0_suppressions.xml | 156 ------------------ 2 files changed, 157 deletions(-) delete mode 100644 src/tools/illink/src/ILLink.Tasks/build/6.0_suppressions.xml diff --git a/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj b/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj index 585ac722c259e..ff511c3b065f5 100644 --- a/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj +++ b/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj @@ -28,7 +28,6 @@ - diff --git a/src/tools/illink/src/ILLink.Tasks/build/6.0_suppressions.xml b/src/tools/illink/src/ILLink.Tasks/build/6.0_suppressions.xml deleted file mode 100644 index 748304129c78c..0000000000000 --- a/src/tools/illink/src/ILLink.Tasks/build/6.0_suppressions.xml +++ /dev/null @@ -1,156 +0,0 @@ - - - - - ILLink - IL2070 - member - M:System.Reflection.CustomAttribute.AddCustomAttributes(System.RuntimeType.ListBuilder{System.Object}@,System.Reflection.RuntimeModule,System.Int32,System.RuntimeType,System.Boolean,System.RuntimeType.ListBuilder{System.Object}) - Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762 - - - ILLink - IL2063 - member - M:System.RuntimeType.GetInterface(System.String,System.Boolean) - Suppressed in 7.0 for dataflow improvements: https://github.com/dotnet/runtime/commit/2e353d18b81732133aadbee888a801fd9f935fbf - - - ILLink - IL2067 - member - M:System.RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter(System.RuntimeType,System.RuntimeType,System.RuntimeType) - Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762 - - - ILLink - IL2067 - member - M:System.RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter(System.RuntimeType,System.RuntimeType) - Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762 - - - ILLink - IL2068 - member - M:System.Reflection.Emit.TypeBuilder.CreateTypeNoLock - Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762 - - - ILLink - IL2069 - member - M:System.Reflection.Emit.TypeBuilder.CreateTypeNoLock - Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762 - - - ILLink - IL2119 - member - M:System.Diagnostics.Tracing.EventSource.WriteEventString(System.String) - Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea - - - - - - ILLink - IL2068 - member - M:System.ComponentModel.DataAnnotations.AssociatedMetadataTypeTypeDescriptor.TypeDescriptorCache.GetAssociatedMetadataType(System.Type) - Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762 - - - - - - ILLink - IL2060 - member - M:System.Data.DataRowExtensions.UnboxT`1.Create() - Suppressed in 7.0 for new constraint warning: https://github.com/dotnet/runtime/commit/31d5d23e9c6f3da877343ccb020e85ca9f136c05 - - - - - - ILLink - IL2070 - member - M:System.Reflection.CustomAttribute.AddCustomAttributes(System.RuntimeType.ListBuilder`1@,System.Reflection.RuntimeModule,System.Int32,System.RuntimeType,System.Bool,System.RuntimeType.ListBuilder{System.Object}) - Suppressed in 7.0 for ref param changes: https://github.com/dotnet/runtime/commit/50d289cc2b945c8ee6b4cca5b71d8d137c09a762 - - - - - - ILLink - IL2119 - member - M:System.Diagnostics.DiagnosticSourceEventSource.FilterAndTransform.#ctor(System.String,System.Int32,System.Int32,System.Diagnostics.DiagnosticSourceEventSource,System.Diagnostics.DiagnosticSourceEventSource.FilterAndTransform) - Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea - - - - - - ILLink - IL2065 - member - M:System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(System.Type) - Suppressed in 7.0 for dataflow improvements: https://github.com/dotnet/runtime/commit/2e353d18b81732133aadbee888a801fd9f935fbf - - - - - - ILLink - IL2055 - member - M:System.Text.Json.Serialization.Converters.FSharpTypeConverterFactory.CreateConverter(System.Type,System.Text.Json.JsonSerializerOptions) - Suppressed in 7.0 for new constraint warning: https://github.com/dotnet/runtime/commit/31d5d23e9c6f3da877343ccb020e85ca9f136c05 - - - ILLink - IL2070 - member - M:System.Text.Json.Serialization.Converters.EnumConverterFactory.GetEnumConverterType(System.Type) - Suppressed in 7.0 for new constraint warning: https://github.com/dotnet/runtime/commit/31d5d23e9c6f3da877343ccb020e85ca9f136c05 - - - ILLink - IL2070 - member - M:System.Text.Json.Serialization.Converters.NullableConverterFactory.GetNullableConverterType(System.Type) - Suppressed in 7.0 for new constraint warning: https://github.com/dotnet/runtime/commit/31d5d23e9c6f3da877343ccb020e85ca9f136c05 - - - - - - ILLink - IL2118 - member - M:System.Xml.Serialization.TypeScope.#cctor - Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea - - - ILLink - IL2118 - member - M:System.Xml.Serialization.TypeScope.AddSoapEncodedTypes(System.String) - Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea - - - - - - ILLink - IL2118 - member - M:System.Runtime.Serialization.DateTimeDataContract.#ctor - Suppressed in 7.0 for compiler-generated code changes: https://github.com/dotnet/runtime/commit/4a79e0696b1e425a58d8f5104cc572f39dd3005ea - - - - \ No newline at end of file From 0c73186d461d89f35347c03f523135047fc4b147 Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Thu, 4 May 2023 16:50:53 +0000 Subject: [PATCH 3/7] Add warning about unsupported TFM --- .../src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets b/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets index af0ac935ad9f9..31656772b5ad3 100644 --- a/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets +++ b/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets @@ -192,6 +192,10 @@ Copyright (c) .NET Foundation. All rights reserved. is a NativeAOT app, value of SelfContained doesn't matter. --> + + + 5 From 5633e40c10b3744f952004eb40c02c9f355454a8 Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Wed, 10 May 2023 18:57:25 +0000 Subject: [PATCH 4/7] Warn on explicit package reference This matches the behavior of nativeaot --- .../src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets b/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets index 31656772b5ad3..ecff8fedd435a 100644 --- a/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets +++ b/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets @@ -192,9 +192,9 @@ Copyright (c) .NET Foundation. All rights reserved. is a NativeAOT app, value of SelfContained doesn't matter. --> - - + + Text="Delete explicit 'Microsoft.NET.ILLink.Tasks' package reference in your project file to avoid versioning problems." /> + Text="Delete explicit 'Microsoft.DotNet.ILCompiler' package reference in your project file to avoid versioning problems." /> From 0903e71caefe05512dd37930defbeee5b9fe59da Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Tue, 16 May 2023 09:49:20 -0700 Subject: [PATCH 7/7] Update src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets Co-authored-by: Vitek Karas <10670590+vitek-karas@users.noreply.github.com> --- .../illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets b/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets index 5e22b4c9c0ddf..4ae285b0250f5 100644 --- a/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets +++ b/src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets @@ -204,7 +204,7 @@ Copyright (c) .NET Foundation. All rights reserved. + Text="Property 'TrimmerDefaultAction' is deprecated in .NET 7 and higher and will be ignored. Use TrimMode instead." /> <_ExtraTrimmerArgs>$(_ExtraTrimmerArgs) --link-attributes "@(_ILLinkSuppressions->'%(Identity)', '" --link-attributes "')"