Open
Description
https://github.com/dotnet/runtime/blob/4cc3808d9e3ad6a23fc8b0f1b167f532e9e2b067/docs/design/features/readytorun-pinvoke.md describes a mechanism where P/Invoke marshalling code for some common cases is generated ahead of time during ReadyToRun compilation.
Judging from the document this mechanism seems fragile and hard to maintain. Now that we have the LibraryImport
source generator which is easier for ordinary R2R to take advantage of, this optimization is getting less relevant and maybe you should consider removing it for simplicity and ease of maintenance.