Bug 42918 - Unhandled exception - System.ArgumentException: 'jobject' must not be IntPtr.Zero
Summary: Unhandled exception - System.ArgumentException: 'jobject' must not be IntPtr....
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-07-29 13:39 UTC by stewart.short
Modified: 2016-08-08 17:30 UTC (History)
2 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 stewart.short 2016-07-29 13:39:57 UTC
Xamarin.Forms 1.5.0.6446

We have a large xamarin forms application and are randomly getting the exception as shown in the summary. One stack trace, see below, is very similar to that logged in 31267: however due to the size of the application and the release schedule, simply moving to the latest version of Xamarin Forms is not a viable solution. We have someone looking at this, but the initial migration resulted in a number of UI and performance issues. Therefore, is there any guidance with regard to tracking down the cause of the issue and working around it in application code?

[0001] 2016/07/26 16:47:32 MainActivity.AndroidEnvironment_UnhandledExceptionRaiser:ERROREXIT Unhandled exception - System.ArgumentException: 'jobject' must not be IntPtr.Zero.
Parameter name: jobject
at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr,Android.Runtime.JValue*) <0x0015c>
at Android.Widget.TextView.set_TextFormatted (Java.Lang.ICharSequence) <0x00183>
at Android.Widget.TextView.set_Text (string) <0x00057>
at Xamarin.Forms.Platform.Android.LabelRenderer.UpdateText () <0x001c3>
at Xamarin.Forms.Platform.Android.LabelRenderer.OnElementPropertyChanged (object,System.ComponentModel.PropertyChangedEventArgs) <0x001fb>
at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <0x000b7>
at Xamarin.Forms.BindableObject.OnPropertyChanged (string) <0x0006f>
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty,Xamarin.Forms.BindableObject/BindablePropertyContext,object,bool,Xamarin.Forms.BindableObject/SetValueFlags,bool) <0x0027b>
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty,object,Xamarin.Forms.BindableObject/SetValueFlags,Xamarin.Forms.BindableObject/SetValuePrivateFlags) <0x0031f>
at Xamarin.Forms.BindingExpression.ApplyCore (object,Xamarin.Forms.BindableObject,Xamarin.Forms.BindableProperty,bool) <0x00737>
at Xamarin.Forms.BindingExpression.Apply (bool) <0x000a7>
at Xamarin.Forms.BindingExpression/BindingExpressionPart.<PropertyChanged>b__38_0 () <0x00023>
at Java.Lang.Thread/RunnableImplementor.Run () <0x0003f>
at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <0x00043>
at (wrapper dynamic-method) object.68f806a1-3a3e-4d66-86f5-76b031c87f9d (intptr,intptr) <0x00043>

[0001] 2016/07/26 16:47:32 MainActivity.AndroidEnvironment_UnhandledExceptionRaiser:ERROREXIT Unhandled exception - System.ArgumentException: 'jobject' must not be IntPtr.Zero.
Parameter name: jobject
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028>
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (object) <0x00047>
at Android.App.SyncContext/<Post>c__AnonStorey0.<>m__0 () <0x00027>
at Java.Lang.Thread/RunnableImplementor.Run () <0x0003f>
at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <0x00043>
at (wrapper dynamic-method) object.68f806a1-3a3e-4d66-86f5-76b031c87f9d (intptr,intptr) <0x00043>

[0001] 2016/07/26 16:47:32 App.xaml.currentDomain_UnhandledException:ERROREXIT Unhandled exception - Java.Lang.RuntimeException: Exception of type 'Java.Lang.RuntimeException' was thrown.

  --- End of managed exception stack trace ---
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: java.lang.reflect.InvocationTargetException
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
	... 1 more
Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: System.ArgumentException: 'jobject' must not be IntPtr.Zero.
Parameter name: jobject
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028>
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (object) <0x00047>
at Android.App.SyncContext/<Post>c__AnonStorey0.<>m__0 () <0x00027>
at Java.Lang.Thread/RunnableImplementor.Run () <0x0003f>
at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <0x00043>
at (wrapper dynamic-method) object.68f806a1-3a3e-4d66-86f5-76b031c87f9d (intptr,intptr) <0x00043>

	at mono.java.lang.RunnableImplementor.n_run(Native Method)
	at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:145)
	at android.app.ActivityThread.main(ActivityThread.java:6873)
	... 4 more
Comment 1 Rui Marinho 2016-08-08 17:30:14 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