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 S1144 FN: Unused private getters and private setters #6724

Closed
zsolt-kolbay-sonarsource opened this issue Feb 6, 2023 · 0 comments · Fixed by #9098
Closed

Fix S1144 FN: Unused private getters and private setters #6724

zsolt-kolbay-sonarsource opened this issue Feb 6, 2023 · 0 comments · Fixed by #9098
Assignees
Labels
Area: C# C# rules related issues. Area: VB.NET VB.NET rules related issues. Sprint: Hardening Fix FPs/FNs/improvements Type: False Negative Rule is NOT triggered when it should be.
Milestone

Comments

@zsolt-kolbay-sonarsource
Copy link
Contributor

Description

S1144 does not highlight unused private getters or setters when they are inside a public property.

Repro steps

public class PropertyAccess
{
    public int PrivateGetter { private get; set; } // FN - unused private getter
    public int PrivateSetter { get; private set; } // FN - unused private setter

    public int ExpressionBodiedPropertyWithPrivateGetter { private get => 1; set => _ = value; } // FN - unused private getter
    public int ExpressionBodiedPropertyWithPrivateSetter { get => 1; private set => _ = value; } // FN - unused private setter
}

Expected behavior

An issue should be raised for the unused getter or setter.

Actual behavior

No issue is raised.

Known workarounds

None.

Related information

  • C#/VB.NET Plugins version: 8.52
  • Visual Studio version: 2022 17.4.4
  • Operating System: Windows 10 Pro (10.0.19045)
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. Sprint: Hardening Fix FPs/FNs/improvements 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