Remove A/W probing for P/Invokes on non-Windows platforms #19681
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]
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:It is now recommended the developer update the declaration with the desired prefix:
Category
Affected APIs
DllImportAttribute.
Issue metadata
The text was updated successfully, but these errors were encountered: