-
Notifications
You must be signed in to change notification settings - Fork 231
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 AD0001 in S1144: Implicit object creation inside collection expression #8024
Comments
Root cause: private static Line[] ThisIsTheRootCause() => [new(0)]; // Fails here: implicit object creation inside a collection literal (new in C# 12)
// ^^^^^^^^ This results in |
Should be an issue on Roslyn`s side: dotnet/roslyn#70041 |
Description
Hi,
I am currently migrating a lib project to .net 8 and I received an exception from
UnusedPrivateMember
analyzer.Here is the AD0001 message:
Repro steps
Create a new console app using VS 2022 17.8.0 Preview 2.0. Add SonarAnalyzer.CSharp, .csproj would be like:
Add this file to the project:
Execute "Run Code Analysis on Solution" command:
Known workarounds
Suppressing the mentioned analyzers (S1144, S4487) in exception message does NOT resolve the issue.
Related information
The text was updated successfully, but these errors were encountered: