1
votes

Someone knows after updating my Xamarin Forms from 1.4 to 1.5 i am getting this error:

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

full stack error:

10-19 06:47:47.893 D/Mono    ( 3675): Searching for '__android_log_print'.
10-19 06:47:47.896 I/MonoDroid( 3675): at Android.Views.ActionMode/ICallbackInvoker.n_OnActionItemClicked_Landroid_view_ActionMode_Landroid_view_MenuItem_ (intptr,intpt10-19 06:47:47.893 D/Mono    ( 3675): Probing '__android_log_print'.
10-19 06:47:47.893 D/Mono    ( 3675): Found as '__android_log_print'.
10-19 06:47:47.894 I/MonoDroid( 3675): UNHANDLED EXCEPTION:
10-19 06:47:47.896 I/MonoDroid( 3675): System.ArgumentException: 'jobject' must not be IntPtr.Zero.
10-19 06:47:47.896 I/MonoDroid( 3675): Parameter name: jobject
10-19 06:47:47.896 I/MonoDroid( 3675): at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr) [0x00010] in /Users/builder/data/lanes/2058/58099c53/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:546
10-19 06:47:47.896 I/MonoDroid( 3675): at Android.Views.ActionModeInvoker.Finish () [0x0002d] in /Users/builder/data/lanes/2058/58099c53/source/monodroid/src/Mono.Android/platforms/android-22/src/generated/Android.Views.ActionMode.cs:804
10-19 06:47:47.896 I/MonoDroid( 3675): at Xamarin.Forms.Platform.Android.CellAdapter.OnActionItemClicked (Android.Views.ActionMode,Android.Views.IMenuItem) <IL 0x00008, 0x00044>
10-19 06:47:47.896 I/MonoDroid( 3675): at Android.Views.ActionMode/ICallbackInvoker.n_OnActionItemClicked_Landroid_view_ActionMode_Landroid_view_MenuItem_ (intptr,intptr,intptr,intptr) [0x00019] in /Users/builder/data/lanes/2058/58099c53/source/monodroid/src/Mono.Android/platforms/android-22/src/generated/Android.Views.ActionMode.cs:89
10-19 06:47:47.896 I/MonoDroid( 3675): at (wrapper dynamic-method) object.ecb01028-fd89-41d7-b184-af818f2dde3e (intptr,intptr,intptr,intptr) <IL 0x0001d, 0x00037>
10-19 06:47:47.899 W/art     ( 3675): JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
10-19 06:47:47.900 D/AndroidRuntime( 3675): Shutting down VM

This appears when i am trying to do this:

await App.MyTabbedPageMenu.orderNavigationPage.PushAsync(new DetalhesPedidoView(webPedidoModel));

only on Android this appears on IOS everything works fine.

thanks

2
can you please explain your setup a little more. How are you going from an TabbedPageMenu to a NavigationPage. - Adam
Hi @Adam i have a TabbebPage right? i have the variable in my App.cs because i need change inside my tabs. each tab have an NavigationPage and inside ContentPage or CarouselPages. In this case i have instance of my navigation and my tabbedpage, so i need only to do is pushAsync my new Page to show, but i dont know why this error appears only on Android - Guilherme Waltricke

2 Answers

2
votes

Thanks to Torben Kruse from Xamarin Forum that answer the question and solved the problem

await Task.Yield()

before pushing the Page.

More infos: https://forums.xamarin.com/discussion/54112/jobject-must-not-be-intptr-zero-on-pushasync

0
votes

await Task.Yield() is an option some time it don't working, in my case it resolve after collect the garbage

GC.collect();