-
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
[ComInterfaceGenerator] Recommend [In] and [Out] attributes on array parameters #91231
[ComInterfaceGenerator] Recommend [In] and [Out] attributes on array parameters #91231
Conversation
…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.
Tagging subscribers to this area: @dotnet/interop-contrib Issue DetailsBackport of #91094 Provide an info diagnostic to recommend that source-generated interop methods with array parameters use [In] or [Out] attributes if there are none already and the parameter is not in, ref, or out. Remove the "unnecessary info" diagnostics when the default behavior [In] and [Out] attributes are added. There are no changes to code generation, and much of the diff is test refactoring and resource files.
|
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. please get a code review. once ready this pr can be merged.
@AaronRobinsonMSFT / @jkoritzinsky can you please give a code review sign-off? |
Backport of #91094
Provide an info diagnostic to recommend that source-generated interop methods with array parameters use [In] or [Out] attributes if there are none already and the parameter is not in, ref, or out. Remove the "unnecessary info" diagnostics when the default behavior [In] and [Out] attributes are added.
There are no changes to code generation, and much of the diff is test refactoring and resource files.
Customer Impact:
Arrays are the most complicated parameter type to understand as a user and is the main subject of many bugs filed against the generator. To ensure writers and readers of code understand the expected behavior and direction of marshalling for the elements of the array, we want to encourage using the [In] and [Out] attributes.
Customers who had to silence "Unnecessary Marshalling Info" diagnostics will have unnecessary suppressions.
Customers who don't use [In] or [Out] on arrays will get new info diagnostics.
Testing:
More unit testing was added to ensure the behavior was correctly updated, and it has been confirmed to work in Visual Studio.
Risk:
Very low, since there is no change to generated code, only to info diagnostics for array parameters in LibraryImport and GeneratedComInterface.