-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Replace RxApp schedulers with RxSchedulers throughout codebase #4213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
There was a problem hiding this 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.MainThreadSchedulerandRxApp.TaskpoolSchedulerwithRxSchedulers.MainThreadSchedulerandRxSchedulers.TaskpoolScheduleracross 30+ files - Updated XML documentation comments to reference the new
RxSchedulersclass - 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.
There was a problem hiding this 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.
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.
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
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
Other information: