Skip to content

feat: add Rx compatibility operators#63

Draft
ChrisPulman wants to merge 6 commits into
mainfrom
CP_dynamicdata-compat-operators
Draft

feat: add Rx compatibility operators#63
ChrisPulman wants to merge 6 commits into
mainfrom
CP_dynamicdata-compat-operators

Conversation

@ChrisPulman

@ChrisPulman ChrisPulman commented Jun 20, 2026

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Feature/API compatibility work for migrating Rx-first source bases.

What is the new behavior?

ReactiveUI.Primitives and ReactiveUI.Primitives.Reactive now expose the generally useful Rx-name operators needed by applications. This adds aliases and implementations for Publish/Replay/RefCount, SubscribeSafe, StartWith, timed Buffer, Finally, Throttle, Catch, SelectMany, and bounded enumerable Merge/Blend, with shipped PublicAPI baselines regenerated for both packages.

What is the current behavior?

Consumers migrating from System.Reactive source bases still need project-local compatibility helpers for several common Rx names, especially bounded enumerable Merge/Blend and selected multicast/time-based aliases.

Checklist

  • Tests have been added or updated (for bug fixes / features)
  • Docs have been added or updated (for bug fixes / features)
  • Changes target the main branch
  • PR title follows Conventional Commits

Additional information

Local validation completed:

  • dotnet build ReactiveUI.Primitives/ReactiveUI.Primitives.csproj -c Debug -f net8.0
  • dotnet build ReactiveUI.Primitives.Reactive/ReactiveUI.Primitives.Reactive.csproj -c Debug -f net8.0
  • tools/generate-publicapi.ps1 for ReactiveUI.Primitives and ReactiveUI.Primitives.Reactive
  • dotnet build tests/ReactiveUI.Primitives.Tests/ReactiveUI.Primitives.Tests.csproj -c Debug -f net8.0
  • dotnet build tests/ReactiveUI.Primitives.Tests/ReactiveUI.Primitives.Tests.csproj -c Debug -f net10.0
  • ReactiveUI.Primitives.Tests net10.0 executable: 391/391 passed
  • dotnet build ReactiveUI.Primitives.slnx -c Debug with Android/Apple TFM legs disabled locally

API surface:
- Add Rx-compatible Signal aliases for Return, Empty, Never, Throw, Timer, Merge, and Switch.
- Add async Create/Defer overloads, indexed Select/MapIndexed, Task ToObservable/ToSignal, task Concat/Chain, scheduler-aware ToObservable, and object Synchronize/SynchronizeObject support.
- Update public API baselines for ReactiveUI.Primitives and ReactiveUI.Primitives.Reactive.

Build and test fixes:
- Fix generate-publicapi.ps1 path construction under Windows PowerShell.
- Disambiguate tests after the new overloads.
- Disable the WindowsAppSDK Undocked RegFree WinRT auto-initializer for WinUI tests to avoid compiling package source that violates CA5392 while preserving self-contained dispatcher tests.
Comment thread src/Primitives.Shared/SignalOperatorMixins.StatefulSignals.cs Fixed
@ChrisPulman ChrisPulman changed the title feat: add DynamicData observable compatibility APIs feat: add Observable compatibility APIs Jun 20, 2026
Operators:

- add Rx-name aliases for Publish, Replay, RefCount, SubscribeSafe, StartWith, Buffer, Finally, Throttle, Catch, SelectMany, and Merge

- add bounded enumerable Blend/Merge support so migrated DynamicData pipelines can avoid local ReactiveCompatibility operators

- add cleanup argument validation for Finally/OnCleanup parity

Public API:

- regenerate ReactiveUI.Primitives and ReactiveUI.Primitives.Reactive shipped API baselines for all target frameworks

Tests:

- add TUnit coverage for DynamicData migration aliases, SubscribeSafe failure handling, bounded Merge, Buffer, Throttle, and Finally

Validation:

- built ReactiveUI.Primitives, ReactiveUI.Primitives.Reactive, DynamicData, DynamicData.Reactive, and the solution

- ran ReactiveUI.Primitives.Tests net10.0 executable: 391/391 passed
@ChrisPulman ChrisPulman changed the title feat: add Observable compatibility APIs feat: add DynamicData Rx compatibility operators Jun 20, 2026
Update StyleSharp.Analyzers package version from 3.11.1 to 3.11.2 in src/Directory.Packages.props to pick up the patch release.
Comment thread src/Primitives.Shared/SignalOperatorParityMixins.RxNames.cs Dismissed
Comment thread src/Primitives.Shared/SignalOperatorParityMixins.RxNames.cs Dismissed
Comment thread src/Primitives.Shared/ConnectableSignalExtensions.cs Fixed
Comment thread src/Primitives.Shared/LinqExtensions.BlendEnumerable.cs Fixed
Comment thread src/Primitives.Shared/SignalOperatorParityMixins.RxNames.cs Fixed
Comment thread src/Primitives.Shared/SignalOperatorParityMixins.RxNames.cs Fixed
@ChrisPulman ChrisPulman changed the title feat: add DynamicData Rx compatibility operators feat: add Rx compatibility operators Jun 20, 2026
Review comments:

- address generic catch review threads by filtering fatal runtime exceptions before converting ordinary delegate/enumerator failures to OnError

Implementation:

- add a shared FatalExceptionHelper used by Connectable Publish, bounded Blend/Merge, MapIndexed, SubscribeSafe, and enumerable SelectMany

Validation:

- dotnet build ReactiveUI.Primitives net8.0

- dotnet build ReactiveUI.Primitives.Reactive net8.0

- dotnet build ReactiveUI.Primitives.Tests net10.0

- ReactiveUI.Primitives.Tests net10.0 executable: 391/391 passed
CI:

- add Android-generated Resource type baselines for ReactiveUI.Primitives and ReactiveUI.Primitives.Reactive on net10.0-android and net11.0-android

Validation:

- dotnet build ReactiveUI.Primitives net10.0-android Release

- dotnet build ReactiveUI.Primitives.Reactive net10.0-android Release

- net11.0-android local validation is blocked by missing Android API level 37 on this machine; CI has the required SDK
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
37.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@codecov

codecov Bot commented Jun 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.25301% with 277 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.93%. Comparing base (cda2956) to head (19acaeb).

Files with missing lines Patch % Lines
...tives.Shared/SignalOperatorParityMixins.RxNames.cs 48.46% 59 Missing and 8 partials ⚠️
...rimitives.Shared/LinqExtensions.BlendEnumerable.cs 52.27% 33 Missing and 9 partials ⚠️
src/Primitives.Shared/Signals/Signal{Create}.cs 28.07% 41 Missing ⚠️
...c/Primitives.Shared/ConnectableSignalExtensions.cs 0.00% 30 Missing ⚠️
...ves.Shared/SignalOperatorMixins.StatefulSignals.cs 0.00% 30 Missing ⚠️
....Shared/SignalOperatorMixins.PassThroughSignals.cs 0.00% 26 Missing ⚠️
...rc/Primitives.Shared/SignalOperatorParityMixins.cs 0.00% 20 Missing ⚠️
src/Primitives.Shared/Signals/Signal{RxAliases}.cs 12.50% 14 Missing ⚠️
src/Primitives.Shared/SignalOperatorMixins.cs 0.00% 6 Missing ⚠️
src/Primitives.Shared/FatalExceptionHelper.cs 88.88% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #63      +/-   ##
==========================================
- Coverage   93.36%   91.93%   -1.44%     
==========================================
  Files         462      464       +2     
  Lines       17208    17622     +414     
  Branches     2052     2091      +39     
==========================================
+ Hits        16067    16201     +134     
- Misses        898     1158     +260     
- Partials      243      263      +20     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Review coverage:

- add focused TUnit coverage for Rx factory aliases, connectable aliases, SubscribeSafe, bounded Merge, SelectMany enumerable branches, event-pattern delegate variants, and Optional null semantics

- raise local patch coverage for coverable runtime additions to 98.54%

Runtime fixes:

- keep async Signal.Create subscription cancellation lifetime valid after async setup completes

- move Signal<T> dispatch helper into the static helper section to satisfy SST1204 without suppression

API and build support:

- ship Range, Interval, and Concat Rx alias API baselines for Primitives and Primitives.Reactive

- add netfx AllowNullAttribute polyfill support for the updated Optional API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant