BADF00D / DisposableFixer

This is a Visual Studio Extension and NuGet package that should identify and fix problems as memleaks while using IDisposables.
Other
35 stars 7 forks source link

Disposable hidden behind an interface is not recognized correctly #41

Closed dscopra closed 7 years ago

dscopra commented 7 years ago

If an ObjectCreation of MethodInvokation returns an IDisposable that is assigned to a field variables that is not IDisposable, there is hint that this is an undisposed IDisposable.

public interface IDoNothing{}
public class Implementation : IDoNothing, IDisposable{
    public void Dispose(){}
}

public class Usage{
    private readonly IDoNothing _object;
    public Usage(){
        _object = new Implementation(); //this is an undisposed IDisposable that is not recognized
    }
}
BADF00D commented 7 years ago

I checked releases down to version 0.21, but I was not able reproduce the problem.

image

dscopra commented 7 years ago

In version 0.22 and 0.23 I'm not able to reproduce the error any more