Skip to content

maxinfet/IDisposableAnalyzers

 
 

Repository files navigation

IDisposableAnalyzers

Roslyn analyzers for IDisposable

License Gitter Build status NuGet

IDISP001 Dispose created.
IDISP002 Dispose member.
IDISP003 Dispose previous before re-assigning.
IDISP004 Don't ignore return value of type IDisposable.
IDISP005 Return type should indicate that the value should be disposed.
IDISP006 Implement IDisposable.
IDISP007 Don't dispose injected.
IDISP008 Don't assign member with injected and created disposables.
IDISP009 Add IDisposable interface.

Using IDisposableAnalyzers

The preferable way to use the analyzers is to add the nuget package IDisposableAnalyzers to the project(s).

The severity of individual rules may be configured using rule set files in Visual Studio 2015.

Installation

IDisposableAnalyzers can be installed using:

  • Paket
  • NuGet command line
  • NuGet Package Manager in Visual Studio.

Install using the command line:

paket add IDisposableAnalyzers --project <project>

or if you prefer NuGet

Install-Package IDisposableAnalyzers

Updating

The ruleset editor does not handle changes IDs well, if things get out of sync you can try:

  1. Close visual studio.
  2. Edit the ProjectName.rulset file and remove the IDisposableAnalyzers element.
  3. Start visual studio and add back the desired configuration.

Above is not ideal, sorry about this. Not sure this is our bug.

Current status

Early alpha, names and IDs may change.

About

Roslyn analysers for the use of types implementing IDisposable

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.7%
  • PowerShell 0.3%