Bug in Observable.FromAsync
- Dominant language
- C#
- Stars
- 7.2k
- Forks
- 798
- PR merge metrics
- No merged PRs in 30d
Description
## Bug
### Which library version?
System.Reactive 5.0.0
### What are the platform(s), environment(s) and related component version(s)?
Windows, WPF, net5.0-windows10.0.19041
### What is the use case or problem?
```c#
async Task DoSomethingOnBackgroundThreadAsync()
{
await Task.Run(() => Thread.Sleep(1000));
}
//The following line is executed on the UI-thread, but unexpectedly the Handler is executed on
//a background thread, which led to hard to track down race conditions in our application.
Observable.FromAsync(() => DoSomethingOnBackgroundThreadAsync()).Subscribe(x => Handler());
```
A workaround for the problem is to pass DispatcherScheduler.Current to FromAsync, but it strongly feels like a bug, that should be fixed.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.