-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[release/8.0-staging] [LibraryImportGenerator] Use basic forwarder in down-level support if any parameters can't be marshalled #104501
Conversation
… any parameters can't be marshalled
Tagging subscribers to this area: @dotnet/interop-contrib |
/azp run runtime-libraries-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks!
Is there any additional/different testing that we want to do in the 8.0 branch, since my recollection is that is where the downlevel targeting is supported? Or are the current tests sufficient? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have discussed it with NCL team and changes in WinHttpHandler.csproj are correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. we will take for consideration in 8.0.x
For 8.0, the only additional testing I did was inspect the IL for the library built for 6.0 to validate it is simply a |
Friendly reminder that Monday July 15th is Code Complete day, that's the deadline to get this included in the August Release. |
09784cd
into
dotnet:release/8.0-staging
Backport of #104416 to release/8.0-staging
cc @dotnet/ncl for
WinHttpHandler
Customer Impact
Libraries built out of dotnet/runtime using
LibraryImport
targeting .NET 6 can end up with some parameters that are marshalled by generated source and some that are simply forwarded to aDllImport
, such that the generatedDllImport
signature is still not blittable. This can result in some parameters being incorrectly marshalled, as the generatedDllImport
does not have all the metadata/attributes needed for those parameters. In theWinHttpHandler
package, this hit an issue whereStringBuilder
was no longer marshalled as expected and using the function fails at runtime.This fix makes it so that if any parameter cannot be marshalled by the source generator, it simply forwards everything to a
DllImport
. It eliminates there is no scenario where a stub is generated that marshals some parameters and forwards the rest (without erroring).Regression
This is a regression when using the LibraryImport source generator to target .NET 6 (down-level support that only exists for the dotnet/runtime repo) building out of the .NET 8 branch.
Testing
Manual verification. Automated tests added.
Risk
Low. This is down-level support that exists for dotnet/runtime only. While it could affect anything using the
LibraryImport
targeting .NET 6, the switch to just forwarding toDllImport
(instead of generating something that only marshals some parameters) is low risk.Other
ServicingVersion
forSystem.Net.Http.WinHttpHandlers