Bug 28335 - [Android] NRE when pushing/popping a page quickly
Summary: [Android] NRE when pushing/popping a page quickly
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 1.4.2
Hardware: PC Mac OS
: Normal critical
Target Milestone: ---
Assignee: Eric Maupin
Depends on:
Reported: 2015-03-23 11:16 UTC by John Miller [MSFT]
Modified: 2015-06-30 13:25 UTC (History)
9 users (show)

Tags: android crash navigation AC RA
Is this bug a regression?: ---
Last known good build:

Test Case (307.41 KB, application/zip)
2015-03-23 11:16 UTC, John Miller [MSFT]

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 John Miller [MSFT] 2015-03-23 11:16:59 UTC
Created attachment 10460 [details]
Test Case


   The attached sample will reproduce an exception when navigating a page back and forth quickly.

**Steps to Reproduce:**

   1. Run the attached sample on an Android Device with API 21
   2. Touch the Push Page button
   3. Touch the Pop Page button
   4. Repeat steps 2 - 3 quickly

**Actual Results:**

[MonoDroid] System.NullReferenceException: Object reference not set to an instance of an object
[MonoDroid] at Xamarin.Forms.NavigationPage.GetHasNavigationBar (Xamarin.Forms.BindableObject) <IL 0x00006, 0x00050>
[MonoDroid] at Xamarin.Forms.Platform.Android.Platform.ShouldShowActionBarTitleArea () <IL 0x00044, 0x00263>
[MonoDroid] at Xamarin.Forms.Platform.Android.Platform.PrepareMenu (Android.Views.IMenu) <IL 0x0004c, 0x00323>
[MonoDroid] at Xamarin.Forms.Platform.Android.FormsApplicationActivity.OnPrepareOptionsMenu (Android.Views.IMenu) <IL 0x00007, 0x00057>
[MonoDroid] at Android.App.Activity.n_OnPrepareOptionsMenu_Landroid_view_Menu_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.21-series/9e05e39f/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.App.Activity.cs:3622
[MonoDroid] at (wrapper dynamic-method) object.7b2d086f-fd9f-4b1b-afb9-4c5e934e8cdf (intptr,intptr,intptr) <IL 0x00017, 0x0004b>

**Expected Results:**

   No crash.

**Build Date & Platform:**

   XF 1.4.0
   Android Api 21

**Additional Information:**

   Pressing the buttons "slowly" does not reproduce the issue.
Comment 3 Ram Chandra 2015-03-30 10:06:05 UTC
I have checked this issue with the steps mentioned in bug description and I am able to reproduce this issue.

Observation: when I press the push and pop button very quickly, I observed that I am getting following exception:

>[mono] Unhandled Exception:
[mono] System.NullReferenceException: Object reference not set to an instance of an object

Screencast: http://www.screencast.com/t/64ULnzuuQH6r

Application Output: https://gist.github.com/RamChBachkheti/3d8296a4eafbfbeb7c60
IDE logs: https://gist.github.com/RamChBachkheti/5d5816281d9a44353f7a
Adb logs: https://gist.github.com/RamChBachkheti/68c7e865a17c7781fdcc

Please let me know if I can provide more info to this issue.

Environment Info:


=== Xamarin Studio ===

Version 5.8.2 (build 7)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
	Mono 3.12.1 ((detached/0849ec7)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312010003

=== Apple Developer Tools ===

Xcode 6.0.1 (6528)
Build 6A317

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: 981acb3
Build date: 2015-03-25 14:21:05-0400

=== Xamarin.Android ===

Version: (Enterprise Edition)
Android SDK: /Users/jatin66/Desktop/Backup/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 Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: (Enterprise Edition)

=== Build Information ===

Release ID: 508020007
Git revision: 067ed06873402cf780f8a0899bb332c2a1c0af22
Build date: 2015-03-27 14:17:13-04
Xamarin addins: 02510c4990dee3475c282b3182d588975a63ff07

=== Operating System ===

Mac OS X 10.10.0
Darwin Dalvik.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Comment 4 Shane 2015-05-06 03:24:41 UTC
I am also hitting this issue but infrequently.
Comment 5 Rui Marinho 2015-06-15 14:34:35 UTC
should be fixed in 1.4.3 final
Comment 6 Parmendra Kumar 2015-06-19 08:46:27 UTC
I have checked this issue with xamarin.forms. and observed that when I press the button very quickly, I observed that application getting crash.

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

ApplicationOutput: https://gist.github.com/Parmendrak/7dd1f0ab678ee854d44b
IDELog: https://gist.githubusercontent.com/Parmendrak/d30baf2db5314a25f97b/raw/IdeLog
BuildOutput: https://gist.github.com/Parmendrak/b319e26dffb36d720dee

Environment info:
Xamarin Studio 5.9.3 (build 1)
Mono 4.0.1 ((detached/ed1d3ec)
GTK+ 2.24.23 (Raleigh theme)
Package version: 400010044
Xcode 6.2 (6776)
Xamarin.iOS : (Enterprise Edition)
Xamarin.Android : (Enterprise Edition)
Mac OS X 10.9.4
Comment 7 Rui Marinho 2015-06-30 07:28:37 UTC
This bug report is indeed fixed.. 

The exception you are seing now Parmendra is another : 

[MonoDroid] System.InvalidOperationException: Page must not already have a parent.
Comment 8 Parmendra Kumar 2015-06-30 11:53:15 UTC
Thanks @Rui 

As per comment #7, I have filed a separate bug: https://bugzilla.xamarin.com/show_bug.cgi?id=31499 for comment 6, I will verify this issue once the bug 31499 will be fixed.