Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
galarlo opened this issue Aug 21, 2023 · 0 comments
Open

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

galarlo opened this issue Aug 21, 2023 · 0 comments

Comments

@galarlo
Copy link

galarlo commented Aug 21, 2023

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?
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant