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

There should be exceptions for fields and properties not disposed in Dispose-method #55

Closed dscopra closed 7 years ago

dscopra commented 7 years ago

Prerequisites

Description

In some situations it is impractical to enforce to dispose all fields and properties in Dispose-method. For instance in Unit Test there is often a special way for tearing down your tests. E.g. in Spec Test, the cleanup tasks are done within a method named Cleanup. In NUnit 2 Tests there is a method with an attribute called TearDownAttribute.

In fact it does not hurt, when these fields and properties get disposed in Dispose method, too, But it is extra work only to tell the extension, that everything is ok.

My proposal is, to allow dispose of fields and properties in more than the Dispose method. It also can be restricted to certain user-defined method in used-defined class. E.g.: Cleanup in classes that derive from Spec. Method with attribute called Teardown

Source Code

Screenshot

image

BADF00D commented 7 years ago

Will be part of release 0.28