Bug 31267 - System.ArgumentException: 'jobject' must not be IntPtr.Zero when setting Label.Text
Summary: System.ArgumentException: 'jobject' must not be IntPtr.Zero when setting Labe...
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 1.4.3
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-06-20 14:13 UTC by philip
Modified: 2016-04-10 02:05 UTC (History)
2 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 philip 2015-06-20 14:13:32 UTC
Occasionally when changing Label text (label.Text = value) I get the following exception and stack:

System.ArgumentException: 'jobject' must not be IntPtr.Zero.
Parameter name: jobject

 	0x57 in Android.Widget.TextView.set_TextFormatted at /Users/builder/data/lanes/1502/4e3eea68/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Widget.TextView.cs:2897,6	C#
 	0x15 in Android.Widget.TextView.set_Text at /Users/builder/data/lanes/1502/4e3eea68/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Widget.TextView.cs:2908,5	C#
 	0x98 in Xamarin.Forms.Platform.Android.LabelRenderer.UpdateText	C#
 	0xC6 in Xamarin.Forms.Platform.Android.LabelRenderer.OnElementPropertyChanged	C#
 	0x12 in Xamarin.Forms.BindableObject.OnPropertyChanged	C#
 	0xFF in Xamarin.Forms.BindableObject.SetValueActual	C#
 	0x23E in Xamarin.Forms.BindableObject.SetValueCore	C#
 	0x75 in Xamarin.Forms.BindableObject.SetValue	C#
 	0x5 in Xamarin.Forms.BindableObject.SetValue	C#
 	0x7 in Xamarin.Forms.Label.set_Text	C#

Hopefully the stack trace is enough to find this bug.

Comment 1 philip 2015-06-20 16:03:37 UTC
This seems to be a new problem with because I did not see these exception before and my app did not change.
Comment 2 Stephane Delcroix 2015-06-22 03:38:25 UTC
Hi Philip,

Could you please attach a small reproduction triggering this issue so we can investigate further, and fix it for 1.4.3 if its' a regression ?

Warm regards,

The Xamarin.Forms team
Comment 3 philip 2015-06-22 17:41:14 UTC
Hi Stephane.

I don't think I can generate a sample project because this seems to be some corner case which only happens under some conditions in my app and I can't send you my app.

I double checked obvious things like BindingContext and Parent are already set for this label when setting Text.  Also everything is being done from the dispatcher thread. So I don't THINK the problem is with my code especially since this seems to be a new issue.

I was hoping that looking at the stack trace tells you what is going wrong...

Comment 4 Jason Smith [MSFT] 2016-04-10 02:05:16 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team