dotnet / linker

389 stars 127 forks source link

propertyInfo.PropertyType.GetProperty("") #3220

Open Kiryuumaru opened 1 year ago

Kiryuumaru commented 1 year ago

propertyInfo.PropertyType.GetProperty("")

This shows warning: Severity Code Description Project File Line Suppression State Warning IL2075 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties' in call to 'System.Type.GetProperty(String)'. The return value of method 'System.Reflection.PropertyInfo.PropertyType.get' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.

MichalStrehovsky commented 1 year ago

How do you obtain the value in propertyInfo? This is complaining because the result of propertyInfo.PropertyType is an unknown type and accessing a property on a type that is not known at the time of trimming might result in the property being trimmed.