Skip to content

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

Open

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

Activity

  1. ghost added
    needs-area-label
    on Aug 16, 2024
  2. added
    untriaged
    on Aug 16, 2024
  3. added
    area-Tools-ILLink
    and removed
    untriaged
    needs-area-label
    on Aug 16, 2024
  4. added this to the Future milestone on Aug 16, 2024
  5. dotnet-policy-service commented on Aug 16, 2024

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas
    See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Tools-ILLink

    Type

    No type

    Projects

    • Status
      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions