-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Description
Describe the bug
The StyleCop rule SA1011
("Closing square brackets must be followed by a space") incorrectly prevents declaring nullable arrays, where the ?
operator is used directly after the closing []
. The rule currently enforces a space between the closing square bracket ]
and the nullable operator ?
, which is syntactically incorrect and blocks proper nullable array usage.
To Reproduce
- Create a C# file and attempt to declare a nullable array.
int[]? nyNummableArray = null;
Expected behavior
StyleCop should allow the ?
operator to be placed immediately after the closing square bracket []
in a nullable array declaration, as this is valid syntax in C#.
Actual behavior
StyleCop reports an SA1011
violation:
SA1011: Closing square bracket must be followed by a space.
This causes an error, suggesting that there should be a space between ]
and ?
, which is syntactically invalid in C#.