Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
I have a Xamarin Forms app that works fine on iOS and throws a NRE when I click on a button that changes pages in Android.
System.NullReferenceException: Object reference not set to an instance of an object.
at Xamarin.Forms.Platform.Android.AppCompat.Platform.Xamarin.Forms.Platform.Android.IPlatformLayout.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00017] in C:\BuildAgent\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\AppCompat\Platform.cs:198
at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x0000e] in C:\BuildAgent\work\aad494dc9bc9783\Xamarin.Forms.Platform.Android\PlatformRenderer.cs:73
at Android.Views.ViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00009] in /Users/builder/data/lanes/3511/0e59c362/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.ViewGroup.cs:3427
at at (wrapper dynamic-method) System.Object:f5b58111-070b-4cca-97f5-1cced5aed1b0 (intptr,intptr,bool,int,int,int,int)
Xamarin Studio Environment Details:
Xamarin Studio Community
Version 6.1 (build 5441)
Installation UUID: 2bc5a42e-416b-4731-9d4a-3c9a524c4250
Mono 4.6.0 (mono-4.6.0-branch/746756c) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 406000245
Apple Developer Tools
Xcode 8.0 (11246)
Version: 10.0.0.6 (Xamarin Studio Community)
Build date: 2016-09-09 13:01:32-0400
Version: 184.108.40.206 (Xamarin Studio Community)
Android SDK: /Users/toadzky/Library/Android/sdk
Supported Android versions:
6.0 (API level 23)
SDK Tools Version: 25.1.7
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 24.0.0 rc4
Java SDK: /usr
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
Android Designer EPL code available here:
Xamarin Android Player
Release ID: 601005441
Git revision: 68292d1ab289911c815ddc715dd7cc29a9752f9f
Build date: 2016-09-09 04:43:23-04
Xamarin addins: ed25d008672663eeb9db55f1ccecb3c24d2fd3b2
Build lane: monodevelop-lion-cycle8
Mac OS X 10.11.6
Darwin skytag.local 15.6.0 Darwin Kernel Version 15.6.0
Thu Jun 23 18:25:34 PDT 2016
Enabled user installed addins
Addin Maker 1.3.2
Prism Template Pack 1.3
Redth's Addins 1.0.2
JSON Copy 1.1
If it helps, this is happening when I'm transitioning to a page with a customized MapView, and the page is created just fine. The app/MVVM framework doesn't make it to creating my view model after the page has been created though.
Correction, my view model is created as part of the `InitializeComponent` call in the page constructor.
A reproduction would be very helpful here if you can provide one.
I'll do my best to get you one when I have a chance.
It's definitely related to some kind of location permissions issue and the map view. It never asked me for permissions and I thought it already had permissions, but once I manually (via app settings) gave the app permissions for location updates, it stopped crashing.
I managed to get an error related to location permissions once I commented out my map view from the xaml. Then, after granting permissions and making sure it would load the page, I un-commented the map view and it still works. Confirmed on both physical device and emulator.
I was using James M.'s Permissions plugin, and I made a mistake when checking permissions to see if they were allowed/denied. The documentation for his "PermissionStatus" enum led me to believe that "Denied" would be the state for only if the user had explicitly denied the permission. It turns out that it's also the default state of a permission that has never been requested. So I wasn't ever asking for permission.
This issue will be closed due to a lack of updates or provided reproductions, so we can reasonably assume it is no longer an issue. Please reopen this and attach a minimized reproduction project if the issue still exists as of the latest prerelease or nightly build.