github fedeAlterio/R3Async v2.0.2

one hour ago

Changelog

Breaking changes

  • Share now defaults to ShareConfig.ResetOnCompletionAndRefCountZero, matching Rx's Publish().RefCount(): the source is disconnected when the last subscriber leaves, and a completed connection is restarted on the next subscription. Pass new ShareConfig() to keep the previous behavior.
  • Merge overloads gained an optional MergeOptions parameter. This is source compatible, but code compiled against 1.x must be recompiled.

Performance

  • AsyncGate uses a pooled FIFO queue of waiters instead of SemaphoreSlim plus a continuation. Each wait allocates much less, and a release hands the gate straight to the first waiter, so no other caller can jump the queue.
  • A single AsyncLocal for the whole library (ExecutionFlow) replaces the per-observer, per-gate and per-subscription ones, so the ExecutionContext stays small in long pipelines.
  • Linked cancellation tokens are reused across notifications instead of creating a CancellationTokenSource for every value.
  • Consecutive synchronous Select/Where calls are fused into a single operator.
  • On net6+, OnNextAsync and the Merge forwarding methods use PoolingAsyncValueTaskMethodBuilder.
  • New MergeOptions.DetachInnerCancellation option avoids linking a token per value in Merge.

Fixes

  • Share: an observer that joins or leaves during a subscription no longer resets the connection. Subscribe and connect failures are handled more reliably.
  • Debounce / Throttle: OnErrorResume is no longer forwarded after termination.
  • TakeUntil, Debounce, Throttle, Timeout: callers waiting on the gate are released when the subscription is disposed (in Timeout, only for OnErrorResume).
  • TakeUntil: errors are reported to UnhandledExceptionHandler instead of being silently swallowed.
  • Merge(IEnumerable): subscribing now waits until all sources are subscribed, and the startup method is no longer async void.
  • UnhandledExceptionHandler.Register is thread-safe and rejects null.

Infrastructure

  • global.json pins the .NET 10 SDK, and the CI workflows install the SDK version it specifies.

Don't miss a new R3Async release

NewReleases is sending notifications on new releases.