Skip to content

Disposable factory - expected to see a warning, but there wasn't  #521

Open
@galarlo

Description

I have a factory class which creates IDisposables. I expect to see a warning when using the factory without disposing it's result.
However, ther is no warning.

Is there anything I can do to make a warning appear?

Here's a simplified code snippet:

public interface IDisposableFactory
{
    IDisposable Create();
}

public class Example
{
    void Example(IDisposableFactory factory)
    {
         IDisposable disposable = factory.Create(); // why no warning?
    }
}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions