-
Notifications
You must be signed in to change notification settings - Fork 128
Description
When an attribute ctor has RequiresUnreferencedCode we normally warn on attribute instances. If an attributed member has RequiresUnreferencedCode, this normally silences the warning. However, the behavior is inconsistent for RUC on type:
In the analyzer, RUC on type silences warnings from attributes on the type, type but not for attributes on the type's members.
In the linker, RUC on type silences warnings from attributes on the type's members, but not for attributes on the type itself.
I think the linker behavior makes sense here because RUC on type is supposed to allow the type's members to require unreferenced code without producing a bunch of warnings, instead producing warnings on dynamic access to the RUC members. I think these warnings should cover all ways to get to the members' attributes too. The attribute on the type itself should warn because it's possible to get at the type (and its attributes) with reflection, and this doesn't produce any warning. @vitek-karas do you agree?