Unactionable trim warnings on property/event with attribute that has RUC ctor #108454
Labels
area-Tools-ILLink
.NET linker development as well as trimming analyzers
Milestone
The trim analysis tooling warns on members annotated with attributes whose ctors have RequiresUnreferencedCode:
analyzer:
ILC:
(similar for ILLink - except ILLink warns for all kept members, whereas ILC only warns for reflectable members)
The warning on the method
M
can be bubbled up by annotating it with RequiresUnreferencedCode - then there will be a warning on the reference toM
instead.Fields/properties/events aren't supported attribute targets of RequiresUnreferencedCode, so they can't be annotated directly. If you instead add RequiresUnreferencedCode at the class level, this produces warnings at the access to the field/property/event. However, the warnings from the annotated property/event are still present, making it impossible to annotate this without suppressions.
This came up while annotating System.Configuration.ConfigurationManager - for example, if ConfigurationPropertyAttribute is annotated with RequiresUnreferencedCode, it warns here:
runtime/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ProviderSettings.cs
Lines 47 to 48 in 82f8ac6
The text was updated successfully, but these errors were encountered: