Open
Description
Consider code like the following:
public Task MyMethodAsync()
{
using (SomeIDisposable disposable = new SomeIDisposable())
{
...
return SomethingAsync(disposable); // or fire-and-forget
}
}
There's a high likelihood that this Task-returning SomethingAsync will be using the SomeIDisposable instance long after it's been disposed. We should consider an analyzer that flags such situations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment