-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Closed
Labels
area-Tools-ILLink.NET linker development as well as trimming analyzers.NET linker development as well as trimming analyzers
Milestone
Description
Our tooling produces warnings on an unannotated type derived from a type that has RequiresUnreferencedCode
:
class Derived : Base // warning IL2109: Type 'Derived' derives from 'Base' which has 'RequiresUnreferencedCodeAttribute'. Base.
{} // ILLink/ILC also warn about the default ctor calling the base ctor
[RequiresUnreferencedCode("Base")]
class Base {}
But the same is not true for RequiresDynamicCode
(it only warns for the call to the base ctor). This allows the use of static members of the derived type. The following doesn't produce any warnings because the default ctor is unused:
Derived.StaticMethod();
class Derived : Base {
public static void StaticMethod() {}
}
[RequiresDynamicCode("Base")]
public class Base {}
I think we should unify on the RequiresDynamicCode
behavior. @dotnet/illink any opinions?
Related: #106796
Metadata
Metadata
Assignees
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