Skip to content

ILC: Duplicate warnings for attribute on property dataflow #120004

@sbomer

Description

@sbomer
using System;
using System.Diagnostics.CodeAnalysis;

typeof(C).GetProperties().Select(p => p.GetCustomAttributes(false));

class C
{
    [MyAttribute(typeof(Annotated))]
    public int Property { get; set;  }
}

class MyAttribute : Attribute
{
    public MyAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type type)
    {
    }
}

[RequiresUnreferencedCode("Annotated")]
class Annotated
{
    public static void Method() { }
}

ILLink Analyzer:

Program.cs(8,6): warning IL2026: Using member 'Annotated.Method()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Annotated.

ILLink:

ILLink : Trim analysis warning IL2026: C.Property: Using member 'Annotated.Method()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Annotated.

ILC:

ILC : Trim analysis warning IL2026: C.Property: Using member 'Annotated.Method()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Annotated.
ILC : Trim analysis warning IL2026: C.Property: Using member 'Annotated.Method()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Annotated.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions