Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NullReferenceException on Xamarin Droid App startup

I am facing a NullReferenceException when starting an Xamarin Android App via Visual Studio 2015.

It is thrown after leaving the OnCreate() in my main activity, but I do not know where and why. How can find more information about this error?

The Debug output is like this:

05-21 20:18:51.643 D/OpenGLRenderer(25574): Use EGL_SWAP_BEHAVIOR_PRESERVED: true
05-21 20:18:51.651 D/Atlas   (25574): Validating map...
Unhandled Exception:

System.NullReferenceException: Object reference not set to an instance of an object

Exception:

System.NullReferenceException: Object reference not set to an instance of an object

05-21 20:19:37.436 D/Mono    (25574): DllImport attempting to load: '/system/lib/liblog.so'.
05-21 20:19:37.436 D/Mono    (25574): DllImport loaded library '/system/lib/liblog.so'.
05-21 20:19:37.436 D/Mono    (25574): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
05-21 20:19:37.436 D/Mono    (25574): Searching for '__android_log_print'.
05-21 20:19:37.436 D/Mono    (25574): Probing '__android_log_print'.
05-21 20:19:37.437 D/Mono    (25574): Found as '__android_log_print'.
05-21 20:19:37.450 I/MonoDroid(25574): UNHANDLED EXCEPTION:
05-21 20:19:37.454 I/MonoDroid(25574): System.NullReferenceException: Object reference not set to an instance of an object
05-21 20:19:37.454 I/MonoDroid(25574):   at Xamarin.Forms.Platform.Android.KeyboardManager.HideKeyboard (Android.Views.View inputView, Boolean overrideValidation) [0x00000] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\KeyboardManager.cs:14 
05-21 20:19:37.454 I/MonoDroid(25574):   at Xamarin.Forms.Platform.Android.FormsApplicationActivity.OnPause () [0x00000] in C:\BuildAgent3\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\FormsApplicationActivity.cs:153 
05-21 20:19:37.455 I/MonoDroid(25574):   at Android.App.Activity.n_OnPause (IntPtr jnienv, IntPtr native__this) [0x00009] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Activity.cs:4046 
05-21 20:19:37.455 I/MonoDroid(25574):   at (wrapper dynamic-method) System.Object:5c198319-5b9a-4152-9518-5aa3ce7cab6e (intptr,intptr)
05-21 20:19:37.476 W/art     (25574): JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
An unhandled exception occured.

05-21 20:19:38.791 E/mono    (25574): 
05-21 20:19:38.791 E/mono    (25574): Unhandled Exception:
05-21 20:19:38.791 E/mono    (25574): System.NullReferenceException: Object reference not set to an instance of an object
05-21 20:19:38.791 E/mono    (25574):   at (wrapper dynamic-method) System.Object:5c198319-5b9a-4152-9518-5aa3ce7cab6e (intptr,intptr)
05-21 20:19:38.791 E/mono    (25574):   at (wrapper native-to-managed) System.Object:5c198319-5b9a-4152-9518-5aa3ce7cab6e (intptr,intptr)
05-21 20:19:38.792 E/mono-rt (25574): [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
05-21 20:19:38.792 E/mono-rt (25574):   at (wrapper dynamic-method) System.Object:5c198319-5b9a-4152-9518-5aa3ce7cab6e (intptr,intptr)
05-21 20:19:38.792 E/mono-rt (25574):   at (wrapper native-to-managed) System.Object:5c198319-5b9a-4152-9518-5aa3ce7cab6e (intptr,intptr)
referenceTable GDEF length=670 1
referenceTable GSUB length=7202 1
referenceTable GPOS length=24560 1
like image 958
Chris Avatar asked May 21 '16 18:05

Chris


1 Answers

I know it's been a while but perhaps I can help someone in the future. Something similar happened to me when I accidentally removed the initiation of my App.Current.Mainpage while the app was starting up. Silly mistake that leads to an unhelpful error message.

Got the idea on where my problem was from here: https://bugzilla.xamarin.com/show_bug.cgi?id=36287

like image 61
Will Nasby Avatar answered Oct 27 '22 00:10

Will Nasby