The false positive described in C#9 - FP linked to private constructors and the new terse new() syntax? is still occurring for me when using SonarScanner version 5.13 SonarScanner for .NET
I’ve copied the old topic below:
There appears to be a bug with private constructors and the new terse new() syntax ( Target-typed new leading to
Code Smell: Remove the unused private constructor
public class Foo
{
private Foo()
{
}
public static Foo Create()
{
return new();
}
}
Colin
(Colin)
May 5, 2023, 6:16am
2
Hey there.
Can you tell us what product you’re using (SonarLint, SonarQube, SonarCloud), and if relevant, what version?
SonarQube Community Edition Version 8.9.9 (build 56886)
Colin
(Colin)
May 5, 2023, 1:06pm
4
Thanks.
Hi,
Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:
8.9.10 → 9.9 → 10.0 (last step optional)
You may find these resources helpful:
If you have questions about upgrading, feel free to open a new thread for that here .
If you still face the issue persists after upgrade, please come back to us.
Thanks, I’ll work to get it updated and check for the issue again.