Closed era-maui closed 11 months ago
Yes, unfortunately this is a known issue.
In the very early days somebody deleted an element in the event handler of that element. When my handler continued after the users code, an exception was raised because the element has already been disposed. So I raised all event handlers on a new thread. In hindsight that was a mistake. I should've just told the user not to delete the element in the handler. But eight years later I cannot easily revert this. I would probably break the old code from others.
I see, understandable. Was wondering about this, because it seems that in the Xamarin version of MR.Gestures it still works on the Main thread :)
AFAIK the code is the same. I'll have a look at it.
Sorry, I still have troubles getting .NET8 RC1 running. I'll make sure to run all handlers on the UI thread, but I don't have the time today anymore and I'm on vacation for the next two weeks and also don't want to release right before it.
I released version 4.0.0 now. This version is for .NET7 and 8.
All the event handlers / commands on Android, Tapped
and DoubleTapped
on all platforms were previously run from a background thread. They now run on the UI thread.
It did not matter in Xamarin.Forms because many things there could also be changed from a BG thread. MAUI seems to be less forgiving.
Version 4.0.0 DOES NOT include Xamarin.Forms anymore. It is now for MAUI only. If you still need it in XF, stay at v3.
Hi,
It seems that when using an MR layout in MAUI Android app, when we attach a command to a gesture, the handler is called outside of Main thread. iOS works as expected. A simple test can be done in the sample project. In CustomEventArgsViewModel.cs add a thread check in OnDown method
Can we get more information on whether it is a know issue?