#45633 (comment)
If linker didn't see the p/invoke, it would not have done the necessary work to ensure the generated marshalling code for the p/invoke can work (constructors might be missing for types used in out positions of the signature, the p/invoke might introduce COM into the process etc.).
We should put RequiresUnreferencedCodeAttribute on all overloads in the ref assembly and all the implementations.