Bug 25319 - Setting a different Detail page from a MasterDetailPage after 2nd time on MainPage
Summary: Setting a different Detail page from a MasterDetailPage after 2nd time on Mai...
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.0
Hardware: Other Other
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-12-12 04:54 UTC by Tim Brand
Modified: 2015-01-28 13:18 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

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:
Status:
VERIFIED FIXED

Description Tim Brand 2014-12-12 04:54:10 UTC
In my application I've a ContentPage and from there I'm able to open a MasterDetailPage, and I'm able to open this MasterDetailPage on a specific Detail page. This masterdetailpage is only initiated once and stored in a local variable.
The first time opening the MasterDetailPage (directly or not to a specific page) is working fine, but when I go back to my ContentPage before that and then selecting another Page to open directly in my MasterDetailPage it fails on setting the Detail page. When I open the same page on my 2nd attempt it doesn't fail.

It's behavior is different on iOS and Android.
iOS: It results in an exception
Android: The previous page is still opened. After going back again and selecting again the page I want to open it's showing my correct page.

App to reproduce the issue: https://github.com/App-Artment/xamarin-forms-tests

(small note: When the MasterDetail page is openend for the 2nd time, the menu button fails. I will create a new report for this)

Steps to reproduce on iOS:
- Open app
- 'Tap here to start'
- select: MasterDetail Navigation ->> Page 1
- Press START on navigationbar
- select: MasterDetail Navigation ->> Page 2 (<< This will result in the following exception)
Exception:
MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: UIViewControllerHierarchyInconsistency Reason: child view controller:<Xamarin_Forms_Platform_iOS_PageRenderer: 0x7c3290b0> should have parent view controller:<Xamarin_Forms_Platform_iOS_PhoneMasterDetailRenderer_ChildViewController: 0x7c328dd0> but actual parent is:<Xamarin_Forms_Platform_iOS_PhoneMasterDetailRenderer_ChildViewController: 0x7f3ee110>
  at at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend_IntPtr (intptr,intptr,intptr)
  at MonoTouch.UIKit.UIView.AddSubview (MonoTouch.UIKit.UIView view) [0x00021] in /Developer/MonoTouch/Source/monotouch/src/build/compat/UIKit/UIView.g.cs:613
  at Xamarin.Forms.Platform.iOS.PhoneMasterDetailRenderer.UpdateMasterDetailContainers () [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.PhoneMasterDetailRenderer.HandlePropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00000] in <filename unknown>:0
  at at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
  at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.MasterDetailPage.set_Detail (Xamarin.Forms.Page value) [0x00000] in <filename unknown>:0
  at XamarinFormsTests.Views.MasterDetailNavigation.OpenPage (Int32 index) [0x00025] in /Users/tim/Projects/XamarinFormsTests/XamarinFormsTests/Views/MasterDetailNavigation.cs:85
  at XamarinFormsTests.Views.MainMenuPage+<InitPageContent>c__AnonStorey0.<>m__0 (System.Object sender, Xamarin.Forms.SelectedItemChangedEventArgs e) [0x00208] in /Users/tim/Projects/XamarinFormsTests/XamarinFormsTests/Views/MainMenuPage.cs:92
  at at (wrapper delegate-invoke) System.EventHandler`1<Xamarin.Forms.SelectedItemChangedEventArgs>:invoke_void_object_TEventArgs (object,Xamarin.Forms.SelectedItemChangedEventArgs)
  at at (wrapper delegate-invoke) System.EventHandler`1<Xamarin.Forms.SelectedItemChangedEventArgs>:invoke_void_object_TEventArgs (object,Xamarin.Forms.SelectedItemChangedEventArgs)
  at Xamarin.Forms.ListView.OnSelectedItemChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindablePropertyContext context, System.Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, SetValueFlags attributes) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.ListView.NotifyRowTapped (Int32 groupIndex, Int32 inGroupIndex) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.ListViewRenderer+ListViewDataSource.RowSelected (MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) [0x00000] in <filename unknown>:0
  at at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:46
  at XamarinFormsTests.iOS.Application.Main (System.String[] args) [0x00008] in /Users/tim/Projects/XamarinFormsTests/iOS/Main.cs:17

Steps to reproduce on Android:
- Open app
- 'Tap here to start'
- select: MasterDetail Navigation ->> Page 1
- Press START on actionbar
- select: MasterDetail Navigation ->> Page 2 (<< Page 1 is still showed now)
- Press START on actionbar
- select: MasterDetail Navigation ->> Page 2 (<< Correct page is showed on 2nd attempt)


Version info:
Xamarin Forms: 1.3.0.6280-pre2

Xamarin Studio
Version 5.5.4 (build 15)
Runtime:
    Mono 3.10.0 ((detached/92c4884)
    GTK+ 2.24.23 (Raleigh theme)

    Package version: 310000031

Xamarin.Android
Version: 4.20.0.28 (Indie Edition)
Android SDK: /Users/tim/Library/Developer/Xamarin/android-sdk-mac_x86
    Supported Android versions:
        2.1    (API level 7)
        2.2    (API level 8)
        2.3    (API level 10)
        3.1    (API level 12)
        3.2    (API level 13)
        4.0    (API level 14)
        4.0.3  (API level 15)
        4.1    (API level 16)
        4.2    (API level 17)
        4.3    (API level 18)
        4.4    (API level 19)
        4.4.87 (API level 20)
        5.0    (API level 21)
Java SDK: /usr/
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
Comment 1 Udham Singh 2014-12-17 12:41:49 UTC
I have checked this issue with the help of instructions and sample app provided in bug description, and observed the same behaviour mentioned in bug description.

Screencast : http://www.screencast.com/t/Rqpz01pFCNG

iOS Application Output Log : https://gist.github.com/Udham1/8d310e7c9e7c5f9d06e2
Android Application Output Log : https://gist.github.com/Udham1/62c215dd79a745da421e
Ide Log : https://gist.github.com/Udham1/adc830768fe53164288e
Android Tools Log : https://gist.github.com/Udham1/99b1948a411537b476f7
iOS Designer Log : https://gist.github.com/Udham1/8283688f7960ddf399d4

Environment Info : 

Xamarin.Forms  : 1.3.0.6280-pre2

=== Xamarin Studio ===

Version 5.7 (build 652)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
Runtime:
    Mono 3.12.0 ((detached/a813491)
    GTK+ 2.24.23 (Raleigh theme)

    Package version: 312000068

=== Apple Developer Tools ===

Xcode 6.1 (6602)
Build 6A1052c

=== Xamarin.iOS ===

Version: 8.6.0.32 (Enterprise Edition)
Hash: f31ad46
Branch: 
Build date: 2014-12-12 17:56:03-0500

=== Xamarin.Android ===

Version: 4.20.0.28 (Enterprise Edition)
Android SDK: /Users/xamarin76/Desktop/android-sdk-macosx
    Supported Android versions:
        1.6    (API level 4)
        2.1    (API level 7)
        2.2    (API level 8)
        2.3    (API level 10)
        3.1    (API level 12)
        4.0    (API level 14)
        4.0.3  (API level 15)
        4.1    (API level 16)
        4.2    (API level 17)
        4.3    (API level 18)
        4.4    (API level 19)
        4.4.87 (API level 20)
        5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.Mac ===

Version: 1.11.3.0 (Enterprise Edition)

=== Build Information ===

Release ID: 507000652
Git revision: 042e44ba92a6a9c46bd2b69b0b4348df43f381ea
Build date: 2014-12-11 18:37:24-05
Xamarin addins: 06d3aaafde7f726d508e079c9b297cc9aae4af55

=== Operating System ===

Mac OS X 10.9.4
Darwin Xamarin76s-Mac-mini.local 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Comment 2 Jason Smith [MSFT] 2015-01-14 16:36:28 UTC
Should be fixed in 1.3.2-pre1
Comment 3 Udham Singh 2015-01-28 13:18:51 UTC
I have checked this issue on following builds

Environment Info : 

Xamarin.Forms 1.3.2.6307

Mac OS X 10.9.5
Xamarin Studio  5.7.1 (build 15)
Mono 3.12.0 ((detached/a813491)
GTK+ 2.24.23 (Raleigh theme)
Xcode 6.1.1 (6611)
Xamarin.iOS 8.6.1.23 (Business Edition)
Xamarin.Android 4.20.0.28 (Business Edition)

Now this is working fine, Hence closing this issue.

Screencast : http://www.screencast.com/t/tx2nnODyrjDk