Commit d6a395f
authored
Add ReactiveUI.Extensions Async module (#117)
* Add ReactiveUI.Extensions Async module
Introduce a new Async module for ReactiveUI.Extensions: adds comprehensive async support including AsyncContext, observables, observers, connectable observables, a wide set of operators, subjects, internals (gates, cancelable subscriptions, anonymous types), and async disposables (Composite, Serial, SingleAssignment, helpers).
Also update Directory.Packages.props (bump Microsoft.SourceLink.GitHub and add several System/Microsoft packages) and adjust the ReactiveUI.Extensions project file to include the new sources. This commit scaffolds full asynchronous reactive primitives and utilities used across the extension library.
* Add async observables implementation and tests
Introduce a full Async Observable implementation and comprehensive test suite. Adds core async types and bridge code (IObservableAsync, IObserverAsync, ObservableAsync, ObserverAsync, ObservableBridgeExtensions, AsyncContext), many operator implementations (Merge, Concat, CombineLatest, Zip, SelectMany, Delay, Retry, Throttle, Timeout, StartWith, TakeWhile, SkipWhile, etc.), subject variants and internals (multicast, wrapped observers, cancelable subscriptions), and subject mixins. Also adds numerous NUnit test files under src/ReactiveUI.Extensions.Tests/Async (AdditionalOperatorTests, BridgeTests, CombiningOperatorTests, CoverageBoostTests, DeepCoverageTests, DisposableTests, ErrorHandlingOperatorTests, FactoryObservableTests, FilteringOperatorTests, ResultAndInfrastructureTests, SubjectTests, TerminalOperatorTests, TimeBasedOperatorTests, TransformationOperatorTests, AsyncTestHelpers) and updates project/test wiring. These changes enable bridging with System.Reactive, expand operator coverage, and improve test coverage across many edge cases.
* Refactor async code and add docs
Clean up and refactor various async operator and subject implementations: remove unused usings and redundant comments, replace explicit local types with var for consistency, simplify a method to an expression-bodied form, and use IsEmpty for buffer checks. Add XML documentation for ConcatEnumerableObservable and ZipObservable to clarify behavior and type parameters. These changes improve readability, reduce compiler/editor warnings, and clarify intent without altering behavior.
* Add Async Observables (IObservableAsync) docs
Add a comprehensive "Async Observables (IObservableAsync<T>)" section to the README covering design goals, quick start, API catalog, core interfaces/types, factory methods, operators (transformation, filtering, combining, timing, aggregation, error handling), subjects, bridging/conversion, async disposables, examples and usage notes. Also update Performance Notes and Thread Safety with async-specific guidance, add a changelog line announcing the async-native framework, fix a small typography change (allocation‑aware hyphen), and correct a few code snippet var/formatting issues.
* Add scheduler overload to DebounceUntil
Introduce a new DebounceUntil<T>(..., TimeSpan, Func<T,bool>, IScheduler) overload that uses the supplied scheduler for Delay, enabling deterministic scheduling in tests. Update the DebounceUntil unit test to use TestScheduler, pass it into the operator, replace Thread.Sleep with scheduler.AdvanceBy, and adjust timing to use FromTicks so the test runs deterministically.
* Add sentinel to prevent premature completion
In StartAsync, add a sentinel Interlocked.Increment(ref _active) before subscribing to sources and replace the Volatile.Read check with Interlocked.Decrement(ref _active) after the loop. This prevents a synchronously-completing inner source from driving _active to zero before subsequent sources are subscribed, avoiding premature termination of the merge. Also adds explanatory comments and uses interlocked operations for correct race-free behavior.
* Add comprehensive CombineLatest operator tests
Add new test file src/ReactiveUI.Extensions.Tests/Async/CombineLatestOperatorTests.cs containing comprehensive NUnit tests for the CombineLatest async operator. Covers arities 2–8 and verifies behavior for emissions (no emission until all sources have values, latest-value combinings), error propagation and completion semantics, error-resume forwarding, disposal handling (including double-dispose and ignoring resumes after dispose), and several cross-cutting edge cases.
* Add further Tests
* Revamp EditorConfig and update async library/tests
Restructure and expand .editorconfig with detailed code-style, analyzer and naming rules. Add CI/config files (codecov.yml, global.json, testconfig.json) and replace the old .sln with a .slnx. Remove a parallel AssemblyInfo and apply widespread updates to the Async implementation and corresponding tests (subjects, operators, disposables, internals, and test project files) to align with the new style and analyzer expectations.
* Use WaitForConditionAsync in tests
Add AsyncTestHelpers.WaitForConditionAsync to provide polling-based waits with timeouts, and replace Thread.Sleep/manual polling in tests with this helper. Updated TimeBasedOperatorTests and ReactiveExtensionsTests to await conditions (and assert the wait succeeded) for more reliable, deterministic timing in async tests, and added the necessary using directive in ReactiveExtensionsTests.
* Increase test timeouts and improve async waits
Increase timeouts and make async test waits more robust to reduce flakiness. Updated TimeBasedOperatorTests and ReactiveExtensionsTests to use a 5s WaitForConditionAsync instead of shorter delays, replaced a Task.Delay with WaitForConditionAsync that checks both result and exception, and strengthened a retry test to wait for the expected error count before asserting.
* Increase test timeouts and strengthen completion check
Extend flaky test waits and make completion assertions more robust. Increased TimeBasedOperatorTests wait timeouts from 2s to 5s to reduce timing-related failures. In ReactiveExtensionsTests replaced a simple Task.WaitAsync with WaitForConditionAsync that verifies both completion flag and result count, and added an assertion for the condition result. These changes aim to stabilize CI/test runs by allowing more time and using a deterministic completion check.
* Replace fixed delays with condition waits in tests
Replace brittle Task.Delay usage with AsyncTestHelpers.WaitForConditionAsync across async tests to make timing assertions more reliable. Added boolean flags and explicit cancellation handling where needed, and increased some wait timeouts (5s -> 10s, 2s -> 5s) to reduce flakiness. Modified files: FactoryObservableTests.cs, OperatorEdgeCaseTests.cs, TimeBasedOperatorTests.cs, ReactiveExtensionsTests.cs.1 parent d3bb06e commit d6a395f
151 files changed
Lines changed: 23848 additions & 743 deletions
File tree
- src
- ReactiveUI.Extensions.Tests
- Async
- ReactiveUI.Extensions
- Async
- Bridge
- Disposables
- Internals
- Mixins
- Observables
- Operators
- Subjects
- Base
- Options
- Internal
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
50 | 74 | | |
51 | 75 | | |
52 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
19 | 27 | | |
20 | 28 | | |
21 | 29 | | |
| |||
27 | 35 | | |
28 | 36 | | |
29 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
30 | 46 | | |
31 | 47 | | |
32 | 48 | | |
| |||
This file was deleted.
0 commit comments