ADDB.AutoDispose 0.1.1.1

dotnet add package ADDB.AutoDispose --version 0.1.1.1
                    
NuGet\Install-Package ADDB.AutoDispose -Version 0.1.1.1
                    
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="ADDB.AutoDispose" Version="0.1.1.1">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ADDB.AutoDispose" Version="0.1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="ADDB.AutoDispose">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ADDB.AutoDispose --version 0.1.1.1
                    
#r "nuget: ADDB.AutoDispose, 0.1.1.1"
                    
#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.
#:package ADDB.AutoDispose@0.1.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ADDB.AutoDispose&version=0.1.1.1
                    
Install as a Cake Addin
#tool nuget:?package=ADDB.AutoDispose&version=0.1.1.1
                    
Install as a Cake Tool

Minimal Proof of Concept automatic IDisposable Source Generator.

What it does

  • Applying [AutoDispose] to a partial class that *does not* have its own IDisposable.Dispose method will generate one that calls dispose on all fields and auto-properties
  • Applying [AutoDispose] on a field/property will do the same as above; just limiting dispose calls to the fields/properties with the attribute
  • If the target is not a class, it will do a null check for calling dispose
  • It implicitly implements IDisposable for attributed classes

What should still be done

  • [CallFromDispose] or some similar attribute

  • Options e.g.

    • Should class level attribute target properties
    • Disable null checks
  • Analyzers/Codefixes, e.g.

    • Attribute applied but (containing) class is not partial
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has 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
0.1.1.1 137 4/14/2026