Currently when the linker sees a PInvoke or InternalCall that is an instance method it preserves all fields of the declaring type: https://github.com/mono/linker/blob/762278c9c3e60f5a82733dc0386bd0cf7f0a2d22/src/linker/Linker.Steps/MarkStep.cs#L3266
This produces warnings if any of the fields is annotated. Would it make more sense to warn at the callsites to the interop method? Currently the origin is the interop method itself, which is unusual in cases where the required fields depend on the callsite - see dotnet/runtime#56593 (comment).
@MichalStrehovsky @LakshanF