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

ComInterfaceGenerator should provide an info message when arrays don't have any [In] or [Out] attributes #90884

Closed
jtschuster opened this issue Aug 21, 2023 · 1 comment · Fixed by #91094

Comments

@jtschuster
Copy link
Member

jtschuster commented Aug 21, 2023

The default for arrays is different than built in COM, and arrays are especially confusing. To help ensure people know what to expect from the generated code, we should nudge people to use [In] and [Out] attributes explicitly with an info message and code-fix to annotate the method to get the built-in COM behavior.

In particular, arrays of pinnable elements are [In] by default, but pin for performance reasons in managed to unmanaged. This means the managed to unmanaged behavior will still match built in com, but unmanaged to managed will not marshal out.

Since we now want to prefer explicit attributes, we also should remove the "Unnecessary [In] and [Out] attributes" info message.

@ghost
Copy link

ghost commented Aug 21, 2023

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

Issue Details

The default for arrays is different than built in COM, and arrays are especially confusing. To help ensure people know what to expect from the generated code, we should nudge people to use [In] and [Out] attributes explicitly with an info message and code-fix to annotate the method to get the built-in COM behavior.

In particular, arrays of pinnable elements are [In] by default, but pin for performance reasons in managed to unmanaged. This means the managed to unmanaged behavior will still match built in com, but unmanaged to managed will not marshal out.

Author: jtschuster
Assignees: -
Labels:

area-System.Runtime.InteropServices

Milestone: 8.0.0

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Aug 24, 2023
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Aug 25, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant