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

False positive: SA1010 cannot handle the new list-initializer syntax #3756

Closed
hdkesting opened this issue Dec 19, 2023 · 2 comments
Closed

Comments

@hdkesting
Copy link

hdkesting commented Dec 19, 2023

With C#12, you can do this:

int[] a = [1, 2, 3, 4, 5, 6, 7, 8];

(note the square brackets around the list of numbers)
However, Stylecop gives an SA1010 warning (Opening square brackets must not be preceded by a space) on the [ just before the 1.
The warning would be correct for int []

ref: https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12#collection-expressions

@bjornhellander
Copy link
Contributor

Duplicate of #3687. Fixed, but not yet released.

@sharwell
Copy link
Member

Duplicate of #3687

@sharwell sharwell marked this as a duplicate of #3687 Dec 19, 2023
@sharwell sharwell closed this as not planned Won't fix, can't repro, duplicate, stale Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants