-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Open
Labels
area-Tools-ILLink.NET linker development as well as trimming analyzers.NET linker development as well as trimming analyzers
Milestone
Description
Consider a type Base that has RequiresUnreferencedCode:
[RequiresUnreferencedCode("Base")]
class Base {
public Base() {}
public virtual void Instance() {}
}It should be possible to annotate a derived class, without necessarily marking all static methods in the derived class as RUC:
class Derived : Base {
[RequiresUnreferencedCode("Base")]
public Derived() {}
[RequiresUnreferencedCode("Instance")] // warning: annotation mismatch
public override void Instance() => Helper.RUC();
public static void Static() {}
}
[RequiresUnreferencedCode("Helper")]
class Helper {
public static void RUC() {}
}Today ILLink warns about mismatching annotations on Derived.Instance and Base.Instance:
Trim analysis warning IL2046: Derived.Instance(): Member 'Derived.Instance()' with 'RequiresUnreferencedCodeAttribute' overrides base member 'Base.Instance()' without 'RequiresUnreferencedCodeAttribute'. 'RequiresUnreferencedCodeAttribute' annotations must match across all interface implementations or overrides.
This should not happen. The analyzer and ILC don't produce the same warning.
(note that this scenario also produces a separate warning about Derived deriving from Base, which should also be removed, see #107660.)
Parent Item
- https://github.com/sbomer/wip-tracker/issues/10 (Copilot PR Backlog)
Reactions are currently unavailable
Metadata
Metadata
Labels
area-Tools-ILLink.NET linker development as well as trimming analyzers.NET linker development as well as trimming analyzers
Type
Projects
Status
No status