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

Problem if InvokationExpression called on ObjectCreation returns an IDisposable #25

Closed BADF00D closed 7 years ago

BADF00D commented 7 years ago
using System;
using System.IO;
namespace DisFixerTest.Factory {
    public class ClassThatStoredObjectCreationLocally2 {
        public IDisposable Create() {
            var inst = new MemoryStreamFactory().Create(); //this should yield a diagnostic

            return null;
        }

        internal class MemoryStreamFactory {
            public IDisposable Create() {
                return new MemoryStream();
            }
        }
    }
}