-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
On UWP each new window gets its own ui thread and the way WaitForDispatcherScheduler (which is the default scheduler for RxApp.MainThreadScheduler) works it is inherently only going to work on a single window app. As @anaisbetts put it in Slack, UWP UI thread situation is a "tire fire" and to quote "ReactiveUI is not designed to handle multiple window apps" - which essentially means no ProjectionManager, no ShareTarget, no ApplicationViewSwitcher, nothing multi-window. While I agree with the first part (and begrudgingly the second part), I am not so sure that RxUI shouldn't be considering these issues.
This can cause issues with RxApp.MainThreadScheduler, where each one of these windows runs its own dispatcher thread and is an “Application Single Threaded Apartment” (ASTA). Essentially the framework is blocking what it thinks is a potential deadlock. This particular exception is thrown when code running under one STA (1) calls out to another STA (2) and that STA (2) might have to re-enter STA (1) in order to do its work. The framework throws that exception at this point to try and stop you getting into a mess with deadlocks.
I am currently testing a scheduler that can handle multiple windows/dispatchers and will hopefully manage this as well, but we are still testing it and I'm not sure if I'll be able to block this exception yet (which would make my new scheduler useless... 👎).
Originally posted by @hinterlandsupplyco in #2034 (comment)