Skip to content

Use SYSLIB prefix for all LibraryImportGenerator diagnostics - #68613

Merged
elinor-fung merged 2 commits into
dotnet:mainfrom
elinor-fung:syslibPrefix
Apr 28, 2022
Merged

Use SYSLIB prefix for all LibraryImportGenerator diagnostics#68613
elinor-fung merged 2 commits into
dotnet:mainfrom
elinor-fung:syslibPrefix

Conversation

@elinor-fung

@elinor-fung elinor-fung commented Apr 27, 2022

Copy link
Copy Markdown
Member

This also removes an old diagnostic about unsupported target frameworks (from before we did the forwarding) - stolen from #60595.

This should be the last item in #60595. And then it is docs/samples.

@elinor-fung elinor-fung added area-System.Runtime.InteropServices source-generator Indicates an issue with a source generator feature labels Apr 27, 2022
@elinor-fung elinor-fung added this to the 7.0.0 milestone Apr 27, 2022
@ghost ghost assigned elinor-fung Apr 27, 2022
@ghost

ghost commented Apr 27, 2022

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

Issue Details

This also removes an old diagnostic about unsupported target frameworks (from before we did the forwarding) - stolen from #60595.

Author: elinor-fung
Assignees: -
Labels:

area-System.Runtime.InteropServices, source-generator

Milestone: 7.0.0

Comment thread src/samples/LibraryImportGeneratorSample/.editorconfig Outdated
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
[DllImport("netapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern uint NetUserAdd([MarshalAs(UnmanagedType.LPWStr)]string servername, uint level, ref USER_INFO_1 buf, out uint parm_err);
#pragma warning restore DLLIMPORTGENANALYZER015 // Use 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time
[LibraryImport("netapi32.dll", SetLastError = true)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait so this can marshal p/invoke signatures with Span<char> as well?

@elinor-fung elinor-fung Apr 28, 2022

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only if the struct marshalling (with the support for collections) is explicitly specified.

We do have an example of how a marshaller could be implemented for Spans: https://github.com/dotnet/runtime/blob/main/src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/SpanMarshallers.cs

But it is currently not integrated or exposed.

@elinor-fung

Copy link
Copy Markdown
Member Author

Failures are dotnet/arcade#9208

@elinor-fung
elinor-fung merged commit 9342649 into dotnet:main Apr 28, 2022
@elinor-fung
elinor-fung deleted the syslibPrefix branch April 28, 2022 16:25
@ghost ghost locked as resolved and limited conversation to collaborators May 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Runtime.InteropServices source-generator Indicates an issue with a source generator feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants