Skip to content

ILLink doesn't warn for annotation mismatch for derived method implementing a recursive interface #106552

@jtschuster

Description

@jtschuster

In IL it is valid for an abstract Base to implement I but provide no methods. This is not possible in C#, as Base would not be allowed to be missing M. If Base does provide M, the trimmer does warn there (see RequiresCapability/BaseProvidesInterfaceMethodRequiresMismatch.cs). This is a very niche corner case and not the highest priority.

abstract class Base : I
{
}

class Derived : Base
{
    public virtual void M() {} // warning IL2046
}

interface I
{
    [RequiresUnreferencedCode("RUC")]
    void M();
}

See #103317 (comment)_
for context

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Tools-ILLink.NET linker development as well as trimming analyzers

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions