Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/archomeda/disposegenerator
A C# source generator that automatically implements IDisposable and IAsyncDisposable
https://github.com/archomeda/disposegenerator
csharp csharp-sourcegenerator dotnet
Last synced: 19 days ago
JSON representation
A C# source generator that automatically implements IDisposable and IAsyncDisposable
- Host: GitHub
- URL: https://github.com/archomeda/disposegenerator
- Owner: Archomeda
- License: mit
- Created: 2021-07-26T22:15:15.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-16T23:21:37.000Z (about 3 years ago)
- Last Synced: 2024-11-08T20:45:49.487Z (about 2 months ago)
- Topics: csharp, csharp-sourcegenerator, dotnet
- Language: C#
- Homepage:
- Size: 62.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# DisposeGenerator
[![GitHub CI](https://img.shields.io/github/workflow/status/Archomeda/DisposeGenerator/CI/master?label=CI&logo=GitHub)](https://github.com/Archomeda/DisposeGenerator/actions?workflow=CI)
[![NuGet](https://img.shields.io/nuget/v/DisposeGenerator.svg?label=NuGet&logo=nuget)](https://www.nuget.org/packages/DisposeGenerator)
[![NuGet Downloads](https://img.shields.io/nuget/dt/DisposeGenerator.svg?label=Downloads&logo=nuget)](https://www.nuget.org/packages/DisposeGenerator)DisposeGenerator is a C# source generator that automatically implements IDisposable and IAsyncDisposable for you.
Manually implementing proper [IDisposable](https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose) and [IAsyncDisposable](https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-disposeasync) patterns tends to bring a lot of boilerplate code.
This source generator aims to alleviate that problem so that you don't have to think about this pattern anymore.Keep in mind that this project is in an early stage, and that bugs may occur.
## Limitations
- Other source generators that add additional members to a partial class, are not detected
- Nested IDisposable/IAsyncDisposable classes are not supported
- Inheritance is done on best effort, which means that the generator expects the base class to properly implement Microsoft's [IDisposable](https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose) and [IAsyncDisposable](https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-disposeasync) and/or [IAsyncDisposable](https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-disposeasync) pattern.
- Probably more that I have overlooked...## Installing
You can find the library on [NuGet](https://www.nuget.org/packages/DisposeGenerator/). Or, alternatively, you can install it by running `dotnet add package DisposeGenerator` in a console, or `Install-Package DisposeGenerator` in the package manager console.## Usage
TODO## Compiling
This project has been developed and tested in Visual Studio 2019 (16.10).## Contributing
Because a proper IDisposable or IAsyncDisposable pattern is quite complicated, any contribution that adds features or fixes bugs are very much welcome.