Bug 28498 - [iOS] App crashes when switching between NavigationPages on a MasterDetailPage when In-Call Status Bar is visible
Summary: [iOS] App crashes when switching between NavigationPages on a MasterDetailPag...
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.2
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Rui Marinho
URL:
Depends on:
Blocks:
 
Reported: 2015-03-27 12:03 UTC by Dennis Smit
Modified: 2015-08-11 12:26 UTC (History)
10 users (show)

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


Attachments
Proof of Concept (46.05 KB, application/zip)
2015-03-27 12:03 UTC, Dennis Smit
Details
Updated repro project (54.85 KB, application/zip)
2015-04-01 14:12 UTC, Jimmy [MSFT]
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 Dennis Smit 2015-03-27 12:03:54 UTC
Created attachment 10530 [details]
Proof of Concept

The application crashes on iOS when the user switches between (previously rendered) NavigationPages on a MasterDetailPage when the In-Call Status Bar is visible.
The bug is reproducible in the emulator.

Reproduction steps:

1. Make sure the In-Call Status Bar is disabled before starting the application
2. Start application
3. Open menu
3. Click 'Page 2'
4. Click 'Page 1'
5. Observe that application does not crash
6. Activate In-Call Status Bar (sometimes the application crashes immediately hereafter)
7. Click 'Page 2'
8. Click 'Page 1'
9. Observe that the application crashes with a System.ObjectDisposedException

Code used:

public class App : Application
{       
	public App ()
	{
		var carousel = new NavigationPage(new CarouselPage { Children = { new ContentPage { Content = new Label { Text = "Carousel" } } } });
		var other = new NavigationPage(new ContentPage { Content = new Label { Text = "Other" } });
		var master = new MasterDetailPage { Detail = carousel };

		master.Master = new ContentPage
		{
			Title = "Menu",
			Content = new StackLayout
			{
				Orientation = StackOrientation.Vertical,
				Children = {
						new Button { Text = "Page 1 (Carousel)", Command = new Command(() => master.Detail = carousel) },
						new Button { Text = "Page 2 (Other)", Command = new Command(() => master.Detail = other) },
				},
			}
		};
		
		MainPage = master;
	}		
}

Crash report:
	Mar 27 16:57:04 x CarouselPageProblemiOS[5424]: 
	Unhandled Exception:
	System.ObjectDisposedException: The object was used after being disposed.
	  at Foundation.NSObject.get_SuperHandle () [0x0004e] in /Developer/MonoTouch/Source/maccore/src/Foundation/NSObject2.cs:421 
	  at UIKit.UIViewController.get_View () [0x00030] in /Developer/MonoTouch/Source/monotouch/src/build/native/UIKit/UIViewController.g.cs:2483 
	  at Xamarin.Forms.Platform.iOS.CarouselPageRenderer.get_NativeView () [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.Platform.iOS.VisualElementTracker.OnUpdateNativeControl (CoreAnimation.CALayer caLayer) [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.Platform.iOS.VisualElementTracker.UpdateNativeControl () [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.Platform.iOS.VisualElementTracker.HandlePropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00000] in <filename unknown>:0 
	  at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
	  at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
	  at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
	  at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
	  at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
	  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.MultiPage`1[Xamarin.Forms.ContentPage].OnPropertyChanged (System.String propertyName) [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.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, Boolean fromStyle, Boolean checkAccess) [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindablePropertyKey propertyKey, System.Object value) [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.VisualElement.set_Height (Double value) [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.VisualElement.SetSize (Double width, Double height) [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.VisualElement.set_Bounds (Rectangle value) [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.VisualElement.Layout (Rectangle bounds) [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Rectangle region) [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.Page.LayoutChildren (Double x, Double y, Double width, Double height) [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.Page.UpdateChildrenLayout () [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.Page.OnSizeAllocated (Double width, Double height) [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.VisualElement.SizeAllocated (Double width, Double height) [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.Page.ForceLayout () [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.Page.set_ContainerArea (Rectangle value) [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.Platform.iOS.NavigationRenderer.ViewDidLayoutSubviews () [0x00000] in <filename unknown>:0 
	  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
	  at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62 
	  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:45 
	  at CarouselPageProblem.iOS.Application.Main (System.String[] args) [0x00001] in c:\Development\Personal\CarouselPageProblem\CarouselPageProblem.iOS\Main.cs:17
Comment 1 Jimmy [MSFT] 2015-04-01 14:12:39 UTC
Created attachment 10589 [details]
Updated repro project

I updated the repro project to use the latest pre-release Forms (1.4.2-pre2).

I can confirm that the app crashes with the in-call status bar visible, but the bug is not exclusive to this case. I can also reproduce the bug using the following steps:

1. Run the updated repro project on device/simulator
2. Click “Menu -> Page 2”
3. Rotate the device/simulator to landscape mode
4. Click “Menu -> Page 1”

The app will crash with a System.ObjectDisposedExcpetion but a different stack trace:

System.ObjectDisposedException: The object was used after being disposed.
  at Foundation.NSObject.get_SuperHandle () [0x00015] in /Developer/MonoTouch/Source/maccore/src/Foundation/NSObject2.cs:414
  at UIKit.UIViewController.get_View () [0x00030] in /Developer/MonoTouch/Source/monotouch/src/build/native/UIKit/UIViewController.g.cs:2483
  at Xamarin.Forms.Platform.iOS.CarouselPageRenderer.get_NativeView () [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.VisualElementTracker.OnUpdateNativeControl (CoreAnimation.CALayer caLayer) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.VisualElementTracker.UpdateNativeControl () [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.VisualElementTracker.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 at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
  at at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
  at at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
  at at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
  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.MultiPage`1[Xamarin.Forms.ContentPage].OnPropertyChanged (System.String propertyName) [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.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, Boolean fromStyle, Boolean checkAccess) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindablePropertyKey propertyKey, System.Object value) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.VisualElement.set_Width (Double value) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.VisualElement.SetSize (Double width, Double height) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.VisualElement.set_Bounds (Rectangle value) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.VisualElement.Layout (Rectangle bounds) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Rectangle region) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Page.LayoutChildren (Double x, Double y, Double width, Double height) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Page.UpdateChildrenLayout () [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Page.OnSizeAllocated (Double width, Double height) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.VisualElement.SizeAllocated (Double width, Double height) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Page.ForceLayout () [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Page.set_ContainerArea (Rectangle value) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.NavigationRenderer.ViewDidLayoutSubviews () [0x00000] in <filename unknown>:0
  at at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:46
  at CarouselPageProblem.iOS.Application.Main (System.String[] args) [0x00008] in /Users/jimmygarrido/Downloads/CarouselPageProblem/CarouselPageProblem.iOS/Main.cs:17
Comment 3 peterno 2015-05-07 09:43:15 UTC
We are seeing the same issue.
Our situation is that the app is in the foreground. A phone call arrives that we answer. The app goes in the background but we use a local notification to show a banner so that the user can go back to the app again. We click the banner and the app swithes back, the gui is all black and then it crashes with the call stack below.
Somehow the app automatically restarted!


Time: 5/7/2015 12:45:45 PM
Error: Unhandled Exception
System.Exception: CurrentDomainOnUnhandledException ---> System.ObjectDisposedException: The object was used after being disposed.
  
at Foundation.NSObject.get_SuperHandle () [0x00000] in <filename unknown>:0 
  
at UIKit.UIViewController.get_View () [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.Platform.iOS.PhoneMasterDetailRenderer.get_NativeView () [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.Platform.iOS.VisualElementTracker.OnUpdateNativeControl (CoreAnimation.CALayer caLayer) [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.Platform.iOS.VisualElementTracker.UpdateNativeControl () [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.Platform.iOS.VisualElementTracker.HandlePropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00000] in <filename unknown>:0 
  
at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
  
at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
  
at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
  
at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
  
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.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.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, Boolean fromStyle, Boolean checkAccess) [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindablePropertyKey propertyKey, System.Object value) [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.VisualElement.set_Height (Double value) [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.VisualElement.SetSize (Double width, Double height) [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.VisualElement.set_Bounds (Rectangle value) [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.VisualElement.Layout (Rectangle bounds) [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.Layout.LayoutChildIntoBoundingRegion (Xamarin.Forms.VisualElement child, Rectangle region) [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.Page.LayoutChildren (Double x, Double y, Double width, Double height) [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.Page.UpdateChildrenLayout () [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.Page.OnSizeAllocated (Double width, Double height) [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.VisualElement.SizeAllocated (Double width, Double height) [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.Page.ForceLayout () [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.Page.set_ContainerArea (Rectangle value) [0x00000] in <filename unknown>:0 
  
at Xamarin.Forms.Platform.iOS.NavigationRenderer.ViewDidLayoutSubviews () [0x00000] in <filename unknown>:0 
  
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  
at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00000] in <filename unknown>:0 
  
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00000] in <filename unknown>:0 
  
at Enghouse.Clients.TrioAgent.Mobile.Application.Main (System.String[] args) [0x00000] in <filename unknown>:0 
  
--- End of inner exception stack trace ---
Comment 4 Chris King 2015-06-12 17:26:57 UTC
Fix ready
Comment 5 Jason Smith [MSFT] 2015-07-16 13:24:49 UTC
Should be fixed in 1.4.5-pre1
Comment 6 Parmendra Kumar 2015-08-11 12:26:03 UTC
I have checked this issue with attached sample in comment #1 and I am not getting any exception with Xamarin.Forms 1.5.0-pre1.


Hence closing this issue.