Skip to content

v7.0.0

Choose a tag to compare

@github-actions github-actions released this 25 Nov 03:35
· 173 commits to main since this release
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)