-
Notifications
You must be signed in to change notification settings - Fork 337
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
App not responding when open popup on Xamarin 5.0 above, issues happend only iOS version #664
Comments
I've got the same problem only App Forms Shell. |
@nhuy-ecotech have you tried updating to latest to fix the issue? @cribia could you please provide a zipped project recreating the issue that I could troubleshoot the issue on? thank you |
AppPopupTestShell.zip |
hey @cribia while I could replicate your app crashing (froze for me), I updated the demo project for RG to test if it was latest xamarin fault, and it seemed to work fine. When I traced it using your app, I think it may have something to do with how your popups are setup with ViewModels and whatnot. |
Same issue here but not only iOS. Android also presents same problem. |
@ederjbezerra could you provide an example project, or are you using @cribia's |
It's not cribia's project and it's a big project of one of my costumers, with almost 200mb, so it's complicated to share, I would have to take off a lot of code(I don't have much time nowadays). But here is what I'm using to reproduce the problem: Android 11 physical device(galaxy S20+):
iOS 14.4.2 physical device:
If you push / pop some times repeatedly it freezes the application.
Removing these two lines above makes app freeze on iOs at first or second page push, but with these lines it works for 4/5 times before freeze app. Then, after the if:
|
Perhaps this is a threading issue, I could try and recreate this issue using the demo project, I just have some more questions When you call the first snippet, is the assumption that you would have more than 1 page on the stack? or just 1 and greater? Have you tried seeing if the crash happens if you remove the use of PopAllAsync, and instead go for something like a Also, can you see if the crash happens when there is only 1 page on the popupstack? I have some suspicions looking through the code of PopAllAsync and I'm wondering if deadlocks come forth because of the way it has been created. |
Bingo! Using foreach and popping each page solves the problem. And yes, having just one page also presents this issue. |
Excellent, okay, so there is definitely something up with PopAllAsync. I'll look into it closer, glad i could help |
How were you able to work around this? I am currently having this issue, and I am thinking to downgrade my Xamarin.Forms version, is this what you did? |
@Kikanye So, if you use PopAllAsync, instead see if you could use foreach (var popupPage in Rg.Plugins.Popup.Services.PopupNavigation.Instance.PopupStack)
{
await Rg.Plugins.Popup.Services.PopupNavigation.Instance.RemovePageAsync(popupPage);
} OR you could use the following as well, I haven't tested it but its the same idea for (int stackCount = Rg.Plugins.Popup.Services.PopupNavigation.Instance.PopupStack.Count; stackCount > 0; stackCount--)
{
await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PopAsync();
} |
@LuckyDucko enumerating the stack with foreach and modifying its content will raise a System.InvalidOperationException: 'Collection was modified; enumeration operation may not execute.' a simple workaround is to call ToList() which will copy the values to a separate list |
Ah, good point @darrabam, didn't give it too much thought as @ederjbezerra thought it fine, but I assume he tinkered it similar to what you had it. I think I am going to change it to while (PopupNavigation.Instance.PopupStack.Count > 0)
{
await PopupNavigation.Instance.PopAsync(false);
} As it seems the simplest way to go about it. While the current way uses var popupTasks = PopupStack.ToList().Select(page => RemovePageAsync(page, animate));
return Task.WhenAll(popupTasks); It does seem to have an issue here or there. |
This is still not working for me. I had to downgrade to 2.0.0.7 |
🐛 Bug Report
App not responding when open popup on Xamarin Form 5.0 above, issues happend only iOS version. Please fix it.
Configuration
Xamarin Form version 5.0 above
Version: 1.x
Platform:
The text was updated successfully, but these errors were encountered: