Fix S1854 FP: Raises when variable is reassigned in a using body after it has been already assigned in using statement.
Opened this issue · 0 comments
mary-georgiou-sonarsource commented
Description
Please provide a succinct description of your issue. Also please provide the rule ID (e.g. S1234)
Repro steps
void Repro(IDisposable data)
{
using (data = Something()) // Noncompliant
{
data = Something(); // Noncompliant FP
}
if (data != null)
{
Console.WriteLine("Hello");
}
IDisposable Something() => null;
}