Bug 21480 - Android Rotation causes Object Reference Error on device with physical keyboard
Summary: Android Rotation causes Object Reference Error on device with physical keyboard
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.2
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-07-21 12:48 UTC by rwakelan
Modified: 2016-03-15 19:27 UTC (History)
5 users (show)

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

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 rwakelan 2014-07-21 12:48:58 UTC
An Activity that is hosting a NavigationPage will cause a NRE on a device with a physical keyboard when the screen rotates due to that device's keyboard sliding out.  This happens when the normal "ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize" flags are set to allow orientation changes.

For example, on my Droid 4 device, as long as I do not slide out the physical keyboard, all orientation changes work as expected.  Once I slide out the keyboard, a NRE is throw by the Android Activity.

The stack trace of this exception is:

at Xamarin.Forms.NavigationProxy.set_Inner (INavigation value) [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]:[Line Number]

If two additional ConfigChanges are includes, this error does not come up.  Adding these values fixes the problem:

"ConfigChange.Keyboard | ConfigChanges.KeyboardHidden"

I've attached a sample that shows the error.  Page 1 exists outside of the Navigation Page and does not error out.  After 10 seconds, it will transition to page 2 which is inside a NavigationPage and does cause the error.
Comment 1 Ram Chandra 2014-08-26 10:48:50 UTC
I have tried to reproduce this issue but there is no attached sample.

Could you please attached the sample application and build information? So, that we can reproduce this issue.

You can get build information from here: 

Visual Studio => Help => About Microsoft Visual Studio => Copy Info.

Environment Info:

Microsoft Visual Studio Professional 2012
Version 11.0.61030.00 Update 4
Microsoft .NET Framework
Version 4.5.50938

Installed Version: Professional
Xamarin   3.3.47.0 (0b2a123923812a88ed3091909478dbe9e0111f00)
Comment 2 Jason Smith [MSFT] 2016-03-15 19:27:53 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we no longer believe it affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
 
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team