Closed Hackmodford closed 2 years ago
The message does say that the call was not made from the UI thread. So I guess there an issue in the reactive ui implementation or the way you are using it. Maybe the collection view is calling the collection changed events delegates from a Device.BeginInvokeOnMainThread context.
I didn't see a way to specify which thread. I'm pretty sure I only have the observeOn and subscribeOn methods to do that.
My guess is that Xamarin.Forms collection view ensures changes in the android adapter are being done on the UI thread. I do know that's how it's handled in MvvmCross. That way it doesn't matter which thread you make the changes on, the platform code will handle it.
So it seems those methods are not working as they should ¯_(ツ)_/¯
From those issues it seems you are not using platform specific reactive ui assemblies, so it defaults to netstandard assembly which doesn't implement the main thread scheduler:
So basically because I'm doing this in my core project (.net standard) it's not going to use the android scheduler? Uggggh
More like you have to add the platform specific version of reactiveui in each of your platform projects... or you can implement (maybe) your own scheduler implemented with Device.BeginInvokeOnMainThread
Platform (please complete the following information):
Describe the bug Using the collectionview with ReactiveUI DynamicData binding causes threading issues.
Android.Util.AndroidRuntimeException: Only the original thread that created a view hierarchy can touch its views.
It didn't seem to matter which thread I observed, or subscribed on. The Xamarin.Forms CollectionView doesn't seem to have this issue.To Reproduce
Exceptions (if applicable) Copy paste the exception and the stack trace