Skip to content

Lock-free cache Watch (and Experimental Watcher) drop completion and errors #5

Closed

Description

@ViktorJannicke

Upstream: #1142 Rx terminal contract

What is missing in the fork

The cache and list ports of upstream reactivemarbles#1146/reactivemarbles#1147 are complete, but some operators outside those PRs still subscribe with a value handler only:

  • src/DynamicData/Cache/Internal/LockFreeObservableCache.cs Watch(key): _changes.Subscribe(changes => ...) has no error or completion handler, although _changes completes on dispose and carries source errors. AsObservableCache(applyLocking: false).Watch(key) and WatchValue therefore never complete, and a source error goes to the default handler (rethrown on the producer thread in the System.Reactive flavor) instead of the subscriber. ObservableCache.Watch, its locking sibling, was fixed by the Make the cache operators honour the Rx observable contract reactivemarbles/DynamicData#1146 port.
  • src/DynamicData/Experimental/Watcher.cs (AsWatcher): same pattern; watchers never observe source errors or completion. Lower priority.

Suggested approach

Forward observer.OnError and observer.OnCompleted in LockFreeObservableCache.Watch; decide and document the terminal behavior of Watcher (forward to watched-value streams, or complete them) and implement it the same way.

Test idea

In src/DynamicData.Tests/Internal/CacheInfrastructureCoverageFixture.cs (which covers Watch values only): dispose a lock-free cache and assert Watch/WatchValue complete; fail the source and assert the error reaches the subscriber, not the producer. Run in both flavors.

Activity

  1. dwcullop commented on Oct 13, 2026

    @dwcullop

    @ViktorJannicke Thanks for finding these! If you find anymore, please file in the upstream repo so we can fix them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions