Bug 35034 - A NullReferenceException is thrown when calling Navigation.PushModelAsync and Google Play Services aren't installed
Summary: A NullReferenceException is thrown when calling Navigation.PushModelAsync and...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 1.5.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-10-19 08:18 UTC by Sebastian Brandes
Modified: 2016-06-28 15:09 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 Sebastian Brandes 2015-10-19 08:18:45 UTC
I had made a page that used the Xamarin.Forms Map Control. Google Play Services were not installed on my emulator (the VS 2015 emulator for Android 4.4) so naturally the map control was not shown.

Whenever I would call Navigation.PushModalAsync a NullReferenceException would be thrown in the method  CallNonvirtualVoidMethod (supposedly in the Android library). After installing Google Play Services this exception was no longer thrown.
Comment 1 Paul Johnson 2015-12-07 12:40:20 UTC
I'm also seeing this on a real device (samsung s3 and s4 mini). In my case, I have a custom map (need to use a custom icon for the pin). When I run the code, I'm getting the NullPointerException generated with the following throwback

[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Java.Lang.NullPointerException: Exception of type 'Java.Lang.NullPointerException' was thrown.
[MonoDroid]   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2098/3efa14c4/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
[MonoDroid]   at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue* parms) [0x00064] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:195 
[MonoDroid]   at Android.Gms.Maps.GoogleMap.AddMarker (Android.Gms.Maps.Model.MarkerOptions options) [0x0004a] in <filename unknown>:0 
[MonoDroid]   at airportapp.Droid.CustomMapRenderer.CreateMarker () [0x00083] in /Users/PFJ/Developer/MAG/mobileapp/Common.Droid/CustomRenderers/CustomMapRenderer.cs:50 
[MonoDroid]   at airportapp.Droid.CustomMapRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00054] in /Users/PFJ/Developer/MAG/mobileapp/Common.Droid/CustomRenderers/CustomMapRenderer.cs:32 
[MonoDroid]   at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
[MonoDroid]   at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00012] in <filename unknown>:0 
[MonoDroid]   at Xamarin.Forms.Maps.Map.set_VisibleRegion (Xamarin.Forms.Maps.MapSpan value) [0x00035] in <filename unknown>:0 
[MonoDroid]   at Xamarin.Forms.Maps.Android.MapRenderer.UpdateVisibleRegion (Android.Gms.Maps.Model.LatLng pos) [0x000e4] in <filename unknown>:0 
[MonoDroid]   at Xamarin.Forms.Maps.Android.MapRenderer.OnCameraChange (Android.Gms.Maps.Model.CameraPosition pos) [0x00007] in <filename unknown>:0 
[MonoDroid]   at Android.Gms.Maps.GoogleMap+IOnCameraChangeListenerInvoker.n_OnCameraChange_Lcom_google_android_gms_maps_model_CameraPosition_ (IntPtr jnienv, IntPtr native__this, IntPtr native_position) [0x00011] in <filename unknown>:0 
[MonoDroid]   at (wrapper dynamic-method) System.Object:7d3425fc-1cd9-4c87-9cf9-7b8dd4fb5663 (intptr,intptr,intptr)
[MonoDroid]   --- End of managed exception stack trace ---
[MonoDroid] java.lang.NullPointerException
[MonoDroid] 	at com.google.a.a.ae.a(Unknown Source)
[MonoDroid] 	at com.google.maps.api.android.lib6.d.dn.<init>(Unknown Source)
[MonoDroid] 	at com.google.maps.api.android.lib6.d.dm.a(Unknown Source)
[MonoDroid] 	at com.google.maps.api.android.lib6.d.ag.<init>(Unknown Source)
[MonoDroid] 	at com.google.maps.api.android.lib6.d.eu.a(Unknown Source)
[MonoDroid] 	at com.google.android.gms.maps.internal.j.onTransact(SourceFile:167)
[MonoDroid] 	at android.os.Binder.transact(Binder.java:347)
[MonoDroid] 	at com.google.android.gms.maps.internal.IGoogleMapDelegate$zza$zza.addMarker(Unknown Source)
[MonoDroid] 	at com.google.android.gms.maps.GoogleMap.addMarker(Unknown Source)
[MonoDroid] 	at md5d956392b2b421ac2c9ccfc063253dcd9.MapRenderer.n_onCameraChange(Native Method)
[MonoDroid] 	at md5d956392b2b421ac2c9ccfc063253dcd9.MapRenderer.onCameraChange(MapRenderer.java:54)
[MonoDroid] 	at com.google.android.gms.maps.GoogleMap$7.onCameraChange(Unknown Source)
[MonoDroid] 	at com.google.android.gms.maps.internal.zze$zza.onTransact(Unknown Source)
[MonoDroid] 	at android.os.Binder.transact(Binder.java:347)
[MonoDroid] 	at com.google.android.gms.maps.internal.aa.a(SourceFile:93)
[MonoDroid] 	at com.google.maps.api.android.lib6.gmm6.c.a.a(Unknown Source)
[MonoDroid] 	at com.google.maps.api.android.lib6.gmm6.c.b.run(Unknown Source)
[MonoDroid] 	at android.os.Handler.handleCallback(Handler.java:730)
[MonoDroid] 	at android.os.Handler.dispatchMessage(Handler.java:92)
[MonoDroid] 	at android.os.Looper.loop(Looper.java:176)
[MonoDroid] 	at android.app.ActivityThread.main(ActivityThread.java:5419)
[MonoDroid] 	at java.lang.reflect.Method.invokeNative(Native Method)
[MonoDroid] 	at java.lang.reflect.Method.invoke(Method.java:525)
[MonoDroid] 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
[MonoDroid] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
[MonoDroid] 	at dalvik.system.NativeStart.main(Native Method)
[mono-rt] Stacktrace:
[mono-rt] 
[mono-rt]   at <unknown> <0xffffffff>
[mono-rt]   at (wrapper managed-to-native) object.wrapper_native_0x40b58211 (intptr,intptr,intptr) <IL 0x0002b, 0xffffffff>
[mono-rt]   at Android.Runtime.JNIEnv.CallObjectMethod (intptr,intptr) [0x00040] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:174
[mono-rt]   at Java.Lang.Throwable.get_Message () [0x00043] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Java.Lang.Throwable.cs:270
[mono-rt]   at (wrapper runtime-invoke) <Module>.runtime_invoke_object__this__ (object,intptr,intptr,intptr) <IL 0x00058, 0xffffffff>
[mono-rt]   at <unknown> <0xffffffff>
[mono-rt]   at (wrapper dynamic-method) object.7d3425fc-1cd9-4c87-9cf9-7b8dd4fb5663 (intptr,intptr,intptr) <IL 0x00034, 0x000a4>
[mono-rt]   at (wrapper native-to-managed) object.7d3425fc-1cd9-4c87-9cf9-7b8dd4fb5663 (intptr,intptr,intptr) <IL 0x00027, 0xffffffff>
[mono-rt] 
[mono-rt] Attempting native Android stacktrace:
[mono-rt] 
[mono-rt]   at dvmAbort+67 [0x40b5d2fc]
[mono-rt]   at ???+266813 [0x40b5823d]
[mono-rt]   at ???+45248 [0x67ce80c0]
[mono-rt] 
[mono-rt] =================================================================
[mono-rt] Got a SIGSEGV while executing native code. This usually indicates
[mono-rt] a fatal error in the mono runtime or one of the native libraries 
[mono-rt] used by your application.
[mono-rt] =================================================================
[mono-rt] 
[libc] Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 25327 (airport.android)
Comment 2 Paul Johnson 2015-12-07 12:41:08 UTC
Ignore my report - wrong bug - sorry
Comment 3 Rui Marinho 2016-06-28 15:09:15 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