Roslyn analyzers for IDisposable
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. |
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.
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
The ruleset editor does not handle changes IDs well, if things get out of sync you can try:
- Close visual studio.
- Edit the ProjectName.rulset file and remove the IDisposableAnalyzers element.
- Start visual studio and add back the desired configuration.
Above is not ideal, sorry about this. Not sure this is our bug.
Early alpha, names and IDs may change.