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

Fix S2234 FN: this and base constructors #8070

Closed
antonioaversa opened this issue Sep 25, 2023 · 0 comments · Fixed by #8238
Closed

Fix S2234 FN: this and base constructors #8070

antonioaversa opened this issue Sep 25, 2023 · 0 comments · Fixed by #8238
Assignees
Labels
Area: C# C# rules related issues. Area: VB.NET VB.NET rules related issues. Type: False Negative Rule is NOT triggered when it should be.
Milestone

Comments

@antonioaversa
Copy link
Contributor

The current implementation of S2234 doesn't take into account constructor invocations,

class SomeClass
{
    public SomeClass(int a, int b) { }
    public SomeClass(int a, int b) : this(b, a) { } // FN: ctor params are inverted
}

Notice that invocations via new are supported.

void Test(int a, int b, int c)
{
    _ = new SomeClass(b, a);                  // Noncompliant, inverted
}

class SomeClass
{
    public SomeClass(int a, int b) { }        // Secondary
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Area: VB.NET VB.NET rules related issues. Type: False Negative Rule is NOT triggered when it should be.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants