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

SA1000 doesn't handle 'target-typed' new #3214

Closed
davkean opened this issue Oct 2, 2020 · 3 comments
Closed

SA1000 doesn't handle 'target-typed' new #3214

davkean opened this issue Oct 2, 2020 · 3 comments

Comments

@davkean
Copy link

davkean commented Oct 2, 2020

With C# 9.0, SA1000 complains about "target type new expressions":

private readonly object syncObject = new();

Expected:

No message:

Actual:

Severity	Code	Description	Project	File	Line	Suppression State
Error	SA1000	The keyword 'new' should be followed by a space.	Microsoft.VisualStudio.ProjectSystem	C:\CPS\src\Microsoft.VisualStudio.ProjectSystem\Build\Logging\ProjectBuildTargetErrorList.cs	21	Active

@sharwell
Copy link
Member

sharwell commented Oct 2, 2020

This was fixed by #3187

@sharwell sharwell closed this as completed Oct 2, 2020
@sharwell sharwell added this to the 1.2-beta.next milestone Oct 2, 2020
smfeest added a commit to smfeest/buttercup that referenced this issue Sep 28, 2021
The current stable release of the StyleCop.Analyzers package incorrectly
raises SA1000 warnings on target-typed new expressions [1].

[1] DotNetAnalyzers/StyleCopAnalyzers#3214
@bstoinev
Copy link

bstoinev commented Jun 7, 2024

I know this is an old issue that is supposed to be fixed but I can still see the exactly described message when using target-typed new()

I'm using VS2022 with StyleCop.Analyzers 1.1.18 NuGet package.

@sharwell
Copy link
Member

sharwell commented Jun 7, 2024

We try to always assign milestones to fixed issues so it's easy to compare versions. This one was released in 1.2.0-beta.261.

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