Bug 42810 - App crashes on kill/start, when combining FormsAppCompatActivity / MasterDetailPage / NavigationPage / TabbedPage
Summary: App crashes on kill/start, when combining FormsAppCompatActivity / MasterDeta...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-07-26 18:07 UTC by tranb3r
Modified: 2016-12-11 09:08 UTC (History)
4 users (show)

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


Attachments
Sample app code, crashes on kill/start (991.60 KB, application/x-zip-compressed)
2016-07-26 18:07 UTC, tranb3r
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 tranb3r 2016-07-26 18:07:58 UTC
Created attachment 16787 [details]
Sample app code, crashes on kill/start

### Description

The following sample app is crashing when being restarted AFTER having been killed.
The crash is occuring only when using FormsAppCompatActivity, and seems to be caused by the NavigationPage inside the MasterDetailPage and pointing to a TabbedPage.

### Sample

Attached

### Steps to Reproduce

1. Download sample code
2. Build and deploy app
3. Launch app on device
4. Press home button (app goes to background)
5. Kill app remotely (using Android Device Monitor, select TestCrash2.Droid app and click on "stop process")
6. Press task switcher button on device and select the app screenshot to restart it
7. App is launched but crashes and popup appears "Unfortunately, TestCrash2 has stopped".

### Versions

Xamarin   4.1.2.7 (af04e96)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   6.1.2.12 (e9815e9)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin Forms 2.3.0.107

### Exception log

07-26 19:34:05.147	30313	30313	E	AndroidRuntime	FATAL EXCEPTION: main
07-26 19:34:05.147	30313	30313	E	AndroidRuntime	java.lang.RuntimeException: Unable to start activity ComponentInfo{TestCrash2.Droid/md5171fa842c235c01f571c9abc53a9d93b.MainActivity}: java.lang.IllegalStateException: Fragment does not have a view
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2358)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2420)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.app.ActivityThread.access$900(ActivityThread.java:154)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.os.Handler.dispatchMessage(Handler.java:102)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.os.Looper.loop(Looper.java:135)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.app.ActivityThread.main(ActivityThread.java:5294)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at java.lang.reflect.Method.invoke(Native Method)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at java.lang.reflect.Method.invoke(Method.java:372)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime	Caused by: java.lang.IllegalStateException: Fragment does not have a view
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.support.v4.app.Fragment$1.onFindViewById(Fragment.java:1933)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1057)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1234)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2046)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1989)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1092)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1234)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2046)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:174)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:598)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at md5b60ffeb829f638581ab2bb9b1a7f4f3f.FormsAppCompatActivity.n_onStart(Native Method)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at md5b60ffeb829f638581ab2bb9b1a7f4f3f.FormsAppCompatActivity.onStart(FormsAppCompatActivity.java:120)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1236)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.app.Activity.performStart(Activity.java:6006)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2321)
07-26 19:34:05.147	30313	30313	E	AndroidRuntime		... 10 more
Comment 1 tranb3r 2016-07-28 08:06:41 UTC
Same crash with Xamarin.Forms 2.3.1-pre3
Comment 2 tranb3r 2016-08-05 21:29:49 UTC
Does not crash anymore with Xamarin.Forms 2.3.2.118-pre1