Bug 21341 - NullReferenceException when running PCL project on Android
Summary: NullReferenceException when running PCL project on Android
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.1
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-07-15 14:06 UTC by John Miller [MSFT]
Modified: 2014-07-17 14:10 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
TestCase (2.79 MB, application/zip)
2014-07-15 14:06 UTC, John Miller [MSFT]
Details


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 John Miller [MSFT] 2014-07-15 14:06:07 UTC
Created attachment 7367 [details]
TestCase

### Overview: 

    The default PCL project template throws a NRE when running on Android. 

### Steps to Reproduce: 

    1. Install Latest Stable Channel on Mac.
    2. File -> New Solution -> Mobile Apps -> Xamarin Forms PCL Project
    3. Open each project created and Update the NuGet packages for XF to 1.2.1
    4. Build and Deploy to an Android Emulator (Tested with API 19)

Example screencast: http://screencast.com/t/JDqpVvlkIF
Attached is the project from the screencast.

### Actual Results: 

>[MonoDroid] UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
>[MonoDroid] at Xamarin.Forms.Platform.Android.Platform.SetActionBarTextColor () <IL 0x00006, 0x00065>
>[MonoDroid] at Xamarin.Forms.Platform.Android.Platform.UpdateActionBarTextColor () <IL 0x00001, 0x00027>
>[MonoDroid] at Xamarin.Forms.Platform.Android.Platform.OnLayout (bool,int,int,int,int) <IL 0x00004, 0x00053>
>[MonoDroid] at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (bool,int,int,int,int) <IL 0x0001b, 0x00083>
>[MonoDroid] at Android.Views.ViewGroup.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) [0x00009] in >/Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/163212a9/source/monodroid/src/Mono.Android/platforms/android->15/src/generated/Android.Views.ViewGroup.cs:2869
>[MonoDroid] at (wrapper dynamic-method) object.d917b782-104a-4d97-836d-89d0303e384d (intptr,intptr,bool,int,int,int,int) <IL >0x0002f, 0x0004b>
>[mono] 
>[mono] Unhandled Exception:
>[mono] System.NullReferenceException: Object reference not set to an instance of an object
>[mono]   at Xamarin.Forms.Platform.Android.Platform.SetActionBarTextColor () [0x00000] in <filename unknown>:0 
>[mono]   at Xamarin.Forms.Platform.Android.Platform.UpdateActionBarTextColor () [0x00000] in <filename unknown>:0 
>[mono]   at Xamarin.Forms.Platform.Android.Platform.OnLayout (Boolean changed, Int32 l, Int32 t, Int32 r, Int32 b) [0x00000] >in <filename unknown>:0 
>[mono]   at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (Boolean changed, Int32 l, Int32 t, Int32 r, Int32 b) >[0x00000] in <filename unknown>:0 
>[mono]   at Android.Views.ViewGroup.n_OnLayout_ZIIII (IntPtr jnienv, IntPtr native__this, Boolean changed, Int32 l, Int32 t, >Int32 r, Int32 b) [0x00009] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12->series/163212a9/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.Views.ViewGroup.cs:2869 
>[mono]   at (wrapper dynamic-method) object:d917b782-104a-4d97-836d-89d0303e384d (intptr,intp

### Expected Results: 

    No exception. App runs and Hello, Forms is displayed.

### Build Date & Platform: 

    XS 5.1.3
    XA 4.12.6
    XF 1.2.1.6229

### Additional Information: 

    Expected results on iOS.
Comment 1 Eric Maupin 2014-07-16 13:40:47 UTC
Fixed for next update.