Skip to content
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

Forward special P/Invoke attributes to the target DllImport method #1267

Conversation

jkoritzinsky
Copy link
Member

If the GeneratedDllImport-attributed method has SuppressGCTransition or UnmanagedCallConv attributes, apply the attributes to the generated DllImport method.

@jkoritzinsky jkoritzinsky added the area-DllImportGenerator Source Generated stubs for P/Invokes in C# label Jun 21, 2021
@jkoritzinsky
Copy link
Member Author

@AaronRobinsonMSFT looks like Clang warns about unused attributes (like calling conventions on x64), and since Clang uses a pretty standard warning format, MSBuild recognizes it and elevates it to an error since we have WarnAsError set to true.

Is there an easy way to suppress the warning from DNNE? Also, is it worth having integration tests for the calling convention work since we validate that we forwarded the attribute in the unit tests and the calling conventions would only have a difference in x86, which we don't run against?

@AaronRobinsonMSFT
Copy link
Member

Updated DNNE to avoid setting these values - https://www.nuget.org/packages/DNNE/1.0.22.

@jkoritzinsky jkoritzinsky merged commit 5715e2e into dotnet:feature/DllImportGenerator Jun 22, 2021
@jkoritzinsky jkoritzinsky deleted the forward-special-attrs branch June 22, 2021 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-DllImportGenerator Source Generated stubs for P/Invokes in C#
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants