Bug 41153 - jobject must not be IntPtr.Zero with TabbedPage and ToolbarItems
Summary: jobject must not be IntPtr.Zero with TabbedPage and ToolbarItems
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.1
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-05-18 12:50 UTC by John Miller [MSFT]
Modified: 2016-10-07 13:05 UTC (History)
8 users (show)

Tags: ac
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:
VERIFIED FIXED

Description John Miller [MSFT] 2016-05-18 12:50:12 UTC
**Overview:**

   Selecting a ToolbarItem after switching between tabbed pages causes an exception. 

**Steps to Reproduce:**

   1. Download/Clone https://github.com/codemillmatt/droidcrash
   2. Run on Android Emulator
   3. Click between the tabs
   4. Click one of the toolbar buttons on the first tab.

**Actual Results:**

[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] System.ArgumentException: 'jobject' must not be IntPtr.Zero.
[MonoDroid] Parameter name: jobject
[MonoDroid]   at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod) [0x00010] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:170 
[MonoDroid]   at Android.Views.View.get_Context () [0x0002d] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.View.cs:4891 
[MonoDroid]   at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.UpdateMenu () [0x00006] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\AppCompat\NavigationPageRenderer.cs:643 
[MonoDroid]   at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.HandleToolbarItemPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00045] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\AppCompat\NavigationPageRenderer.cs:387 
[MonoDroid]   at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
[MonoDroid]   at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x0000a] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Core\BindableObject.cs:137 
[MonoDroid]   at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Core\Element.cs:362 
[MonoDroid]   at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindablePropertyContext context, System.Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent) [0x000f4] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Core\BindableObject.cs:581 
[MonoDroid]   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes) [0x0014b] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Core\BindableObject.cs:378 
[MonoDroid]   at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, Boolean fromTarget) [0x0020c] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Core\BindingExpression.cs:177 
[MonoDroid]   at Xamarin.Forms.BindingExpression.Apply (Boolean fromTarget) [0x0003e] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Core\BindingExpression.cs:55 
[MonoDroid]   at Xamarin.Forms.BindingExpression+BindingExpressionPart.<PropertyChanged>b__44_0 () [0x00000] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Core\BindingExpression.cs:475 
[MonoDroid]   at Java.Lang.Thread+RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/src/Java.Lang/Thread.cs:36 
[MonoDroid]   at Java.Lang.IRunnableInvoker.n_Run (IntPtr jnienv, IntPtr native__this) [0x00009] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Java.Lang.IRunnable.cs:71 
[MonoDroid]   at (wrapper dynamic-method) System.Object:7d5e08f0-ec1f-4e2b-92d1-0b8e917fae47 (intptr,intptr)

**Expected Results:**

   No crash. 

**Build Date & Platform:**

=== Xamarin Studio Enterprise ===

Version 5.10.3 (build 51)
Installation UUID: e01c3049-a2d2-4e0a-aad8-afe6fb627c4d
Runtime:
	Mono 4.2.4 (explicit/71b88f3)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402040004

=== Xamarin.Profiler ===

Version: 0.32.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Version: 6.0.4.0 (Xamarin Enterprise)
Android SDK: /Users/johnmiller/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 25.1.1
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.3 (10183.3)
Build 7D175

=== Xamarin.iOS ===

Version: 9.6.2.4 (Xamarin Enterprise)
Hash: d8bedd0
Branch: master
Build date: 2016-05-05 17:43:01-0400

=== Xamarin.Mac ===

Version: 2.4.2.3 (Xamarin Enterprise)

=== Xamarin Inspector ===

Version: 0.3.2.3
Hash: 1b526e6
Branch: master
Build date: Tue Nov 17 20:54:30 UTC 2015

=== Build Information ===

Release ID: 510030051
Git revision: f3c0d982165f785772d125f02668370d929014fb
Build date: 2016-03-24 18:51:31-04
Xamarin addins: ee5cfd3ecb6b20de47c1d25efb9a9abc101e8ce7
Build lane: monodevelop-lion-cycle6-c6sr3

=== Operating System ===

Mac OS X 10.11.2
Comment 1 Dhillu 2016-06-17 04:38:21 UTC
Same here...

My last tab page control's IntPtr value is changing to Zero.
Then getting 
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] System.ArgumentException: 'jobject' must not be IntPtr.Zero.
[MonoDroid] Parameter name: jobject
Comment 2 Kireet 2016-06-17 05:58:23 UTC
Same here.

In tabbed page, when i tapped all the taps regularly, in my last tab , control's IntPtr value is changing to zero.


Then getting 
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] System.ArgumentException: 'jobject' must not be IntPtr.Zero.
[MonoDroid] Parameter name: jobject
Comment 3 Rui Marinho 2016-08-04 15:39:25 UTC
Still a issue in 2.3.2-pre1
Comment 4 Samantha Houts [MSFT] 2016-10-07 00:02:00 UTC
Should be fixed in 2.3.3-pre2. Thank you!
Comment 5 Parmendra Kumar 2016-10-07 13:05:34 UTC
I have checked this issue with Xamarin.Forms 2.3.3-pre2 and this issue has been fixed.

Hence marked this issue as Verified.