Description
When we have a method that is an intrinsic for flow analysis purposes, or has parameters marked as [DynamicallyAccessedMembers]
, or is marked [RequiresUnreferencedCode]
, linker should warn when we see that method being reflection accessed.
The problem this is trying to avoid is someone e.g. locating MakeGenericMethod
(that currently warns if used statically) and reflection-invoking it with some parameters. The initial reflection access should be a warning since illink is not capable of figuring out the dataflow into the method. Someone could be violating the annotations, resulting in a broken app without warnings.
We should probably extend this to delegates pointing to such methods (although that one has a natural extension - we could require the delegate invoke method itself to be annotated same as the target).