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

Remove A/W probing for P/Invokes on non-Windows platforms #19681

Closed
AaronRobinsonMSFT opened this issue Jul 24, 2020 · 3 comments · Fixed by #19912
Closed

Remove A/W probing for P/Invokes on non-Windows platforms #19681

AaronRobinsonMSFT opened this issue Jul 24, 2020 · 3 comments · Fixed by #19912
Assignees
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 5 Work items for the .NET 5 release doc-idea Indicates issues that are suggestions for new topics [org][type][category]

Comments

@AaronRobinsonMSFT
Copy link
Member

Remove A/W probing for P/Invokes on non-Windows platforms

The Windows function convention of having a A/W suffix is now only respected on the Windows platform. Both the CoreCLR and Mono runtimes have continued this probing on non-Windows platform where the A/W suffix is not a convention. With this change the automatic addition of a A/W suffix is no longer performed on non-Windows platforms. The semantics of both runtimes on the Windows platform remain unchanged.

See dotnet/runtime#33246 for additional details.

Version introduced

.NET 5.0

Old behavior

During export discovery for P/Invokes an A/W prefix was added to the export name when probing. This was done on all platforms.

New behavior

During export discovery for P/Invokes an A/W prefix was added to the export name when probing only on the Windows platform.

Reason for change

This change was made to simplify the cross-platform probing. It is overhead that should not be incurred by the developer given non-Windows platforms don't contain this semantic.

Recommended action

In order to mitigate this change, the user should manually add the desired prefix on non-Windows platforms.

In the example below, if the export on non-Windows was FooW the following declaration would previously suffice:

[DllImport(...)]
extern static void Foo();

It is now recommended the developer update the declaration with the desired prefix:

[DllImport(...)]
extern static void FooW();

Category

  • Interop

Affected APIs

DllImportAttribute.


Issue metadata

  • Issue type: breaking-change
@dotnet-bot dotnet-bot added ⌚ Not Triaged Not triaged breaking-change Indicates a .NET Core breaking change labels Jul 24, 2020
@AaronRobinsonMSFT
Copy link
Member Author

/cc @jeffschwMSFT @jkotas @akoeplinger

@gewarren gewarren self-assigned this Jul 27, 2020
@gewarren gewarren added doc-idea Indicates issues that are suggestions for new topics [org][type][category] 🏁 Release: .NET 5 Work items for the .NET 5 release and removed ⌚ Not Triaged Not triaged labels Jul 27, 2020
@gewarren
Copy link
Contributor

gewarren commented Aug 7, 2020

@AaronRobinsonMSFT Is this for preview 8?

@jeffschwMSFT
Copy link
Member

@gewarren this change has been in since an early preview of .NET 5... perhaps around Preview 3 or 4.

gewarren added a commit to gewarren/docs that referenced this issue Aug 8, 2020
gewarren added a commit that referenced this issue Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 5 Work items for the .NET 5 release doc-idea Indicates issues that are suggestions for new topics [org][type][category]
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants