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 finally should LiveIn after throw #4948

Closed
pavel-mikula-sonarsource opened this issue Oct 4, 2021 · 0 comments · Fixed by #9439
Closed

Fix S1854 FP: Value used in finally should LiveIn after throw #4948

pavel-mikula-sonarsource opened this issue Oct 4, 2021 · 0 comments · Fixed by #9439
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 Oct 4, 2021

Should not raise in complex scenarios related to Roslyn LVA:

Finally should link predecessors/sucessors to all blocks of try.

public void UsedInFinally_Throw()
{
    var value = 42; // Noncompliant FP related to LVA
    try
    {
        throw new Exception();
    }
    finally
    {
        Use(value);
    }
}
@pavel-mikula-sonarsource pavel-mikula-sonarsource added 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. labels Oct 4, 2021
@andrei-epure-sonarsource andrei-epure-sonarsource changed the title Fix S1854 FPs: Value used in finally should LiveIn for all try blocks S1854 FPs: Value used in finally should LiveIn for all try blocks Oct 14, 2022
@andrei-epure-sonarsource andrei-epure-sonarsource changed the title S1854 FPs: Value used in finally should LiveIn for all try blocks S1854 FPs: Value used in finally should LiveIn for all try blocks Oct 14, 2022
@mary-georgiou-sonarsource mary-georgiou-sonarsource modified the milestones: 9.27, 9.28 Jun 10, 2024
@pavel-mikula-sonarsource pavel-mikula-sonarsource changed the title S1854 FPs: Value used in finally should LiveIn for all try blocks Fix S1854 FPs: Value used in finally should LiveIn for all try blocks Jun 17, 2024
@pavel-mikula-sonarsource pavel-mikula-sonarsource changed the title Fix S1854 FPs: Value used in finally should LiveIn for all try blocks Fix S1854 FP: Value used in finally should LiveIn after throw Jun 17, 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. 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