DisposableFixer 1.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package DisposableFixer --version 1.4.0
NuGet\Install-Package DisposableFixer -Version 1.4.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DisposableFixer" Version="1.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DisposableFixer --version 1.4.0
#r "nuget: DisposableFixer, 1.4.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DisposableFixer as a Cake Addin
#addin nuget:?package=DisposableFixer&version=1.4.0

// Install DisposableFixer as a Cake Tool
#tool nuget:?package=DisposableFixer&version=1.4.0

DisposableFixer

This is a small analyzer package (also availbale as Visual Studio Extension) that should identify and fix problems as memleaks while using IDispoables. You can download the Visual Stuido Extension via Visual Studio Gallery or using Visual Studio Extension Manager.

This project is in early stage. Currently it has some known false positive and false negative results. Furthermore there are no code fixes available at the moment.

How It works

In order to check for undisposed IDispoables, there is an Roslyn analyser that registers for two syntax node actions:

  • ObjectCreation - something like new MemoryStream()
  • InvocationExpression - something like CreateMemoryStream()

Currently these both are considered the only possibilities where IDispoables can be created.

Every time one of the actions is triggered, the static code analyzer starts analyzing. The first thing the analyzer tries to find out is, whether the given expression created is actually an IDisposables. Otherwise the analysis is aborted. After that, the analyzer tries to find out, whether this IDisposable have to be disposed manually and if so, it checks if it is actually disposed, otherwise an diagnostics is reported.

When is a IDisposables considered as disposed?

Generally this extension assumes, that an IDisposable has to be disposed, where it gets created. The class that created an IDisposable is responsible for destroying it.

This sounds simple, but it's pretty complicated to detect, because this simple definition is not satisfied by all your code. Even within the code assemblies there are exceptions, that had to be detected correctly. You can read the readme at github for more details

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 1.3

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.3.0 17,765 3/6/2020
3.2.2 578 2/9/2020
3.2.1 426 1/17/2020
3.2.0 496 11/10/2019
3.1.0 444 11/8/2019
3.0.0 462 11/8/2019
2.4.2 581 2/9/2020
2.4.1 450 1/17/2020
2.4.0 465 11/10/2019
2.3.1 469 11/8/2019
2.3.0 479 10/27/2019
2.2.0 502 10/18/2019
2.1.3 460 10/5/2019
2.1.2 475 9/27/2019
2.1.1 511 9/22/2019
2.1.0 531 9/20/2019
2.0.1 505 9/13/2019
2.0.0 505 8/16/2019
1.6.0 1,062 7/23/2019
1.5.0 600 3/6/2019
1.4.0 616 2/14/2019

Release 1.4.0
Issue 101: Support for Visual Studio 2019. Thanks to xperiandri