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

Update GeneratedDllImportAttribute CharSet -> StringMarshalling #65544

Merged
merged 5 commits into from
Feb 24, 2022

Conversation

elinor-fung
Copy link
Member

@elinor-fung elinor-fung commented Feb 18, 2022

  • Update GeneratedDllImportAttribute CharSet to StringMarshalling
  • Update usage in runtime libraries
  • Make fixer handle CharSet.Unicode -> StringMarshalling.Utf16
  • Did not make fixer handle CharSet.Ansi or CharSet.Auto
    • For ANSI, we could look through all parameters and the return and mark them MarshalAs as needed, but I figured we would just make the fixer handle this once we propose and do some AnsiStringMarshalling using the design in Attributes and Analyzer Diagnostics to support custom struct marshalling in the DllImport Source Generator #46838 and can use that for StringMarshallingCustomType - would be more in line with the original code's intent
    • For Auto, we could define two different p/invokes and update all the callsites to conditionally call different ones. Honestly not convinced this is worth it - we had one use case in all of runtime and that was for invoking into hostpolicy.
  • StringMarshalling enum is just added internally (like GeneratedDllImportAttribute) for now. Once we update/rename GeneratedDllImportAttribute per the approved API, we can expose them.

I will rebase / update after #65343 goes in. (done)

Contributes to #46822. #61326

@ghost
Copy link

ghost commented Feb 18, 2022

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

Issue Details
  • Update GeneratedDllImportAttribute CharSet to StringMarshalling
  • Update usage in runtime libraries
  • Make fixer handle CharSet.Unicode -> StringMarshalling.Utf16
  • Did not make fixer handle CharSet.Ansi
  • StringMarshalling enum is just added internally (like GeneratedDllImportAttribute) for now. Once we update/rename GeneratedDllImportAttribute per the approved API, we can expose them.

I will rebase / update after #65343 goes in.

Contributes to #46822. #61326

Author: elinor-fung
Assignees: elinor-fung
Labels:

area-System.Runtime.InteropServices

Milestone: -

@elinor-fung elinor-fung added the source-generator Indicates an issue with a source generator feature label Feb 18, 2022
@elinor-fung elinor-fung added this to the 7.0.0 milestone Feb 18, 2022
@elinor-fung elinor-fung force-pushed the charSet-stringMarshalling branch 2 times, most recently from acb66ff to 5b9a40f Compare February 19, 2022 00:03
@elinor-fung elinor-fung marked this pull request as ready for review February 23, 2022 04:12
@elinor-fung
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@elinor-fung
Copy link
Member Author

@elinor-fung elinor-fung merged commit 7984b32 into dotnet:main Feb 24, 2022
@elinor-fung elinor-fung deleted the charSet-stringMarshalling branch February 24, 2022 02:36
@ghost ghost locked as resolved and limited conversation to collaborators Mar 26, 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.

2 participants