Skip to content

Conversation

@ChrisPulman
Copy link
Member

What kind of change does this PR introduce?

Update

What is the current behavior?

Using RxApp.MainThreadScheduler and RxApp.TaskpoolScheduler

What is the new behavior?

Refactors all usages of RxApp.MainThreadScheduler and RxApp.TaskpoolScheduler to use RxSchedulers.MainThreadScheduler and RxSchedulers.TaskpoolScheduler, respectively. Updates documentation comments, registration logic, and all relevant method calls to reference the new RxSchedulers static class. Also removes obsolete dispatcher extension methods from DispatcherObservable.cs and ensures scheduler usage is consistent across all platforms and components.

What might this PR break?

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Other information:

Refactors all usages of RxApp.MainThreadScheduler and RxApp.TaskpoolScheduler to use RxSchedulers.MainThreadScheduler and RxSchedulers.TaskpoolScheduler, respectively. Updates documentation comments, registration logic, and all relevant method calls to reference the new RxSchedulers static class. Also removes obsolete dispatcher extension methods from DispatcherObservable.cs and ensures scheduler usage is consistent across all platforms and components.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the ReactiveUI codebase to replace RxApp.MainThreadScheduler and RxApp.TaskpoolScheduler with their RxSchedulers equivalents. The goal is to provide scheduler access without requiring unreferenced code attributes, supporting AOT compilation scenarios. The changes span platform-specific registrations, core ReactiveCommand implementation, and various UI platform adapters.

Key changes:

  • Replaced all references to RxApp.MainThreadScheduler and RxApp.TaskpoolScheduler with RxSchedulers.MainThreadScheduler and RxSchedulers.TaskpoolScheduler across 30+ files
  • Updated XML documentation comments to reference the new RxSchedulers class
  • Removed obsolete dispatcher extension methods (ObserveOnDispatcher, SubscribeOnDispatcher) from WPF's DispatcherObservable.cs

Reviewed changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/ReactiveUI/RxSchedulers.cs Updated documentation to reference RxSchedulers instead of RxApp
src/ReactiveUI/Routing/RoutingState.cs Updated scheduler initialization to use RxSchedulers
src/ReactiveUI/ReactiveCommand/ReactiveCommandBase.cs CRITICAL: Changed event invocation from synchronous to scheduled on MainThreadScheduler
src/ReactiveUI/ReactiveCommand/ReactiveCommand.cs Updated documentation and added ObserveOn to CanExecute subscription; updated CreateRunInBackground methods
src/ReactiveUI/Platforms/*/PlatformRegistrations.cs Updated scheduler registrations across all platforms (UIKit, Tizen, Android, Mac, .NET, Blazor, WPF, WinForms, MAUI)
src/ReactiveUI/Platforms/*/UI components Updated scheduler usage in table views, collection views, reactive views, and controls
src/ReactiveUI/ObservableForProperty/POCOObservableForProperty.cs Updated scheduler reference in observable creation
src/ReactiveUI/Mixins/AutoPersistHelper.cs Updated Throttle and Schedule calls to use RxSchedulers
src/ReactiveUI/Builder/ReactiveUIBuilder.cs Updated scheduler configuration to set RxSchedulers properties
src/ReactiveUI.sln Minor formatting change (removed " d18.0" suffix from VisualStudioVersion)
src/ReactiveUI.Wpf/Rx/Linq/DispatcherObservable.cs Removed obsolete ObserveOnDispatcher and SubscribeOnDispatcher extension methods
src/ReactiveUI.Wpf/Registrations.cs Updated WPF scheduler registrations
src/ReactiveUI.Wpf/Common/ViewModelViewHost.cs Updated ObserveOn call to use RxSchedulers
src/ReactiveUI.Winforms/Registrations.cs Updated WinForms scheduler registration
src/ReactiveUI.Maui/RoutedViewHost.cs Updated ObserveOn and Schedule calls to use RxSchedulers
src/ReactiveUI.Maui/Registrations.cs Updated MAUI scheduler registrations
src/ReactiveUI.Maui/Common/ViewModelViewHost.cs Updated ObserveOn call to use RxSchedulers
src/ReactiveUI.Builder.WpfApp/ViewModels/*.cs Updated ObserveOn and Schedule calls in example app
src/ReactiveUI.Builder.WpfApp/App.xaml.cs Changed Build() to BuildApp() and updated ObserveOn call
src/ReactiveUI.Blend/Platforms//ObservableTrigger.cs Updated ObserveOn calls to use RxSchedulers
src/ReactiveUI.Blend/FollowObservableStateBehavior.cs Updated ObserveOn call to use RxSchedulers
src/ReactiveUI.Blazor/Registrations.cs Updated Blazor scheduler registrations

Eliminated the use of ObserveOn and explicit scheduling on the main thread when raising CanExecuteChanged events. This simplifies event invocation and avoids unnecessary scheduler dependencies.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 37 out of 37 changed files in this pull request and generated no new comments.

Replaces _synchronizedExecutionInfo with _executionInfo when notifying the start of execution in the Execute method. Ensures correct subject is used for execution state updates.
@ChrisPulman ChrisPulman enabled auto-merge (squash) November 30, 2025 15:12
Updated CombinedReactiveCommand and ReactiveCommand to use RxApp.MainThreadScheduler instead of RxSchedulers.MainThreadScheduler for output scheduling. This change ensures consistency during tests and aligns with the preferred scheduler usage in ReactiveUI tests.
@ChrisPulman ChrisPulman merged commit 9308d79 into main Nov 30, 2025
4 checks passed
@ChrisPulman ChrisPulman deleted the UpdateRxAppToRxSchedulersForSchedulers branch November 30, 2025 18:15
@codecov
Copy link

codecov bot commented Nov 30, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 33.94%. Comparing base (da99d4a) to head (eff8811).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/ReactiveUI/ReactiveCommand/ReactiveCommand.cs 57.14% 3 Missing ⚠️
src/ReactiveUI.Maui/Registrations.cs 0.00% 2 Missing ⚠️
src/ReactiveUI.Maui/RoutedViewHost.cs 0.00% 2 Missing ⚠️
.../ReactiveUI/Platforms/net/PlatformRegistrations.cs 0.00% 2 Missing ⚠️
...ObservableForProperty/POCOObservableForProperty.cs 0.00% 1 Missing ⚠️
...ctiveUI/ReactiveCommand/CombinedReactiveCommand.cs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4213      +/-   ##
==========================================
+ Coverage   33.90%   33.94%   +0.03%     
==========================================
  Files         145      145              
  Lines        6264     6269       +5     
  Branches      943      945       +2     
==========================================
+ Hits         2124     2128       +4     
  Misses       3973     3973              
- Partials      167      168       +1     

☔ View full report in Codecov by Sentry.
📢 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.

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.

3 participants