dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.06k stars 4.69k forks source link

Custom Marshaller analyzers don't warn when MarshalUsing.CountElementName is set on a parameter that isn't a collection #90259

Open jtschuster opened 1 year ago

jtschuster commented 1 year ago

The following code should probably warn that the MarshalUsing.CountElementName is unnecessary if the marshaller is not a collection marshaller.

interface IFoo
{
  void Method([MarshalUsing(CountElementName=nameof(size))] CustomType p, int size);
}
ghost commented 1 year ago

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

Issue Details
The following code should probably warn that the MarshalUsing.CountElementName is unnecessary if the marshaller is not a collection marshaller. ```C# interface IFoo { void Method([MarshalUsing(CountElementName=nameof(size))] CustomType p, int size); } ```
Author: jtschuster
Assignees: -
Labels: `area-System.Runtime.InteropServices`
Milestone: 9.0.0