Skip to content

Fix for DisposeAsync when maybe null #201

Open
@JohanLarsson

Description

@JohanLarsson

Before:

#nullable enable
namespace N
{
    using System;
    using System.IO;
    using System.Threading.Tasks;

    public class C : IAsyncDisposable
    {private readonly IAsyncDisposable? disposable = File.OpenRead(string.Empty);

        public ValueTask DisposeAsync()
        {
            return default(ValueTask);
        }
    }
}

Not sure how we should generate the null check.
Only offering fix when notnull for now. Nullable case is likely rare.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions