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

Field/Property assigned via await is not detected when field/property is only an IDisposable #123

Open BADF00D opened 5 years ago

BADF00D commented 5 years ago

Prerequisites

Description

When I assigned an MemoryStream via await to a field that is an not disposed IDisposable, this is not detected.

Source Code

namespace SomeNamespace
{
    public class SomeClass
    {
        private IDisposable _mem;

        public async Task Do()
        {
            _mem = await Create();
        }
        public Task<MemoryStream> Create()
        {
            return Task.FromResult(new MemoryStream());
        }
    }
}

Screenshot

image

BADF00D commented 5 years ago

the problem is, that GetAwaitExpressionInfo returns null, This might by a problem in roslyn fixed in version 3.x. But in order to upgrade to these, first we have to migrate to .Net Standard 2.0

BADF00D commented 5 years ago

Blocked by #126

BADF00D commented 4 years ago

Same result with Roslyn 3.3.1