Bug 41842 - Set MasterDetailPage.Detail = New Page() twice will crash the application when set MasterBehavior = MasterBehavior.Split
Summary: Set MasterDetailPage.Detail = New Page() twice will crash the application whe...
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.2.0
Hardware: PC Windows
: Normal major
Target Milestone: UWP
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-06-15 10:12 UTC by Mike
Modified: 2016-06-30 13:40 UTC (History)
4 users (show)

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


Attachments
MasterDetail Page crash problem with MasterBehavior="Split" (69.47 KB, application/x-rar)
2016-06-15 17:49 UTC, Mike
Details


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 Mike 2016-06-15 10:12:29 UTC
If using UWP MasterDetailPage, set MasterBehavior = MasterBehavior.Split 

then if we set this twice : MasterDetailPage.Detail = New Page() ;

The application will crash.
Comment 1 Samantha Houts [MSFT] 2016-06-15 17:11:01 UTC
The MasterDetailPage has a couple of minimum requirements:

1. You must set both the Master and Detail page.
2. The Master page must have a Title.

If these requirements are not met, the application will throw an InvalidOperationException. This is expected.

The following setup will work without error.

MasterBehavior = MasterBehavior.Split;

Master = new Page() { Title = "Master" };

Detail = new Page();
Detail = new Page();

Thank you!
Comment 2 Mike 2016-06-15 17:32:12 UTC
Yes, the master page already set and it already has the title.  I already create the master page in the MasterDetailPage itself.

This is my MasterDetail page.

<MasterDetailPage>
  <MasterDetailPage.Master>
    <ContentPage Title="My Title">
          --         -- 
   </ContentPage>
  </MasterDetailPage.Master>
</MasterDetailPage>
Comment 3 Mike 2016-06-15 17:32:54 UTC
Hold.  I create a sample file and upload.
Comment 4 Mike 2016-06-15 17:47:09 UTC
I confirm the problem again. Please download the sample code which I upload and check it. Thank you.
Comment 5 Mike 2016-06-15 17:49:43 UTC
Created attachment 16341 [details]
MasterDetail Page crash problem with MasterBehavior="Split"
Comment 6 Samantha Houts [MSFT] 2016-06-16 01:40:15 UTC
I see. This appears to only happen if the MainPage is swapped as you have done in this sample. Thank you for the reproduction!
Comment 7 Rui Marinho 2016-06-16 17:15:53 UTC
Should be fixed in 2.3.1-pre1
Comment 8 Parmendra Kumar 2016-06-30 13:40:06 UTC
I have checked this issue with Xamarin.Forms 2.3.1-pre1 and its working fine.

Hence closing this issue.