Bug 44948 - NullReference Exception at UpdateMasterDetailToggle - Android XF App Only
Summary: NullReference Exception at UpdateMasterDetailToggle - Android XF App Only
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: unspecified
Hardware: PC Windows
: --- blocker
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-09-30 17:49 UTC by bblonchek
Modified: 2016-10-01 22:24 UTC (History)
3 users (show)

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:

Description bblonchek 2016-09-30 17:49:44 UTC
# Steps to reproduce
In Android App
Set Main Page to a page of type MasterDetailPage
Set Master to a ContentPage with content set to a ListView
Set Detail to a TabbedPage
Detail page add children that are a series of NavigationPage(s)

# Expected behavior
App should not crash

# Actual behavior
App crashes with a null reference exception:

 at Xamarin.Forms.Platform.Android.Platform.UpdateMasterDetailToggle (System.Boolean update) [0x00091] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\Platform.cs:507 
  at Xamarin.Forms.Platform.Android.Platform.UpdateActionBar () [0x000a6] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\Platform.cs:457 
  at Xamarin.Forms.Platform.Android.Platform.SetPage (Xamarin.Forms.Page newRoot) [0x000bd] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\Platform.cs:420 
  at Xamarin.Forms.Platform.Android.FormsApplicationActivity.InternalSetPage (Xamarin.Forms.Page page) [0x000b7] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\FormsApplicationActivity.cs:288 
  at Xamarin.Forms.Platform.Android.FormsApplicationActivity.SetMainPage () [0x00000] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\FormsApplicationActivity.cs:307 
  at Xamarin.Forms.Platform.Android.FormsApplicationActivity.LoadApplication (Xamarin.Forms.Application application) [0x0003f] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\FormsApplicationActivity.cs:110 
  at HJAPPx.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0001e] in C:\_PROJECTS\_REPOS\HJAPPx\HJAPPx\HJAPPx.Droid\MainActivity.cs:36 

# Supplemental info (logs, images, videos)

# Test environment (full version information)
Comment 1 Samantha Houts [MSFT] 2016-09-30 18:08:07 UTC
Thank you for taking the time to submit the bug. We tried to reproduce the issue you reported but were unable given the description. 

The following code does not produce an error.

public App()
			var master = new ContentPage { Content = new ListView() { ItemsSource = Enumerable.Range(0, 100) }, Title = "Master" };
			var detail = new TabbedPage();
			detail.Children.Add(new NavigationPage(new ContentPage() { Content = new Label { Text = "Page 1" } }));
			detail.Children.Add(new NavigationPage(new ContentPage() { Content = new Label { Text = "Page 2" } }));
			detail.Children.Add(new NavigationPage(new ContentPage() { Content = new Label { Text = "Page 3" } }));

			var mdp = new MasterDetailPage();
			mdp.Master = master;
			mdp.Detail = detail;

			MainPage = mdp;

If you could please attach a reproduction to the bug by starting with a clean Xamarin.Forms project and adding just the code necessary to demonstrate the issue, we would very much appreciate it.  
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d  
Warm regards, 
Xamarin Forms Team
Comment 2 bblonchek 2016-09-30 21:57:13 UTC
Can you try adding an image for the  master Content Page such as Icon = "menu.png".

This seems to be the cause of the exception on my end.
Comment 3 bblonchek 2016-10-01 22:24:33 UTC
I have resolved this issue