Skip to content

Releases

v9.0.0

Choose a tag to compare

@github-actions github-actions released this 25 Nov 18:50
2070a48

Changed

  • Breaking: SharedReference.Create(value, onRelease) and AsyncSharedReference.Create(value, onRelease) throw ArgumentNullException for a null value or release callback, SharedReference.Create(value), AsyncSharedReference.Create(value), AsSharedReference() and AsAsyncSharedReference() for a null resource, and the SharedReferenceOwner<T> and AsyncSharedReferenceOwner<T> constructors for a null release callback; the owner constructors keep accepting a null value. Before, a null release callback or resource threw NullReferenceException only when the last lease was released, and Create(value, onRelease) handed a null value to the release callback; pass the value and the release callback to share. (#89, ADR-1008)
  • Breaking: The DisposableCollection and AsyncDisposableCollection constructors, and so the Collection and CollectionIgnoringExceptions factories of Disposable and AsyncDisposable, throw ArgumentException for an initial collection that holds a null item, which Add already rejects, instead of keeping it; leave null out of the items. (#89, ADR-1008)
  • Package validation compares each package with the published 8.0.1 package.
  • docs/assurance-case.md states the library's security requirements, its threat model and trust boundary, the secure design principles it applies and the weaknesses it counters, with the tests behind them.

v8.0.1

Choose a tag to compare

@github-actions github-actions released this 25 Nov 16:32
05bd89e

Added

  • The documentation site at https://disposables.ncode.io/: a quick start, a picker that finds the disposable for a situation, a guide for each task with its pitfalls, the rules behind them, a behavior reference of every disposable and an API map of every public member. Every C# sample on it is a test that compiles and runs on each pull request. (ADR-1009, ADR-1010)

Changed

  • Package validation compares each package with the published 8.0.0 package.
  • The package's project website on nuget.org is the documentation site, and both READMEs link to it. (ADR-1013)

v8.0.0

Choose a tag to compare

@github-actions github-actions released this 25 Nov 06:23
a7bea5b

Changed

  • Breaking: AsyncDisposable.Adapt, AsyncDisposable.AdaptRepeatable and the AsyncDisposableAdapter constructor throw ArgumentNullException for a null disposable instead of returning an adapter that disposes nothing; pass the resource to adapt. (#76, ADR-1008)

Removed

  • Breaking: IDisposableAggregate, IAsyncDisposableAggregate, IDisposableCollection and IAsyncDisposableCollection, obsolete since 7.0.0 (NCDISP002), are deleted: use DisposableAggregate, AsyncDisposableAggregate, DisposableCollection and AsyncDisposableCollection, which the factories return. (#69, ADR-1005)
  • Breaking: The 19 members whose bool picks a behavior, obsolete since 7.1.0 (NCDISP003), are deleted: idempotent on Disposable.Create, AsyncDisposable.Create, AsyncDisposable.Adapt and the DisposableAction, AsyncDisposableAction and AsyncDisposableAdapter constructors, async on Disposable.Context and the DisposableContext constructor, and ignoreExceptions on Disposable.Collection, AsyncDisposable.Collection, the DisposableCollection and AsyncDisposableCollection constructors, DisposeAll and DisposeAllAsync. Call the overload without the flag for the default behavior, or CreateRepeatable, AdaptRepeatable, PostingContext, CollectionIgnoringExceptions, DisposeAllIgnoringExceptions() or DisposeAllIgnoringExceptionsAsync() for the other one. (#75, ADR-1007)

v7.1.0

Choose a tag to compare

@github-actions github-actions released this 25 Nov 05:22
0b7e899

Added

  • Disposable.CreateRepeatable, AsyncDisposable.CreateRepeatable and AsyncDisposable.AdaptRepeatable run the action or dispose the resource on every call, Disposable.PostingContext disposes through the context's Post, and Disposable.CollectionIgnoringExceptions, AsyncDisposable.CollectionIgnoringExceptions, DisposeAllIgnoringExceptions() and DisposeAllIgnoringExceptionsAsync() ignore the exceptions items throw; the constructors and overloads without a flag, such as new DisposableAction(action), Disposable.Context(disposable, context) and DisposeAll(), pick the default behavior. (#68, ADR-1007)

Changed

  • The project template is v0.113.3, whose build/Update-PublicApi.ps1 and build/dod.ps1 find the projects when they run from a plan's worktree under .claude/worktrees/. (#70)
  • The tests create every mock from one MockRepository per test class, which verifies each expected call when the test ends. (#67)

Deprecated

  • The bool parameters that pick a behavior report NCDISP003: idempotent on Disposable.Create, AsyncDisposable.Create, AsyncDisposable.Adapt and the DisposableAction, AsyncDisposableAction and AsyncDisposableAdapter constructors, async on Disposable.Context and the DisposableContext constructor, and ignoreExceptions on Disposable.Collection, AsyncDisposable.Collection, the DisposableCollection and AsyncDisposableCollection constructors, DisposeAll and DisposeAllAsync. Use the members named for each behavior, because the next major version deletes these overloads. (#68, ADR-1007)

Fixed

  • Dispose on a context from Disposable.PostingContext, or from Disposable.Context with async: true, calls OperationCompleted and rethrows when the context's Post throws, so the context's count of operations stays balanced. (#71)

v7.0.0

Choose a tag to compare

@github-actions github-actions released this 25 Nov 03:35
ebf2887

Added

  • DisposableSerial and AsyncDisposableSerial, from Disposable.Serial and AsyncDisposable.Serial, hold one resource and dispose it when another replaces it. (#65, ADR-1004)
  • DisposableSingleAssignment and AsyncDisposableSingleAssignment, from Disposable.SingleAssignment and AsyncDisposable.SingleAssignment, take one resource once; a second assignment throws InvalidOperationException. (#65, ADR-1004)
  • DisposableGuard<T> and AsyncDisposableGuard<T>, from Disposable.Guard and AsyncDisposable.Guard, dispose a resource unless Release() hands its ownership on. (#65)
  • DisposableCancellation and AsyncDisposableCancellation, from Disposable.Cancellation and AsyncDisposable.Cancellation, cancel a CancellationTokenSource when disposed, and dispose one they created. (#65)
  • IDisposalStatus.IsDisposed, which every disposable that keeps state implements, and DisposableFlag, from Disposable.Flag(), which only records its disposal. (#65, ADR-1005)
  • AsyncDisposable.Create overloads that pass one to eight arguments to a Func<…, ValueTask>, AsyncDisposable.Context, which disposes on a SynchronizationContext and waits for it, and parameterless Aggregate() and Serial() factories. (#65, ADR-1005)
  • ValueDisposable<TState> and AsyncValueDisposable<TState>, from Disposable.CreateValue and AsyncDisposable.CreateValue, run a delegate on dispose without allocating. (#65, ADR-1006)
  • Lock scopes: SemaphoreSlim.Lock() and LockAsync(), and ReaderWriterLockSlim.ReadLock(), UpgradeableReadLock() and WriteLock(), return a ValueDisposable<T> that releases the lock. (#65, ADR-1006)
  • AsyncDisposableAggregate.SetDisposableAsync and AsyncDisposableCollection.AddAsync, which dispose the resource when the holder is already disposed. (#65, ADR-1004)

Changed

  • Package validation compares each package with the published 6.0.0 package.
  • Each release is tagged and published as its pull request merges: .github/workflows/tag-release.yml signs the tag with gitsign, publishes the GitHub release from the version's changelog section and starts publish.yml, which still waits for a maintainer to approve the nuget environment. SECURITY.md says how to verify a release tag. (ADR-0016)
  • Breaking: The Disposable and AsyncDisposable factories return the concrete sealed types, such as DisposableAction, DisposableAggregate and DisposableCollection, so recompile against 7.0.0; a var that later takes another IDisposable needs the type IDisposable. (#65, ADR-1005)
  • Breaking: A disposed aggregate's Disposable property returns null instead of throwing ObjectDisposedException, and DisposableAggregate's setter disposes the resource it is given; AsyncDisposableAggregate's setter still throws, so call SetDisposableAsync. (#65, ADR-1004)
  • Breaking: DisposableCollection.Add on a disposed collection disposes the item instead of keeping it, and AsyncDisposableCollection.Add throws ObjectDisposedException; call AddAsync to dispose the item instead. (#65, ADR-1004)
  • DisposableCollection and AsyncDisposableCollection are safe to use from several threads: every member takes one lock, and enumeration walks a snapshot. (#65)
  • The library awaits with ConfigureAwait(false), so its continuations never resume on the caller's SynchronizationContext, and CA2007 enforces it. (#65)

Deprecated

  • IDisposableAggregate, IAsyncDisposableAggregate, IDisposableCollection and IAsyncDisposableCollection report NCDISP002: use the concrete types, because the next major version deletes the interfaces. (#65, ADR-1005)

v6.0.0

Choose a tag to compare

@polewskm polewskm released this 24 Nov 23:40
cf0f6ee

Added

  • Public API tracking: each release's public surface is recorded in PublicAPI.Shipped.txt, and the changes since the last release in PublicAPI.Unshipped.txt, so the build fails on a public API change neither file records.
  • Each pack is validated against NCode.Disposables 5.3.0, the last version on nuget.org, through PackageValidationBaselineVersion, so a change that would break 5.3.0's public API fails the pack. (#37, ADR-0147)
  • The changelog has a section for every release from 1.0.0 to 5.3.0, from their release notes. (#27)
  • src/NCode.Disposables/README.md is the package readme nuget.org shows: installation, the main samples, and absolute links to the full guide, the API overview, the changelog and the security policy.
  • Every C# sample in the READMEs is a compiled test in tests/NCode.Disposables.Tests/ReadmeSamplesTests.cs that MarkdownSnippets copies into the READMEs, and ./build/gate.ps1, which CI and the Landing section's gate run, fails when a README differs from its test, then runs ./build/dod.ps1. (ADR-1000)
  • The AsAsyncSharedReference() extension puts an IAsyncDisposable behind a reference count and returns its first AsyncSharedReferenceLease<T>, also for a type that implements IDisposable too, such as a Stream. (#55, ADR-1002)

Changed

  • AssemblyVersion is 6.0.0.0 for every 6.x release and moves only with the major version, set by assemblyVersion in version.json, so a later 6.x assembly replaces an earlier one without a binding redirect.
  • SharedReferenceOwner throws through ObjectDisposedException.ThrowIf; the exception type and object name are unchanged.
  • Updated the project from project-template v0.41.0 to v0.61.2: stricter analyzers, shared build settings, a Definition of Done script and CI updates.
  • Updated the project from project-template v0.61.2 to v0.112.2: package versions now come from version.json through Nerdbank.GitVersioning, the CI workflow checks out the full history and builds a release with -p:PublicRelease=true, the Commit attribution check and commit-msg hook are gone, and the project gains a code of conduct, governance, roadmap, architecture and assurance documents, a coverage and reproducible-build toolkit, and the Scorecard workflow. (#28)
  • The solution file is NCode.Disposables.slnx, the XML solution format current .NET SDKs create, in place of NCode.Disposables.sln, and the ReSharper and Rider settings layer moves with it to NCode.Disposables.slnx.DotSettings. dotnet build and dotnet test at the repository root work as before.
  • The package carries its description and tags again: Directory.Build.props imports src/NCode.Disposables/project.props, and the project files no longer repeat settings the project template makes or reference Microsoft.SourceLink.GitHub, which the .NET SDK includes. (#36)
  • Every C# file starts with the two-line SPDX header, // Copyright © NCode Group and // SPDX-License-Identifier: Apache-2.0, in place of the Copyright Preamble region, Rider's file header matches it, and no file starts with a UTF-8 byte order mark. (#39, #36, ADR-0148)
  • NCode Review v1.5.0 reviews each pull request and approves a clean one; once the NCode Review Approver's key is stored, that approval meets a required approval. Pull requests the workflow commands open start as drafts (draft: yes). (#38, ADR-0036)
  • ./build/dod.ps1 checks the C# formatting with CSharpier, the code and project files are formatted with it, and a C# file without the SPDX header fails the build: the project turned on the template's csharp_format answer. (#39, ADR-0148)
  • Packages reach nuget.org through .github/workflows/publish.yml, the project template's publishing workflow, from a published GitHub release: it tests and packs the tagged commit and pushes the packages through nuget.org trusted publishing once a maintainer approves the protected nuget environment, so no long-lived NuGet API key is stored. Each release also gets its packages, a signed build provenance file and an SBOM, attached by release-provenance.yml, and raise-baseline.yml opens the change that raises the package validation baseline. (#44, ADR-0135)
  • README.md is a guide to every type, in the layout of the other NCode Group projects: a tested sample for each disposable, the shared references, the async adapter and the extensions, their errors and edge cases, an API overview, thread safety, and NuGet, CI, target framework, license and OpenSSF Scorecard badges. Its hand-kept release notes are gone; CHANGELOG.md covers every release.
  • The package description reads "Building blocks for IDisposable and IAsyncDisposable in .NET", followed by what the library does, without the Markdown backticks nuget.org showed as text.
  • Updated the project from project-template v0.112.2 to v0.113.1: Claude Code's project settings no longer ask before a command that mentions .env or secrets/, the release workflows and the template's scripts accept a version only in ASCII digits after a lowercase v, and the template's Best Practices record is ADR-0037, renumbered from ADR-0153.
  • docs/architecture.md describes the components, the factories, the disposables, the shared references and the extensions, as a diagram and a table. (#56)

Removed

  • Breaking: AsyncDisposableExtensions.AsSharedReference() is deleted: call AsAsyncSharedReference() for an AsyncSharedReferenceLease<T> that disposes with DisposeAsync. AsSharedReference() is DisposableExtensions.AsSharedReference() alone, so on a type that implements both IDisposable and IAsyncDisposable, such as a MemoryStream, it compiles and returns a SharedReferenceLease<T> that disposes with Dispose. No release marks it obsolete first: 5.3.0, the last release, ships it without [Obsolete], so code built against 5.3.0 gets no NCDISP001 warning before the deletion. (#59, #55, ADR-1002)
  • Breaking: The net8.0 target framework: the package targets net10.0 alone, since .NET 8 left Microsoft support on 2026-11-10. Apps on .NET 8 or 9 stay on 5.3.0. (ADR-1003)
  • .github/workflows/main.yml: its build and test jobs repeated ci.yml's build-and-test on every push and pull request, and publish.yml replaces its publish job. (#43, #44)

Fixed

  • DisposeAll(ignoreExceptions: true) ignores the failures of the items disposed after an item that implements only IAsyncDisposable; the InvalidOperationException for that item is still thrown. (#53)
  • Disposable.Collection(...).Dispose() and DisposeAll() dispose an item that implements both IDisposable and IAsyncDisposable, such as a Stream or a DbConnection, through IDisposable.Dispose instead of throwing InvalidOperationException, which DisposeAll() throws only for an item that implements IAsyncDisposable alone. Its message reads The collection contains an item that implements IAsyncDisposable but not IDisposable; dispose it with DisposeAllAsync. (#54, ADR-1001)
  • The XML docs of DisposableCollection and AsyncDisposableCollection say that Add, Remove, Clear and enumeration take no lock, and Disposable.Collection's docs say that several failures are thrown together as an AggregateException.

v5.3.0

Choose a tag to compare

@polewskm polewskm released this 17 Jan 15:40

.NET 10 upgrade

v5.2.1

Choose a tag to compare

@polewskm polewskm released this 29 Nov 23:33

Collections can be any object instead of just IDisposable or IAsyncDisposable

Minor resharper cleanup

Choose a tag to compare

@polewskm polewskm released this 27 Nov 22:09

Minor resharper cleanup

Allow creating of async shared references without requiring async callsite

Choose a tag to compare

@polewskm polewskm released this 16 May 16:09
v5.1.0

Allow creating of async shared references without requiring async cal…