Bug 28379 - [iOS] App crashes with SIGSEV when tapping the "More" tab when a page from the "More" tab is already selected.
Summary: [iOS] App crashes with SIGSEV when tapping the "More" tab when a page from th...
Status: Tracked in Related Links
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.3
Hardware: Macintosh Mac OS
: High major
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-03-24 14:30 UTC by Jon Goldberger [MSFT]
Modified: 2018-07-21 00:51 UTC (History)
12 users (show)

Tags: ac, tabbedpage, navigation
Is this bug a regression?: ---
Last known good build:

test Project (5.30 MB, application/zip)
2015-03-24 14:30 UTC, Jon Goldberger [MSFT]
repro project (173.23 KB, application/zip)
2015-08-31 19:41 UTC, Jimmy [MSFT]

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 28379 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Tracked in Related Links

Description Jon Goldberger [MSFT] 2015-03-24 14:30:06 UTC
Created attachment 10474 [details]
test Project

## Description

With a TabbedPage as the main page, and having enough child pages of the TabbedPage so there is a "More" tab, tapping the "More" tab when a page from the "More" tab is already selected causes a crash with the following stack trace:

>critical: Stacktrace:

>critical:   at <unknown> <0xffffffff>
>critical:   at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x00095, 0xffffffff>
>critical:   at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
>critical:   at UIKit.UIApplication.Main (string[],string,string) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:46
>critical:   at TestTabbedPage.iOS.Application.Main (string[]) [0x00008] in /Users/apple/Downloads/TestTabbedPage/TestTabbedPage/TestTabbedPage.iOS/Main.cs:13
>critical:   at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
>Native stacktrace:

>Got a SIGSEGV while executing native code. This usually indicates
>a fatal error in the mono runtime or one of the native libraries 
>used by your application.

This is only when each child page of the TabbedPage is wrapped in a NavigationPage.
In the sample, the TabbedPage is also wrapped in a NavigationPage. Removing the
NavigationPage wrapper for the child pages does resolve this issue, but then
the Navigation bar, if shown, does not show the title of the child pages and
then also an extra Navigation bar is shown when the "More" tab is selected. If
the Navigation bar for the TabbedPage is not shown, using
NavigationPage.SetHasNavigationBar(this, false), then there is no Navigation
bar until a child page pushes a new page. 

## Steps to reproduce:

1. Load attached test project and run to an iOS simulator or device.

2. Tap the "More" tab.

3. Select a page from the list.

4. Tap the "More" tab again.

Expected result: The list of pages in the "More" tab will be displayed again.

Actual Result: The app crashes with the above SIGSEV error

## Notes

I tested this with Xamarin Forms 1.4.1-Pre1 and 1.4.1-Pre2.

As noted above, removing the NavigationPage wrapping from the child pages
resolves this issue. You can test this by commenting out the AddChildPage
method in MainPage.cs and uncommenting the alternate version that has the
comment above it "Without NavigationPage wrapping the child pages". Try the
same steps as above and the the actual result will match the expected result.
Comment 3 Jimmy [MSFT] 2015-08-31 19:41:55 UTC
Created attachment 12698 [details]
repro project

Added updated project to demonstrate issue is still present with Forms 1.5.0-pre3. As Jon mentioned, this issue only happens when the children pages are NavigationPages.

*** Steps to Reproduce ***
1. Run the iOS project
2. Select the "More" tab
3. Select a page from the list
4. Press the "More" tab to return to the More list

*** Actual Results ***
The app crashes.

*** Expected Results ***
App navigates back to "More" page
Comment 4 Jimmy [MSFT] 2015-08-31 19:42:47 UTC
Marking as NEW since I've added an updated repro project in comment #3
Comment 5 Paul DiPietro [MSFT] 2015-09-02 15:57:44 UTC
Thanks for the updated reproduction, Jimmy. The app is indeed crashing. However, there is away to circumvent the issue, which may perhaps help isolate the exact cause. While the app is running and a page has been selected from the More tab, by tapping any of the page tabs once and then returning to the More tab, tapping it again (returning from the page it was on to the list) does not cause a crash.
Comment 6 Jimmy [MSFT] 2016-12-13 20:05:45 UTC
Crash still occurs with Forms
Comment 7 Michel Moorlag 2017-02-16 13:09:37 UTC
Also in Forms

I get this:

2017-02-16 13:59:13.676 CrystalLight.iOS[51089:2601625] critical: Stacktrace:
2017-02-16 13:59:13.676 CrystalLight.iOS[51089:2601625] critical:   at <unknown> <0xffffffff>
2017-02-16 13:59:13.677 CrystalLight.iOS[51089:2601625] critical:   at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x0005c, 0x0034b>
2017-02-16 13:59:13.677 CrystalLight.iOS[51089:2601625] critical:   at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:79
2017-02-16 13:59:13.677 CrystalLight.iOS[51089:2601625] critical:   at UIKit.UIApplication.Main (string[],string,string) [0x00038] in /Users/builder/data/lanes/3969/7beaef43/source/xamarin-macios/src/UIKit/UIApplication.cs:63
2017-02-16 13:59:13.678 CrystalLight.iOS[51089:2601625] critical:   at CrystalLight.iOS.Application.Main (string[]) [0x00001] in C:\Users\michelm.FUSIONBV\Source\Repos\Crystal 3\CrystalLight\CrystalLight.iOS\Main.cs:17
2017-02-16 13:59:13.678 CrystalLight.iOS[51089:2601625] critical:   at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00051, 0x0030a>
2017-02-16 13:59:13.678 CrystalLight.iOS[51089:2601625] critical: 
Native stacktrace:

2017-02-16 13:59:13.679 CrystalLight.iOS[51089:2601625] critical: 
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
The app has been terminated.
Launch failed. The app 'CrystalLight.iOS' could not be launched on 'iPhone 5s iOS 10.2'. Error: An error occurred while executing MTouch. Please check the logs for more details.
The app has been terminated.
Comment 8 Michel Moorlag 2017-04-11 13:50:33 UTC
More then two years since this bug was discovered and still no fix :(
Version still crashes.
Comment 9 Ione Souza Junior 2017-04-11 17:41:41 UTC
Hi Michel, let me suggest for you an small workaround for this.

For iOS devices, if you have more than five tabs and running in smartphone, add your first four tabs and create your custom "more page" to add as new tab, totalizing five tabs only. You can create your tabs using code behind for more control over your tabs.

In your custom "more page" add a list containing your others pages to show.

I know if this is not an elegant solution, but solve temporary the problem.
Comment 10 Michel Moorlag 2017-04-12 08:56:09 UTC
Hi Ione,

The thing is that users of my application can dynamically add and remove tabs themselves. So If I create a custom "more page" page it has to deal with this and only be show after the fifth tab was added by the user. But it is possible and a good suggestion. It also solves the issues on Android that if you add many tabs they become very small and unreadable. Yeah this is worth a try, thank you for this very good suggestion. Hadn't thought about it this way.

But what surprises me though is that such a serious bug is ignored for such a long time.
Comment 11 Ione Souza Junior 2017-04-12 14:31:51 UTC
Hi Michel. For Android, if you have many tabs to render you can configure tab mode to scrollable in your tabs.xaml file: app:tabMode="scrollable".
Comment 12 Mobigital 2017-05-25 19:49:03 UTC
I seem to be able to avoid the crash on iOS if adding the extra pages which end up in the "More Page" without wrapping them in NavigationPage(). The tapping "more" doesn't blow it up, since there is only one navigation controller at that time.

However, when these extra pages are displayed they have the top of their content overlapped by the Navigation bar created by TabbedPage, it seems that the page itself is unaware of the navigation bar. 

Is the recommended path for this still to create an own "More" tab page? or is there a way to make the child page aware of the imposed navigation bar?