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

Subscribe of Rx yields an IDisposable - but it is not marked as not disposed #26

Closed dscopra closed 7 years ago

dscopra commented 7 years ago

image

dscopra commented 7 years ago

This problem only occurs, when return value of Subscribe() is not stored in a local variable.

BADF00D commented 7 years ago

I was able to reproduce the problem with the following code:

using System.IO;
namespace DisFixerTest.MethodCall {
    class MethodCallWithoutSavingReturnValue {
        public MethodCallWithoutSavingReturnValue() {
            Create();
        }
        private MemoryStream Create() {
            return new MemoryStream();
        }
    }

}
BADF00D commented 7 years ago

Fixed