[ComInterfaceGenerator] Recommend [In] and [Out] attributes on array parameters #91231
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.