csharpsquid:S1481 false positive for using statement

  • SonarAnalyzer (C#)
  • csharpsquid:S1481
  • According to documentation for (Unused local variables should be removed)-
using(var t = new TestTimer()) // t never used, but compliant.

BUT when using c# 8 syntax without curly braces -

using var t = new TestTimer()

the rule is triggered

Hi @Adam_Dove,

Thank you for reporting this case. We can confirm this as False Positive. We already have this issue to track it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.