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 S1854 FP: Throw should connect to outer catch #9468

Closed
pavel-mikula-sonarsource opened this issue Jun 26, 2024 · 0 comments · Fixed by #9528
Closed

Fix S1854 FP: Throw should connect to outer catch #9468

pavel-mikula-sonarsource opened this issue Jun 26, 2024 · 0 comments · Fixed by #9528
Assignees
Labels
Area: C# C# rules related issues. Area: CFG/SE CFG and SE related issues. Type: CFG/SE FPs Rule IS triggered when it shouldn't be for CFG and SE rules.
Milestone

Comments

@pavel-mikula-sonarsource
Copy link
Contributor

pavel-mikula-sonarsource commented Jun 26, 2024

This is similar to #9466

    public void NestedCatchAndRethrow()
    {
        var value = 100;
        try
        {
            try
            {
                CanThrow();
            }
            catch
            {
                value = 200;    // Noncompliant FP
                throw;
            }
        }
        catch
        {
            Log(value);
        }
    }
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: CFG/SE CFG and SE related issues. Type: CFG/SE FPs Rule IS triggered when it shouldn't be for CFG and SE rules.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants