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

Possibility to ignore certain classes or methods #14

Closed dscopra closed 7 years ago

dscopra commented 7 years ago

In some cases it is not needed to analyse the classes. E.g if you are creating a DesignViewModel in WPF, becauses these instances are never instantiated at runtime. Another cases is, when you are using factories, that track the instances they are creating. Then you have to release the instances to the factory and they will to the disposing for you.

dscopra commented 7 years ago

E.g Task is an IDisposable but Disposing is not necessary: https://blogs.msdn.microsoft.com/pfxteam/2012/03/25/do-i-need-to-dispose-of-tasks/

dscopra commented 7 years ago

Another example that should yield no diagnostics:

private static Stream OpenNetworkStream(IPAddress ip_address, int port) {
    var listerner = new TcpListener(ip_address, port);
    listerner.Start();
    var socket = listerner.AcceptSocket();
    return new NetworkStream(socket);
}

This is now part of issue #16