-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Fix failures around blittable collections with [Out] and chars #89149
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
Conversation
Tagging subscribers to this area: @dotnet/interop-contrib Issue DetailsFixes #88708
|
@@ -124,7 +128,8 @@ public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeCont | |||
|
|||
public bool UsesNativeIdentifier(TypePositionInfo info, StubCodeContext context) | |||
{ | |||
return context.IsInStubReturnPosition(info) || (info.IsByRef && !context.SingleFrameSpansNativeContext); | |||
MarshalDirection elementMarshalDirection = MarshallerHelpers.GetMarshalDirection(info, context); | |||
return !IsPinningPathSupported(info, context) && (elementMarshalDirection != MarshalDirection.ManagedToUnmanaged || info.IsByRef); |
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.
Nit: I find it easier to reason about when can we pass the managed identifier to a native parameter without changing anything, and then this method is not
that, but I'm also fine with whatever makes the most sense to you.
return !IsPinningPathSupported(info, context) && (elementMarshalDirection != MarshalDirection.ManagedToUnmanaged || info.IsByRef); | |
return !(IsPinningPathSupported(info, context) || (elementMarshalDirection == MarshalDirection.UnmanagedToManaged && !info.IsByRef)); |
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'd rather keep it as is as the current condition better matches the code in Generate
I think.
Fixes #88708