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

Recommend [In] and [Out] attributes on array parameters #91094

Merged
merged 5 commits into from
Aug 25, 2023

Conversation

jtschuster
Copy link
Member

@jtschuster jtschuster commented Aug 24, 2023

Fixes #90884

Adds an info diagnostic for interop generators that nudges users to add [In] or [Out] attributes to arrays.

Ensures only arrays are allowed to have [In] or [Out] attributes. Previously, other pinned custom collections would allow them.

Separates tests related to [In] and [Out] attributes to their own files in both unit test projects.

Moves some shared test utilities to shared code (ID(), GetCallerLineNumber())

@ghost
Copy link

ghost commented Aug 24, 2023

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

Issue Details

Adds an info diagnostic for interop generators that nudges users to add [In] or [Out] attributes to arrays.

Ensures only arrays are allowed to have [In] or [Out] attributes. Previously, other pinned custom collections would allow them.

Separates tests related to [In] and [Out] attributes to their own files in both unit test projects.

Moves some shared test utilities to shared code (ID(), GetCallerLineNumber())

Author: jtschuster
Assignees: jtschuster
Labels:

area-System.Runtime.InteropServices

Milestone: -

@jtschuster jtschuster merged commit f3e6b1b into dotnet:main Aug 25, 2023
@jtschuster
Copy link
Member Author

/backport to release/8.0

@github-actions
Copy link
Contributor

Started backporting to release/8.0: https://github.com/dotnet/runtime/actions/runs/6004060617

@github-actions
Copy link
Contributor

@jtschuster backporting to release/8.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: wip
Using index info to reconstruct a base tree...
M	src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.cs.xlf
M	src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.de.xlf
M	src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.es.xlf
M	src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.fr.xlf
M	src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.it.xlf
M	src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ja.xlf
M	src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ko.xlf
M	src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pl.xlf
M	src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pt-BR.xlf
M	src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ru.xlf
M	src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.tr.xlf
M	src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hans.xlf
M	src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hant.xlf
M	src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/SharedTypes.csproj
Falling back to patching base and 3-way merge...
Auto-merging src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/SharedTypes.csproj
CONFLICT (content): Merge conflict in src/libraries/System.Runtime.InteropServices/tests/TestAssets/SharedTypes/SharedTypes.csproj
Auto-merging src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hant.xlf
Auto-merging src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.zh-Hans.xlf
Auto-merging src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.tr.xlf
Auto-merging src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ru.xlf
Auto-merging src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pt-BR.xlf
Auto-merging src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.pl.xlf
Auto-merging src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ko.xlf
Auto-merging src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.ja.xlf
Auto-merging src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.it.xlf
Auto-merging src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.fr.xlf
Auto-merging src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.es.xlf
Auto-merging src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.de.xlf
Auto-merging src/libraries/System.Runtime.InteropServices/gen/Common/Resources/xlf/Strings.cs.xlf
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 wip
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@github-actions
Copy link
Contributor

@jtschuster an error occurred while backporting to release/8.0, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

jtschuster added a commit to jtschuster/runtime that referenced this pull request Aug 28, 2023
…parameters (dotnet#91094)

Recommend that methods with array parameters use [In] or [Out] attributes if there are none already, and the parameter is not in, ref, or out.
carlossanlop pushed a commit that referenced this pull request Aug 28, 2023
…parameters (#91094) (#91231)

Recommend that methods with array parameters use [In] or [Out] attributes if there are none already, and the parameter is not in, ref, or out.
@radical radical mentioned this pull request Sep 26, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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