Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ILLink: Avoid warning for RUC field rooted as part of a root assembly #108498

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/tools/illink/src/linker/Linker.Steps/MarkStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1728,6 +1728,7 @@ void ProcessAnalysisAnnotationsForField (FieldDefinition field, DependencyKind d
case DependencyKind.AlreadyMarked:
case DependencyKind.TypePreserve:
case DependencyKind.PreservedMethod:
case DependencyKind.MemberOfType:
return;

case DependencyKind.DynamicallyAccessedMemberOnType:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// 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;
using System.Diagnostics.CodeAnalysis;
using Mono.Linker.Tests.Cases.Expectations.Assertions;
using Mono.Linker.Tests.Cases.Expectations.Metadata;

namespace Mono.Linker.Tests.Cases.RequiresCapability
{
[SetupLinkerArgument ("-a", "test.exe", "all")]

[SkipKeptItemsValidation]
[ExpectedNoWarnings]
public class RequiresInRootAllAssembly
{
public static void Main ()
{
}

[RequiresDynamicCode ("--MethodWhichRequires--")]
public static void MethodWhichRequires () { }

[RequiresDynamicCode ("--InstanceMethodWhichRequires--")]
public void InstanceMethodWhichRequires () { }

public sealed class ClassWithDAMAnnotatedMembers
{
public static void Method ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] Type type) { }

[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]
public static Type Field;
}

[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]
public sealed class ClassWithDAMAnnotation
{
public void Method () { }
}

[RequiresUnreferencedCode ("--ClassWithRequires--")]
public sealed class ClassWithRequires
{
public static int Field;

internal static int InternalField;

private static int PrivateField;

public static void Method () { }

public void InstanceMethod () { }

public static int Property { get; set; }

public static event EventHandler PropertyChanged;
}
}
}
Loading