Bug 56952 - Navigating to a page with a master page showing crashes on iOS tablets
Summary: Navigating to a page with a master page showing crashes on iOS tablets
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-05-30 02:26 UTC by Jim Bennett
Modified: 2017-06-22 18:40 UTC (History)
4 users (show)

Tags: masterdetailpage ios ipad ac
Is this bug a regression?: ---
Last known good build:

App with reproduction (18.46 KB, application/zip)
2017-05-30 02:26 UTC, Jim Bennett
Video showing reproduction (933.08 KB, video/quicktime)
2017-05-30 02:30 UTC, Jim Bennett

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Jim Bennett 2017-05-30 02:26:44 UTC
Created attachment 22543 [details]
App with reproduction

To reproduce:

Using an iPad:
Navigation page containing a master detail page
Detail page has a button to navigate to a new page
Open the master page
Close it, and whilst it is still closing tap the button to open the new page
The app will freeze, and when you next tap on it you get a crash:

Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[UIPopoverController _presentPopoverBySlidingIn:fromEdge:ofView:animated:stateOnly:notifyDelegate:]: Popovers cannot be presented from a view which does not have a window.

This looks like it is the same as https://bugzilla.xamarin.com/show_bug.cgi?id=53225

This only happens on iPads, not on iPhones. This is using the latest stable with Forms

Attached is an app that reproduces the issue. It's not easy to do as you have to time it just right. The trick is to slide the master page in and out hopping your finger off and tapping the click me button. You'll see the second page (blue) with the master over it slightly, then the next tap will crash.

Installed Xamarin version:

Visual Studio Enterprise 2017 for Mac
Version 7.0.1 (build 24)
Installation UUID: ef1cd3a3-74fa-4386-aec6-6ed4bd753405
	Mono (2017-02/5077205) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 500010001


.NET Core
Runtime: Not installed
SDK: Not installed
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/msbuild/15.0/bin/Sdks

Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Version: (Visual Studio Enterprise)
Android SDK: /Users/jim.bennett/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		6.0 (API level 23)
		7.1 (API level 25)

SDK Tools Version: 26.0.2
SDK Platform Tools Version: 25.0.5
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

Android Designer EPL code available here:

Apple Developer Tools
Xcode 8.3.2 (12175)
Build 8E2002

Version: (Visual Studio Enterprise)

Version: (Visual Studio Enterprise)
Hash: d2270eec
Branch: d15-2
Build date: 2017-05-22 16:30:53-0400

Xamarin Inspector
Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

Build Information
Release ID: 700010024
Git revision: 7ab1ca2ced6f584e56b7a0d4d321d00775cd95c9
Build date: 2017-05-19 05:44:51-04
Xamarin addins: 08d17158f3365beee5e60f67999e607cce4b3f93
Build lane: monodevelop-lion-d15-2

Operating System
Mac OS X 10.12.5
Darwin 16.6.0 Darwin Kernel Version 16.6.0
    Fri Apr 14 16:21:16 PDT 2017
    root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64

Enabled user installed addins
MFractor 3.00.01
AddinMaker 1.3.7
FileNesting 0.1.1
NuGet Package Management Extensions 0.12.2
Paket 0.3
Redth's Addins 1.0.6
Straight8's SpecFlow Intergration
Comment 1 Jim Bennett 2017-05-30 02:30:08 UTC
Created attachment 22544 [details]
Video showing reproduction
Comment 2 David Ortinau [MSFT] 2017-06-01 17:29:19 UTC
I'm able to reproduce this using the app provided. As described, I swipe off the edge to get the master panel while attempting to also tap the Click Me button. Same crash report.
Comment 3 adrianknight89 2017-06-17 19:08:35 UTC

I'm not sure how far you're into development, and I'm also not sure if this was working for you in previous versions of XF. However, pushing a MasterDetailPage onto a NavigationPage is not a recommended design pattern according to Apple.

Please see https://developer.apple.com/documentation/uikit/uisplitviewcontroller where they have the following:

You cannot push a split view controller onto a navigation stack. Although it is possible to install a split view controller as a child in some other container view controllers, doing is not recommended in most cases. Split view controllers are normally installed at the root of your app’s window. For tips and guidance about ways to implement your interface, see iOS Human Interface Guidelines."

What this is saying is MasterDetailPage must be the root of your application. Since iOS does not support your scenario, I'm not sure how much Xamarin should dig into their codebase to fix your issue. This is of course assuming the issue has to do with your design choice but not some other root cause. I know you've mentioned it works on iPhone, so maybe there is something to be fixed for iPad, but in the long run, I recommended that you change your design pattern.

As a workaround, you can try pushing the MasterDetailPage as a modal and see what happens.
Comment 4 adrianknight89 2017-06-17 20:11:37 UTC
I created a PR to issue a warning to console:


This warning is currently shown for both phone and tablet.
Comment 5 Rui Marinho 2017-06-22 18:40:06 UTC
We now send a Debug message with the information about the issue and best pratices.