DotNetAnalyzers / StyleCopAnalyzers

An implementation of StyleCop rules using the .NET Compiler Platform
MIT License
2.65k stars 508 forks source link

When using the new collection initializer [] no SA1010 should be raised. #3850

Closed Willimaendu closed 4 months ago

Willimaendu commented 4 months ago

When having the following code:

List<string> list = [];

A warning "SA1010 Opening square brackets should not be preceded by a space" will be triggered. This should not happen when using the new collection initializer [].

bjornhellander commented 4 months ago

I am unable to reproduce this using the latest beta. Looks like you just need to upgrade.

bjornhellander commented 4 months ago

Duplicate of #3687

dciborow commented 4 months ago

I have just upgraded to 1.2.0-beta.556 and see this is fixed.

With shift to .net8 picking up folks may be seeing this more but not be getting the latest package because of the beta tag.

Willimaendu commented 4 months ago

Thanks, we upgraded to the newest package and now everything works!

twojnarowski commented 3 weeks ago

I also stumbled upon this issue... Why there hasn't been a new release in 5 years and we have to use beta versions?

mu88 commented 2 weeks ago

@sharwell can you answer @twojnarowski's question?