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

Fix S2368 FN: inline arrays #8100

Open
antonioaversa opened this issue Sep 27, 2023 · 1 comment
Open

Fix S2368 FN: inline arrays #8100

antonioaversa opened this issue Sep 27, 2023 · 1 comment
Labels
Area: C# C# rules related issues. Area: C#12 C#12 related issues Type: False Negative Rule is NOT triggered when it should be.

Comments

@antonioaversa
Copy link
Contributor

antonioaversa commented Sep 27, 2023

An array of an inline array, while not being explicitly defined as a multidimensional or jagged array, has the same memory layout of those. Moreover, it is accessed in the same way (via double []), and can be as "challenging for developers" (as mentioned by the RSPEC of S2368) and unintuitive as normal multidimensional arrays (c.p. this discussion).

For these reasons, S2368 should report on them.

public void AMethod1(Buffer[] a) { }          // FN, Buffer[] is 2-dimensional
public void AMethod2(params Buffer[] a) { }   // Compliant, params of Buffer
public void AMethod3(params Buffer[][] a) { } // Noncompliant, params of Buffer[]

Related issues:

@antonioaversa
Copy link
Contributor Author

Testing of this issue requires the UnitTest project to work with .NET 8, that is currently not possible due to issue described in this Trello card.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Area: C#12 C#12 related issues Type: False Negative Rule is NOT triggered when it should be.
Projects
None yet
Development

No branches or pull requests

4 participants