DotNetAnalyzers / IDisposableAnalyzers

Roslyn analyzers for IDisposable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IDISP013 should not warn when not using the disposable

JeremyMorton opened this issue · comments

I am seeing this with ValueTask<> return types:

image

  public ValueTask<int> M1Async()
  {
    using (var disposable = new Disposable())
    {
      return new ValueTask<int>(disposable.Equals(disposable) ? 1 : 0);
    }
  }

  public ValueTask<int> M2Async()
  {
    using (var disposable = new Disposable())
    {
      var i = disposable.Equals(disposable) ? 1 : 0;
      return new ValueTask<int>(i);
    }
  }

This is a perfect issue, thanks!
Sorry about the bug

This also happens if the return line for a method that returns a ValueTask is just return default;

We fix things issue by issue, I don't use ValueTask much hence the spotty support

No problem! I appreciate the responsiveness.

I have not had much time for this library so responsiveness has not been great.