New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch over miscellaneous DllImports to GeneratedDllImport. #62353
Conversation
These P/Invokes slipped through the cracks for their respective libraries because they're either only used on platforms where getting the analyzer to run in VS is more difficult (CoreLib for mobile platforms) or they were missed in the first pass.
src/libraries/Common/src/Interop/Windows/Advapi32/Interop.ChangeServiceConfig2.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Windows/User32/Interop.GetDC.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Windows/User32/Interop.ReleaseDC.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Windows/User32/Interop.SystemParametersInfo.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Windows/User32/Interop.WindowFromDC.cs
Outdated
Show resolved
Hide resolved
....Diagnostics.Tracing.EventSource.Redist/src/Microsoft/Diagnostics/Tracing/StubEnvironment.cs
Outdated
Show resolved
Hide resolved
....Diagnostics.Tracing.EventSource.Redist/src/Microsoft/Diagnostics/Tracing/StubEnvironment.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
…eference the live ref pack.
…er makes doing it during property evaluation difficult
a99926d
to
c0022e1
Compare
src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetNodeName.cs
Outdated
Show resolved
Hide resolved
|
||
[DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)] | ||
#pragma warning disable DLLIMPORTGENANALYZER015 // Use 'GeneratedDllImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time | ||
// TODO: [DllImportGenerator] Switch to use GeneratedDllImport once we support non-blittable types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to reference tracking issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the comment pattern we've used even migrating over the rest of the DllImports, so I'd prefer to match that.
Curious why don't we have code analyzers/fixers for this? |
See the opening PR comment: It's not blanketly enabled as a warning for the whole repo yet as the team has been working through the changeover library by library. |
Great news. I didn't know there is an analyzer available already. |
These P/Invokes slipped through the cracks for their respective libraries because they're either only used on platforms where getting the analyzer to run in VS is more difficult (CoreLib for mobile platforms) or they were missed in the first pass.