Skip to content

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

@pavel-mikula-sonarsource

Description

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);
    }
}

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions