Due to the caching for MarkEntireType, we aren't producing warnings for all callsites:
using System;
using System.Diagnostics.CodeAnalysis;
using DAM = System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute;
using RUC = System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute;
public class Program {
public static void Main() {
Test1();
Test2();
}
static void Test1() => RequireAll(typeof(Foo)); // warns
static void Test2() => RequireAll(typeof(Foo)); // no warning
static void RequireAll([DAM(DynamicallyAccessedMemberTypes.All)] Type t) {}
}
public class Foo {
[RUC("RUC")]
void Method() {}
}
NestedTypes annotations will have similar problems.