This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 57108 - 2.3.5.239-pre3 NullReferenceException at Xamarin.Forms.Platform.Android.Platform.SetActionBarTextColor
Summary: 2.3.5.239-pre3 NullReferenceException at Xamarin.Forms.Platform.Android.Platf...
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android (show other bugs)
Version: 2.3.5
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
URL:
: 56412 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-06-02 14:38 UTC by philip
Modified: 2017-06-29 09:49 UTC (History)
10 users (show)

See Also:
Tags: ac android formsapplicationactivity nre crash
Is this bug a regression?: Yes
Last known good build: 2.3.4.247


Attachments
android app with null exception at SetActionBarTextColor (43.01 KB, application/x-zip-compressed)
2017-06-02 14:38 UTC, philip
Details
Attached are the logs generated during defect verification (1.85 KB, application/x-zip-compressed)
2017-06-29 09:47 UTC, Saurabh Paunikar
Details

Description philip 2017-06-02 14:38:54 UTC
Created attachment 22655 [details]
android app with null exception at SetActionBarTextColor

Upgrading from 2.3.4.246 to 2.3.5.239-pre3 causes the following exception at application load.  This is with Android 6.

I am attaching a sample project that shows this.

06-02 14:30:53.590 I/MonoDroid( 5052): UNHANDLED EXCEPTION:
06-02 14:30:53.642 I/MonoDroid( 5052): System.NullReferenceException: Object reference not set to an instance of an object.
06-02 14:30:53.642 I/MonoDroid( 5052):   at Xamarin.Forms.Platform.Android.Platform.SetActionBarTextColor () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Renderers\LabelRenderer.cs:74 
06-02 14:30:53.642 I/MonoDroid( 5052):   at Xamarin.Forms.Platform.Android.Platform.UpdateActionBarTextColor () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Renderers\EntryRenderer.cs:86 
06-02 14:30:53.642 I/MonoDroid( 5052):   at Xamarin.Forms.Platform.Android.Platform.Xamarin.Forms.Platform.Android.IPlatformLayout.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Renderers\ListViewAdapter.cs:27 
06-02 14:30:53.642 I/MonoDroid( 5052):   at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Renderers\ListViewAdapter.cs:577 
06-02 14:30:53.642 I/MonoDroid( 5052):   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) [0x00008] in <d855bac285f44dda8a0d8510b679b1e2>:0 
06-02 14:30:53.642 I/MonoDroid( 5052):   at (wrapper dynamic-method) System.Object:9ef35940-7c5a-48dd-9bae-7d8403c32ad4 (intptr,intptr,bool,int,int,int,int)
Comment 1 Jimmy [MSFT] 2017-06-02 18:39:16 UTC
I can confirm this crash with the 2.3.5 builds. 

This is a result of using the Holo theme on Lollipop and higher. There are actually two different issues that can occur:

1. If using a theme without an ActionBar, then you will get an NRE.
2. If the theme has an ActionBar, then an InvalidCastException is thrown because the theme does not have a Toolbar

The changes that are causing this were introduced in 2.3.5 so this is a regression from 2.3.4.
Comment 2 Jimmy [MSFT] 2017-06-02 18:43:31 UTC
See PR: https://github.com/xamarin/Xamarin.Forms/pull/961
Comment 3 Jimmy [MSFT] 2017-06-21 17:47:21 UTC
*** Bug 56412 has been marked as a duplicate of this bug. ***
Comment 4 Rui Marinho 2017-06-22 18:52:50 UTC
Should be fixed on 2.3.5 stable
Comment 5 Saurabh Paunikar 2017-06-29 09:47:49 UTC
Created attachment 23202 [details]
Attached are the logs generated during defect verification

Note You need to log in before you can comment on or make changes to this bug.