Comments (8)
@winterdouglas Thanks for looking into this issue and the detailed report.
from sextant.
Hey @winterdouglas 👋,
Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our Open Collective and consider contributing financially.
https://opencollective.com/reactiveui
PS.: We offer
priority
support for all financial contributors. Don't forget to addpriority
label once you start contributing 😄
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms!
from sextant.
I did a backtracking investigation already as follows:
Versions of libraries
- Xamarin.Forms 4.2.0.910310
- ReactiveUI.XamForms 10.5.43
- System.Reactive 4.3.1
- Android Support 28.0.0.3
Investigation step by step
- Navigating by using the
Navigation
from the page itself works nicely - Changing the
ReactiveCommand
with anICommand
: the issue doesn't happen anymore - At this point I can conclude that the navigation is not the issue but something related to RxUI, Rx.Net or Xamarin.Forms
- Next downgrading RxUI to the latest 9.x (9.22.1): The issue to go away
- Just to make sure it's not Xamarin.Forms I manually changed the version of Xamarin to the initial one mentioned above (4.2.0.910310): The issue still persists
- Downgrading RxUI to 10.5.31: Same results
- Downgrading RxUI down to the version 10.1.7: Same results (checked on 10.5.7, 10.2.2, 10.1.7)
- RxUI 10.1.5: Gives me another exception:
System.TypeInitializationException: 'The type initializer for 'ReactiveUI.RxApp' threw an exception.'
- RxUI 10.1.1: The error above happens on this version too
- RxUI 10.0.1: Here it works again
- RxUI 9.22.1: Works as well
All the above steps were performed with clean and rebuilt project + the app being reinstalled (uninstall/redeploy)
Apparently the issue started from the version 10.1.1 on, the only change from the version 10.0.1 to 10.1.1 is the update of Mono.Android
on the following commit:
reactiveui/ReactiveUI@c4be8bc
from sextant.
Relates to:
#reactiveui/ReactiveUI/issues/2170
from sextant.
I did another round of investigation here and so far I'd say the issue is really related to the command's IsExecuting
.
var canExecute = Observable
.Return(false)
.Delay(TimeSpan.FromSeconds(5), RxApp.TaskpoolScheduler)
.StartWith(true)
.ObserveOn(RxApp.MainThreadScheduler);
PushPage = ReactiveCommand
.CreateFromObservable(() =>
Observable.Return(Unit.Default),
canExecute,
outputScheduler: RxApp.MainThreadScheduler);
I can reproduce the issue with this code above. As you can see the command does nothing and the only thing that happens there is the command's canExecute
being initialized as true
and after 5 seconds going to false
, that's enough to make the app to crash.
I could conclude also that the issue happens only when there's an UI element bound to the command, in this case a button.
from sextant.
Going a bit further with the investigation I could find that by doing the following on the view itself, the code actually breaks as well, so the real issue is not on the command's IsExecuting
but on the RxApp.MainThreadScheduler
that's actually not really the main thread.
In the code below the isMain
will be false by using the latest RxUI version (10.5.43), so when the button's IsEnabled
is set, that's not happening on the main thread.
Observable
.Return(false)
.Delay(TimeSpan.FromSeconds(5), RxApp.TaskpoolScheduler)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(x =>
{
var isMain = Xamarin.Essentials.MainThread.IsMainThread;
PushPage.IsEnabled = x;
});
I'm gonna create a sample with these cases and some unit tests as @RLittlesII suggested.
from sextant.
Ok, I now created a completely clean project with only ReactiveUI
and put the exact same package versions and the code as above, I couldn't reproduce the issue anymore!
Looking further what could be the difference among them I could now find the real issue, it happens because on the Sextant sample the target/compile framework for the Android project is Android 8.1 while in the newly created one is Android 9, that makes the difference.
I noticed that when the project targets Android 8.1 a DefaultScheduler
is resolved while when targeting Android 9 the correct scheduler is resolved.
Sextant sample (compiled using Android 8.1)
Clean sample (compiled using Android 9)
from sextant.
Resolved By: #172
from sextant.
Related Issues (20)
- [BUG] When binding received parameter in ContentPage from INavigable ViewModel exception is thrown that cannot access UI control from another thread HOT 4
- [BUG] Splat.DryIoc UseDryIocDependencyResolver throws NullReferenceException in ViewStackServiceBase ctor HOT 2
- feature: Deep Linking HOT 4
- feature: Add navigation for AvaloniaUI HOT 2
- feature: Master Detail Support For Xamarin Forms HOT 5
- [BUG] PopRootAndTick in ViewStackServiceBase leaves behind the wrong viewmodel HOT 9
- [BUG] navigationService.PopPage does not trigger WhenNavigatedTo HOT 5
- feature: Provide a destruction hook for when the VM/view is going to be popped HOT 2
- [BUG] Can't build UWP HOT 13
- feature: Provide a way to detect when navigation to a view-model is completed, even if no navigation-parameter is being passed HOT 4
- feature: Provide an initialization hook for when the VM/view is going to be added to the stack/pushed HOT 1
- [BUG] Allow ViewModelFactory to resolve Views with contracts HOT 4
- [BUG] WhenNavigatedFrom not being called HOT 2
- feature: Consolidate Extension Methods for Navigation Registration HOT 5
- Apps With a Splash Page? HOT 6
- feature: Add support for Avalonia HOT 3
- [BUG] When calling Locator.CurrentMutable.RegisterNotificationView get exception HOT 7
- [BUG] PushModal does not allways show View HOT 6
- feature: help with winui 3 support HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sextant.