dotnet/runtime

Add an editorconfig option to supress LibraryImport suggestion for blittable PInvokes

Open

#111,593 opened on Jan 19, 2025

View on GitHub
 (6 comments) (3 reactions) (0 assignees)C# (5,445 forks)batch import
area-Interop-coreclrcode-analyzerhelp wanted

Repository metrics

Stars
 (17,886 stars)
PR merge metrics
 (Avg merge 12d 11h) (661 merged PRs in 30d)

Description

The current LibraryImport analyzer always suggests to convert to it from DllImport, even when it's not necessary due to the signature being blittable. This is especially annoying when multitargeting with older TFMs without LibraryImport. As discussed on Discord, there should be an option to opt out of this with an editorconfig switch.

cc @jkoritzinsky @tannergooding

Contributor guide