Closed sbomer closed 1 month ago
Tagging subscribers to this area: @dotnet/area-meta See info in area-owners.md if you want to be subscribed.
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas See info in area-owners.md if you want to be subscribed.
Looks like ILLink/ILC can have a similar issue in some cases (found by tests added in https://github.com/dotnet/runtime/pull/101214):
static UnsupportedType GetUnsupportedTypeInstance () => null;
[return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)]
static UnsupportedType GetWithPublicMethods () {
return GetUnsupportedTypeInstance (); // Unexpected IL2073 from ILLink/ILC
}
DynamicallyAccessedMembers
annotations are only allowed on parameters of certain types, such asType
andstring
. While the analyzer correctly reports a warning about annotations on unsupported types, it still respects those annotations:IL2098 is expected, but IL2072 is not. The invalid annotations should not produce further warnings for assignments to that location.