-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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/5.0] P/Invoke function returning SafeSocketHandle throws MissingMethodException (#45911) #45942
Conversation
…ption (dotnet#45911) * P/Invoke function returning SafeSocketHandle throws MissingMethodException The ILLinker is trimming the private default constructors of SafeHandle classes if they are not used by the library. Adding an XML descriptor file to preserve the private constructors of these SafeHandles so they can be used in P/Invokes in external code. Fix dotnet#45633 Suppress P/Invoke test on Browser
Tagging subscribers to this area: @dotnet/ncl Issue DetailsDescriptionThe ILLinker is trimming the private default constructors of SafeHandle classes if they are not used by the library. Adding an XML descriptor file to preserve the private constructors of these SafeHandles so they can be used in P/Invokes in external code. Customer ImpactIf an app is using SafeSocketHandle as the return of a P/Invoke and upgrades from 3.1 to 5.0, the app is broken with TestingAdded 2 new tests for the SafeHandles identified as problematic to ensure customers can P/Invoke using these classes. RiskLow Fix #45633
|
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.
Approved. We should consider this for 5.0.2
This is broken in the release/5.0 branch because of some build infrastructure differences between master and release/5.0. (Thank you, tests!) Working on a fix. |
…astructure expects them.
The single test failure is #43981.
|
Description
The ILLinker is trimming the private default constructors of SafeHandle classes if they are not used by the library. Adding an XML descriptor file to preserve the private constructors of these SafeHandles so they can be used in P/Invokes in external code.
Customer Impact
If an app is using SafeSocketHandle as the return of a P/Invoke and upgrades from 3.1 to 5.0, the app is broken with
System.MissingMethodException: .ctor
. There isn't a workaround other than not usingSafeSocketHandle
in the P/Invoke signature.Testing
Added 2 new tests for the SafeHandles identified as problematic to ensure customers can P/Invoke using these classes.
Risk
Low
Fix #45633