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
ReactiveUI crashes on initialization in a UWP app #1221
Comments
Thank you for the solid bug report. I'm going to look at this first thing in the morning. This shouldn't happen. 😱 |
I have a UWP app that uses Rx 7 without issue, so I was intrigued by this and just did a little investigation. I can confirm that I can repro the crash if I attempt to use RxUI before What appears to be happening is that RxUI detects that it is not yet initialized, and does so. This involves creating/resolving schedulers to expose via Not sure there's a whole lot RxUI could do here apart from detect the early init attempt and give a better error message. |
That makes sense. From a user PoV, a more specific error message would definitely be welcome, and until a fix is in, a quick note in the docs would be welcome as well. More generally, I wonder if maybe a delayed initialization through the use of something like a Thanks for the quick reply though! |
Should the WaitForDispatcherScheduler be handling this a bit better? For some platforms, we defer to Do we want to
It feels like (2) is a more consistent approach, but there's a chance we make it harder to fall into the pit of success in some cases. Maybe there should be some logging kicked out at the point this occurs anyway? A couple of references for this |
On UWP, the dispatcher can fail with an argument null exception if called before OnLoaded. Fixes reactiveui#1221
On UWP, the dispatcher can fail with an argument null exception if called before OnLoaded. Fixes reactiveui#1221
On UWP, the dispatcher can fail with an argument null exception if called before OnLoaded. Fixes reactiveui#1221
On UWP, the dispatcher can fail with an argument null exception if called before OnLoaded. Fixes reactiveui#1221
Ran into this issue today in 8.0 prerelease. Glad I found this issue for an explanation. I guess I'll just move my RxApp calls to OnLaunched, as suggested, until #1312 gets merged. |
Do you want to request a feature or report a bug?
Bug.
What is the current behavior?
ReactiveUI 7.0 crashes on application start with a TypeInitializationException in UWP apps.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
Create a new, blank UWP app, and add ReactiveUI 7.0 via NuGet. Add some element to your code in, say, App.xaml that makes use of Reactive UI, like
private ReactiveList<string> test = new ReactiveList<string>();
.Observe crash.
What is the expected behavior?
No crashes.
What is the motivation / use case for changing the behavior?
Crashes are bad =)
Which versions of ReactiveUI, and which platform / OS are affected by this issue? Did this work in previous versions of ReativeUI? Please also test with the latest stable and snapshot (http://docs.reactiveui.net/en/contributing/snapshot/index.html) versions.
ReactiveUI 7.0, on Windows 10 Anniversary Update, creating a UWP app. Presumably it worked in previous versions, as I see references to people using it for UWP in 6.5.2.
I see the same issue in the latest snapshot (7.1.0-alpha0003).
Other information (e.g. stacktraces, related issues, suggestions how to fix)
The exception message:
Value cannot be null. Parameter name: dispatcher
Here's the stack trace:
Inner Exception:
Outer Exception:
The text was updated successfully, but these errors were encountered: