diff --git a/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs b/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs index d025204b1315d3..0cd55a949fc215 100644 --- a/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs +++ b/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs @@ -326,8 +326,6 @@ internal void MarkEntireType (TypeDefinition type, in DependencyInfo reason, Mes } MarkTypeVisibleToReflection (type, reason, origin); - MarkCustomAttributes (type, new DependencyInfo (DependencyKind.CustomAttribute, type), origin); - MarkTypeSpecialCustomAttributes (type, origin); if (type.HasInterfaces) { foreach (InterfaceImplementation iface in type.Interfaces) diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresInRootAllAssembly.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresInRootAllAssembly.cs index b8fa63c186c1c9..91a8fd46c308f3 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresInRootAllAssembly.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresInRootAllAssembly.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; @@ -8,6 +8,7 @@ namespace Mono.Linker.Tests.Cases.RequiresCapability { + [IgnoreTestCase ("NativeAOT test infrastructure doesn't implement rooting behavior the same way", IgnoredBy = Tool.NativeAot)] [SetupLinkerArgument ("-a", "test.exe", "all")] [SkipKeptItemsValidation] @@ -55,5 +56,16 @@ public void InstanceMethod () { } public static event EventHandler PropertyChanged; } + + [AttributeWithRequires] + [ExpectedWarning ("IL2026")] + public sealed class ClassWithAttributeWithRequires + { + } + + [RequiresUnreferencedCode ("--AttributeWithRequiresAttribute--")] + public sealed class AttributeWithRequiresAttribute : Attribute + { + } } }