From 970f72848a70e586f83ac56a0338b5551597e89f Mon Sep 17 00:00:00 2001 From: Chris Pulman Date: Sat, 18 Nov 2023 17:37:47 +0000 Subject: [PATCH] Fix null scheduler --- .../ObservableForProperty/POCOObservableForProperty.cs | 2 +- src/ReactiveUI/RxApp.cs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ReactiveUI/ObservableForProperty/POCOObservableForProperty.cs b/src/ReactiveUI/ObservableForProperty/POCOObservableForProperty.cs index 387daf3a8b..0777c3618b 100644 --- a/src/ReactiveUI/ObservableForProperty/POCOObservableForProperty.cs +++ b/src/ReactiveUI/ObservableForProperty/POCOObservableForProperty.cs @@ -34,7 +34,7 @@ public class POCOObservableForProperty : ICreatesObservableForProperty _hasWarned[(type, propertyName)] = true; } - return Observable.Return(new ObservedChange(sender, expression, default), RxApp.MainThreadScheduler) + return Observable.Return(new ObservedChange(sender, expression, default), RxApp.MainThreadScheduler ?? CurrentThreadScheduler.Instance) .Concat(Observable>.Never); } } diff --git a/src/ReactiveUI/RxApp.cs b/src/ReactiveUI/RxApp.cs index f8f3f8d826..e7910e5f55 100644 --- a/src/ReactiveUI/RxApp.cs +++ b/src/ReactiveUI/RxApp.cs @@ -122,10 +122,7 @@ static RxApp() LogHost.Default.Info("Initializing to normal mode"); - if (_mainThreadScheduler is null) - { - _mainThreadScheduler = DefaultScheduler.Instance; - } + _mainThreadScheduler ??= DefaultScheduler.Instance; } ///