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 S2372 FP: Add support for method invocations #8611

Closed
gregory-paidis-sonarsource opened this issue Jan 25, 2024 · 0 comments · Fixed by #8582
Closed

Fix S2372 FP: Add support for method invocations #8611

gregory-paidis-sonarsource opened this issue Jan 25, 2024 · 0 comments · Fixed by #8582
Assignees
Labels
Area: C# C# rules related issues. Type: False Positive Rule IS triggered when it shouldn't be.
Projects
Milestone

Comments

@gregory-paidis-sonarsource
Copy link
Contributor

Description

If a property getter throws an exception of the allowed types via method Invocation, the rule raises.

Repro steps

        public int MyProperty
        {
            get
            {
                throw Method(); // Noncompliant FP
            }
        }

        private NotSupportedException Method() =>      
            new NotSupportedException(); // Belongs to the whitelisted exception types.
        

Expected behavior

The rule should not raise.

Actual behavior

The rule raises.

@gregory-paidis-sonarsource gregory-paidis-sonarsource added Type: False Positive Rule IS triggered when it shouldn't be. Area: C# C# rules related issues. labels Jan 25, 2024
@gregory-paidis-sonarsource gregory-paidis-sonarsource added this to Validate Peach in Best Kanban Feb 7, 2024
@gregory-paidis-sonarsource gregory-paidis-sonarsource moved this from Validate Peach to Done in Best Kanban Feb 8, 2024
@Tim-Pohlmann Tim-Pohlmann added this to the 9.20 milestone Feb 20, 2024
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. Type: False Positive Rule IS triggered when it shouldn't be.
Projects
Best Kanban
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants