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: Value used in catch or when should LiveIn for all try blocks #9447

Closed
pavel-mikula-sonarsource opened this issue Jun 20, 2024 · 0 comments · Fixed by #9449
Closed
Assignees
Labels
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

Should not raise in complex scenarios related to Roslyn LVA:

public void UsedInFinally()
{
            int value = 42; // Noncompliant FP
            try
            {
                SomethingThatCanThrow();
                value = 0;
            }
            catch
            {
                Use(value);
            }
}
@pavel-mikula-sonarsource pavel-mikula-sonarsource added this to the 9.28 milestone Jun 20, 2024
@pavel-mikula-sonarsource pavel-mikula-sonarsource added 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. Sprint: LVA labels Jun 20, 2024
@pavel-mikula-sonarsource pavel-mikula-sonarsource changed the title Fix S1854 FP: Value used in catch should LiveIn for all try blocks Fix S1854 FP: Value used in catch or when should LiveIn for all try blocks Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants