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.
If you create an Android Activity and add a Theme, it will cause a NRE to be thrown. This theme doesn't have to do anything at all, a blank Theme style will cause this error to happen.
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.Android.Platform.UpdateActionBar () [0x00000] in <filename unknown>:0
at Xamarin.Forms.Platform.Android.Platform.SetPage (Xamarin.Forms.Page newRoot) [0x00000] in <filename unknown>:0
at Xamarin.Forms.Platform.Android.AndroidActivity.SetPage (Xamarin.Forms.Page page) [0x00000] in <filename unknown>:0
at [Activity].OnCreate (Android.OS.Bundle bundle) [0x0001f] in [Activity File]:[Line Number]
To anyone else encoutering this problem, my workaround was to create a non-AndroidActivity Activity that uses the Theme and then loads the first AndroidActivity Activity with "StartActivity" in the OnCreate handler. This gets around the bug.
I've attached a sample reproduction of this bug. Launch the app as is and it will show an error message for the NRE. Comment out "Theme = "@style/Theme.Splash"," in the Activity header and the error will go away. Theme.Splash is an empty theme, it does nothing. This happens regardless of what the Theme does.
Currently we only support themes that contain action bars. We're working on addressing this, but in the mean time you will have to limit which theme you select.
*** This bug has been marked as a duplicate of bug 20459 ***