Bug 21527 - Android MasterDetailPage + IsBusy=true causes exception when returning to the page
Summary: Android MasterDetailPage + IsBusy=true causes exception when returning to the...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.2
Hardware: Other Other
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-07-22 19:51 UTC by daniel.luberda
Modified: 2014-10-16 18:28 UTC (History)
4 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:
RESOLVED FIXED

Description daniel.luberda 2014-07-22 19:51:30 UTC
Steps:
1. Click "MAIN MENU BUTTON" - new MasterDetailPage is opened
2. Return to the previous page
3. Click "MAIN MENU BUTTON" - MasterDetailPage is opened second time
4. Try to do swipe gesture to show master page 

Result:
Exception
System.Diagnostics.Debugger.Mono_UnhandledException (ex={System.ArgumentException: 'jobject' must not be IntPtr.Zero.
Parameter name: jobject
at Android.Runtime.JNIEnv.CallNonvirtualBooleanMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x00010] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.14-series/7c475463/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:574
at Android.Support.V4.Widget.DrawerLayout.IsDrawerOpen (Android.Views.View) <IL 0x0009a, 0x0029b>
at Xamarin.Forms.Platform.Android.MasterDetailRenderer.get_Presented () <IL 0x00007, 0x0002e>
at Xamarin.Forms.Platform.Android.MasterDetailRenderer.set_Presented (bool) <IL 0x00002, 0x0002f>
at Xamarin.Forms.Platform.Android.MasterDetailRenderer.HandlePropertyChanged (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x0006a, 0x001c7>
at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00044, 0x0007c>
at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00042>
at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00042>
at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00042>
at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00042>
at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00042>
at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00042>
at Xamarin.Forms.BindableObject.OnPropertyChanged (string) <IL 0x00012, 0x00087>
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty,object,bool,bool,bool) <IL 0x000a3, 0x002d7>
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty,object,bool,bool,bool) <IL 0x00213, 0x007cf>
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty,object,bool) <IL 0x0005a, 0x001e7>
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty,object) <IL 0x00004, 0x00037>
at Xamarin.Forms.MasterDetailPage.set_IsPresented (bool) <IL 0x0000c, 0x0005b>
at Xamarin.Forms.Platform.Android.MasterDetailRenderer.OnDrawerStateChanged (int) <IL 0x0000c, 0x0004b>
at Android.Support.V4.Widget.DrawerLayout/IDrawerListenerInvoker.n_OnDrawerStateChanged_I (intptr,intptr,int) <IL 0x0000b, 0x00062>
at (wrapper dynamic-method) object.725d3710-813d-49e2-bbff-38a682253a87 (intptr,intptr,int) <IL 0x00017, 0x0001f>
}) in 


Code: 
namespace XamarinTest
{
	public class SimpleMainMenu : ContentPage
	{
		MasterDetailBusyBug secondPage = new MasterDetailBusyBug();

		public SimpleMainMenu()
		{
			var button = new Button() {
				Text = "MAIN MENU BUTTON"
			};

			button.Clicked += (sender, e) => 
			{
				Navigation.PushAsync(secondPage);
			};

			Content = button;
		}
	}
	
	public class MasterDetailBusyBug : MasterDetailPage
	{
		public MasterDetailBusyBug()
		{
			IsBusy = true;

			Title = "MasterDetailBusyBug";

			Master = new ContentPage()
			{
				Title = "Master"
			};
			Detail = new ContentPage()
			{
				Title = "Detail",
			};
			Detail.ToolbarItems.Add(new ToolbarItem("ToolbarItem2", "Icon.png", () => {}));
		}
	}
}
Comment 1 Arpit Jha 2014-08-27 07:00:28 UTC
I have checked this issue and able to reproduce it.

I have tried following steps to reproduce it.
1.Create a xamarin PCL application.
2.Add a SimpleMainMenu(.cs) class and did above code in it.
3.Call SimpleMainMenu(.cs) in App.cs
4.Run the application.

I observed that when clicked on MAIN MENU BUTTON then Navigated to MasterDetailBusyBug  page then clicked on back button navigate to MAIN MENU BUTTON
but again when clicked on MAIN MENU BUTTON throws an exception.

Screencast: http://screencast.com/t/Zs9MsQPE

Environment Info:
XVS:3.3.47.0
Comment 2 daniel.luberda 2014-10-16 18:28:08 UTC
It's working fine in 1.2.3