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

Non IDisposables are marked as not Dispose within a property #92

Closed BADF00D closed 6 years ago

BADF00D commented 6 years ago

Prerequisites

Description

When creating a object that does not implement IDisposable, it is marked as not disposed.

Source Code

namespace SelectManyTest
{
    internal class Dummy
    {
        #region ObjectCreations
        //Here Should be no "Property not disposed" warning
        public object ObjectCreationWithGetter{get { return new object(); }}
        public object ObjectCreationWithGetterAndLocalVariable{
            get{
                var objectCreationWithGetterAndLocalVariable = new object();
                return objectCreationWithGetterAndLocalVariable;
            }}
        public object ObjectCreationWithExpressionBody => new object();

        #endregion

        #region Constants
        public object Constant{get { return 0; }}
        public object ConstantWithExpressionBody => 0;
        #endregion

        #region MethodInvocation
        public object MethodInvaocationWithGetter{get { return Create(); }}
        public object MethodInvaocationWithExpressionBody => Create();
        public object Create() => new object();
        #endregion
    }
}

Screenshot

image

BADF00D commented 6 years ago

Will be part of release 1.1.2