-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Bug] [iOS] Freezing/App Crash during Navigation - new in iOS 15 #14783
Comments
We are currently experiencing the same issue in one of our applications that uses a Tabbed Page. We see the hang/freeze occur every time if we use a custom UINavigationControllerDelegate for the MoreNavigationController.Delegate. When we remove this portion of the platform specific render for iOS the hang no longer occurs but frequent crashing still occurs in the application related to #14750 and #14782 |
@justin-loverme just to be clear, this also happens with pre-2196 versions right? We think it might be something that was introduced in iOS and not so much on our side. Which of course doesn't mean that we won't fix it :) Are you maybe able to somehow provide a reproduction sample? At this moment we're unable to reproduce it ourselves which makes it harder to pinpoint the exact location and come up with a fix. |
@jfversluis Correct, this happens in previous Xamarin.Forms versions and also occurs in our current production deployed app. I agree it appears to have been introduced on iOS 15 as in my testing, I cannot reproduce it on iOS 14.8. Not sure I can get a sample project to reproduce it because the Calendar control is a licensed product, but I can see if I can simulate the issue. |
@justin-loverme are you using a custom UINavigationControllerDelegate for the MoreNavigationController.Delegate for in your iOS tabbed page render? |
@FDDenny No, we are not using any custom navigation controls for the iOS project of the solution |
@jfversluis i was able to make a small sample project that recreates the issue. Just used the Getting started project that Xamarin provides and made modifications from there. In order to see the crash/hang you have to go back and forth between selecting items in the menu to the left in the application. It also seems to occur faster if you go into one of the tabbed "more" pages. This wont make it happen right away but it speeds up the time it took for me to see the issue. I was able to reproduces this every time so it should happen for you with in a short time of using the application. I was also able to see a crash at one point that gave me a new stack trace that i hadn't seen before but it still had the removeChildViewController portion in it. I will add that at the bottom of this as well. There is a bit of extra fluff in the iOS Tabbed Page Render, but that allowed the issue to happen quicker just extra information for you. Also i was able to get this to happen on a simulator so there should be no worry about trying to have this work on an actual device. I have created a public repo here if you would like to check it out through github otherwise here is the zip file of it. |
@jsuarezruiz would you like me to comment the sample project on any of the other two tickets that seem to relate to this issue? |
@FDDenny great work! I will check this out, thank you so much for putting this together. No need to add it to the other issues as well :) |
I can reproduce with latest iOS / macios / XF library. Stack trace on device:
|
It looks like we're dealloc a (Xamarin_Forms_Platform_iOS_PageRenderer *) self = 0x00007fca36d1f530 that is already dead I tried running zombie instruments on it and got nothing useful |
In our custom iOS Tabbed Render i overrode the Dispose() functionality and did not call base.Dispose() this no longer caused the crashing and hanging to occur in our application. Obviously this is not a permanent solution as this is causing memory leaks to occur and that is still not a good thing. Extra information: |
For those looking to input a temporary solution this is what we did to minimize the issue. This is in our Custom iOS TabbedRender.cs file we are overriding the base.Dispose so it is not called.
This allows the least amount of people to be effected by a bad practice memory leak that is caused by not properly disposing. This allows for longer use of the application before a "Out Of Memory" Exception is called and force closes the applications rather then what ever issue is currently occurring this does not fix the issue as there is still crashes in both cases but this at least give the user longer time in the application before a restart is required. |
@jsuarezruiz I see this is still under the "Needs Info" and "Unverified" tag is there anything else i can try and provide so this issue can be looked at more? |
@jfversluis Is there any update on this issue? Same experiences for users devices updated to iOS 15.1 |
As you can see from the comments by others on our team, we have done some investigation, but this issue seems a tougher one. And maybe even, like mentioned before: a bug, or at least a change in behavior on the iOS side. So far not a lot of users seem to impacted by this (fortunately for us, unfortunately for you). If you need a fix asap, I would suggest trying to implement a fix/workaround for your app for now. With not a lot of users impacted so far, we can't justify the time to dig in to this for hours on end. I understand this might not be what you want to hear and I'm sorry, but I think it's good to put it out there and manage expectations so that you can also explore other paths. We would be very interested to hear any results of your investigations that might help it fix on our side. |
Is there any progress on this item. |
have the same issue , specially when the tabbar contain more then 5 tabs |
@jfversluis @jsuarezruiz As you can see more occurrences of this issue is still happening. I attempted to add some overrides to Disposing, OnDisappearing, and destruction events. Like @khedheri mentioned, the appears to primarily happen when the TappedPage has more than 5 tabs and thus on iOS the 'more' section is created and the issue seems to happen when the back button is pressed while viewing that inner 'more' tab page. This is a pretty critical issue since we as developer's seem to have no way to resolve this with the page events we are able to override. |
Run into this error today. XF (5.0.0.2337) project running on iOS 15.1. At first, I thought the freeze/crash happened when navigating to another page, but, apparently, it happens eventually when moving around the tabbed pages. @jfversluis do you have any update on this? you mentioned that for the time being people facing this error should try to fix it on their part, but I wouldn't know where to start. Is this actually related to the number of pages? Maybe related to something else we are using like the webview I mentioned before or images/videos inside the child pages? Any hint about the nature of the error will be very useful. |
Hey @mrjavicho unfortunately no new info on this at the moment. |
This issue is still present in iOS 15.4 and Xamarin.Forms 5.0.0.2337. It seems to happen when calling Dispose() in iOS TabbedRender, so somewhere in:
Workaround is:
or
Just implementing DisposeEx or just calling GC.Collect frequently doesn't overcome this problem. I have to use both. Using both using DisposeEx or explicitly frequently calling GC.Collect independently seem to greatly reduce the frequency of this crash on their own. When using both - DisposeEx and frequent explicit GC.Collect calls - app seems to work OK and not crash at all (even without overriding TabbedRender Dispose method). Both of these workarounds are quite problematic so I would be glad if someone takes a look at this problem. I can also confirm I started seeing this crash since upgrading to iOS 15 and I wasn't seeing it before. |
These crashes are increasing more as more users use iOS 15. I can confirm is has to do with the TabbedPage with the More option on iOS when disposing. For our app when the user enters a tabbed page, then hits back to a list and tries to interact with anything else is when it crashes. I tried using these work around options to not dispose of this page, but we see that the app eventually crashes. We have several views with this more option, and it happens 100% of the time on iOS 15+. Is there any update on this bug? Thank you |
Steps to reproduce:
|
I had to use the following method to get it working: UIDevice.CurrentDevice.CheckSystemVersion(15, 0); |
Thank you @SoggyToastMan for your reply. In our case it's freezes rather than crashes, but we have been trying to reproduce this problem for a while and we couldn't quite figure it out until your reply! We have now implemented the DisposeEx and GC.Collect as provided by @simonhornak. We no longer experience freezes when we're trying to reproduce the issue. We can also confirm this started since users started upgrading to iOS15. |
Have you tried by commenting the Dispose method? |
We only tried workaround 2 and we have not tried commenting the Dispose method in that workaround. |
@TrsThomas @alexmartinezm @SoggyToastMan We deactivate base.Dispose() and implement DisposeEx instead. This probably causes a small memory leak (TabbedPage not getting disposed), but thanks to using DisposeEx, this memory leak should be very small - DisposeEx is disposing all Views and Subviews associated with the TabbedPage and only the "empty" TabbedPage isn't disposed. So this should (?) dispose most of the associated resources anyways and "should" be more stable than each workaround on its own.
|
Thank you for posting this. So far this seems to be the best workaround for the bug. |
After about 10 minutes of usage we are noticing the crash still happening =( |
@jfversluis Is there any news yet or an update on this issue? |
Also expecting new from this item... |
@jfversluis Is there any news yet or an update on this issue? |
@jfversluis Any update on this? |
We're still seeing this using iOS 16.4. Is there any update other than the workarounds? |
would upgrading to MAUI fix this issue? |
Any updates on this? |
@pme442 bit the bullet and upgraded to .net maui which sorted this issue |
I'm having this issue on a .NET 8 MAUI that I just created. I create a new MAUI project and set the ContentPage type to TabbedPage on the MainPage page. I'm getting the memory error. When I run the tabbed project in the MAUI Sample projects on my computer, I do not receive any errors. It seems that it is not possible to start a new project with TabbedPage. |
After the release of iOS 15 we have been seeing an issue of freezing and then an app crash for our application and it seems to be a native library that we cannot debug.
All of our Nugets are up-to-date including running on the latest Xamarin.Forms of 5.0.0.2196. We have tried build the app through App Center with its latest tools (builds will fail if you attempt to use anything previous to Xamarin.iOS 15 and Xcode 13). We have tried building using a host Mac running Xamarin.iOS 15.0.0.6 as well as using a PC and remote connecting to a host Mac to force it to build with Xamarin.iOS 15.0.0.8. We have tried installing the Visual Studio 2022 Preview and using the new Xamarin iOS tools there as well.
This issue does not occur on iOS 14.8 devices, only iOS 15.0.x
We think this issue has to do with some kind of garbage collection or disposing of the large memory use that the TabbedPage had since the freeze doesn’t happen instantly on ‘Back’ navigation to the SFCalendar
Again, that cycle doesn't always happen, the user can repeat steps 3-5 and eventually one of the cycles will result in the below:
=================================================================
Native Crash Reporting
Got a segv while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Native stacktrace:
=================================================================
Basic Fault Address Reporting:
Memory around native instruction pointer (0x19ac72378):0x19ac72368 3f 3d 00 f1 a3
00 00 54 c9 12 40 f9 29 ad 7d 92 ?=
.....T..@.).}.
0x19ac72378 37 01 40 b9 b7 00 00 37 08
81 7d 92 08 11 40 f9 7.@....7..}...@.
0x19ac72388 08 ad
7d 92 17 01 40 b9 08 00 80 52 7a d0 3b d5 ..}...@....Rz.;.
0x19ac72398 49 1b 40 b9 f9 8a 20 90 39 f3 24 91 29 7f e8 88 I.@... .
9.$.)...
=================================================================
The text was updated successfully, but these errors were encountered: