Rx for .NET - What happened to Scheduler.Dispatcher?
The DispatcherScheduler
has been moved to the System.Reactive.Windows.Threading
assembly. If you are using NuGet, it's in Rx-WPF
In Rx for .NET v4+ the assemblies/packages are merged in System.Reactive
.
The Dispatcher scheduler can now be found in System.Reactive.Concurrency.DispatcherScheduler.Current
var subscription = observable
.ObserveOn(System.Reactive.Concurrency.DispatcherScheduler.Current)
.Subscribe(observer);
Tested in a .NET core 3.1 WPF application
As of 2016-11-25, the reference is RX-XAML
.
Unfortunately, Microsoft delisted RX v2.2.5 in favour of RX v3.1.0, which is fully cross platform. However, the cross platform libraries do not support WPF. This means that it is now difficult to find the NuGet package which works with WPF.
To work around this, if you are using WPF
+ .NET 4.5
, install any NuGet package with a dependency on RX-XAML
. For example, reactiveui-blend
depends on RX-XAML v2.2.5
, so this will now work:
setClipboard.ObserveOnDispatcher().Subscribe(o =>
{
...
});