Bug - Dispose pattern - csharpsquid:S3881

SonarQube version: 9.9.3 (build 79811)
Sonar Scanner version: 6.2.0.85879

SonarQube or scanner don’t takes care about a heading “this.” at method call in the Dispose pattern.

image

image

image

Test code

public class TestDisposable :
  IDisposable
{
  ~TestDisposable()
  {
    this.Dispose(false)
  }

  public Dispose()
  {
    this.Dispose(true);

    GC.SuppressFinalize(this);
  }

  private Dispose(Boolean disposing)
  {
    // Dispose activities
  }
}

Placed as issue here too: Fix S3881 FP: Take care of reference with current instance keyword "this." · Issue #9452 · SonarSource/sonar-dotnet · GitHub

Hey there.

I’ve moved your post to the section on reporting false-positives.

Can you please update your post with a text-based sample of code (no screenshots) that reproduces the issue?