Bug 39379 - [Android AppCompat] TabbedPage crash when switching tabs with more than two navigation pages
Summary: [Android AppCompat] TabbedPage crash when switching tabs with more than two n...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.0.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-03-04 21:39 UTC by Chris Addington
Modified: 2016-03-09 22:04 UTC (History)
3 users (show)

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


Attachments
repro project (58.36 KB, application/zip)
2016-03-07 21:34 UTC, Jimmy [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 Chris Addington 2016-03-04 21:39:20 UTC
I have a TabbedPage with three NavigationPages with an empty ContentPage in each NavigationPage.  Starting with Xamarin.Forms 2.1.0.6513-pre4, the app crashes when switching tabs on Android.  It works on iOS.

The following released versions of Xamarin.Forms all crash with the included project.

2.1.0.6524
2.1.0.6521
2.1.0.6517-pre5
2.1.0.6513-pre4

The following versions were the last pre-release and last stable release that were working.  This has also worked with all previous versions, as far as I could tell.

2.1.0.6508-pre3
2.0.1.6505 is working

Basic sample code to reproduce the problem (Full project included).  Simple click on Page 3 on the Android Lollipop emulator and the app will crash.

public App ()
{
   this.MainPage = new TabbedPage () {
      Children = {
         new NavigationPage (new ContentPage ()) {
            Title = "Page 1"
         }
         , new NavigationPage (new ContentPage ()) {
            Title = "Page 2"
         }
         , new NavigationPage (new ContentPage ()) {
            Title = "Page 3"
         }
      }
   };
}

The following exception is raised:

Java.Lang.IllegalStateException: Recursive entry to executePendingTransactions
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2692/e98e9627/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
  at Android.Runtime.JNIEnv.CallBooleanMethod (IntPtr jobject, IntPtr jmethod) [0x00063] in /Users/builder/data/lanes/2692/e98e9627/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:218
  at Android.Support.V4.App.FragmentManagerInvoker.ExecutePendingTransactions () [0x00033] in <filename unknown>:0
  at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.Dispose (Boolean disposing) [0x0007a] in <filename unknown>:0
  at Java.Lang.Object.Dispose () [0x00000] in /Users/builder/data/lanes/2692/e98e9627/source/monodroid/src/Mono.Android/src/Java.Lang/Object.cs:115
  at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnDestroyView () [0x00066] in <filename unknown>:0
  at Android.Support.V4.App.Fragment.n_OnDestroyView (IntPtr jnienv, IntPtr native__this) [0x00009] in <filename unknown>:0
  at at (wrapper dynamic-method) System.Object:9546abc6-f335-4f33-8caf-d14077db3b85 (intptr,intptr)
  at --- End of managed exception stack trace ---
  at java.lang.IllegalStateException: Recursive entry to executePendingTransactions
  at at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1544)
  at at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:545)
  at at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.n_onDestroyView(Native Method)
  at at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.onDestroyView(FragmentContainer.java:57)
  at at android.support.v4.app.Fragment.performDestroyView(Fragment.java:2167)
  at at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1100)
  at at android.support.v4.app.FragmentManagerImpl.detachFragment(FragmentManager.java:1363)
  at at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:723)
  at at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1572)
  at at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:545)
  at at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
  at at android.support.v4.view.ViewPager.populate(ViewPager.java:1106)
  at at android.support.v4.view.ViewPager.populate(ViewPager.java:952)
  at at android.support.v4.view.ViewPager$3.run(ViewPager.java:251)
  at at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
  at at android.view.Choreographer.doCallbacks(Choreographer.java:580)
  at at android.view.Choreographer.doFrame(Choreographer.java:549)
  at at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
  at at android.os.Handler.handleCallback(Handler.java:739)
  at at android.os.Handler.dispatchMessage(Handler.java:95)
  at at android.os.Looper.loop(Looper.java:135)
  at at android.app.ActivityThread.main(ActivityThread.java:5254)
  at at java.lang.reflect.Method.invoke(Native Method)
  at at java.lang.reflect.Method.invoke(Method.java:372)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Comment 1 Jimmy [MSFT] 2016-03-07 21:34:40 UTC
Created attachment 15295 [details]
repro project

I am adding a sample project that reproduces the crash.

### Steps to Reproduce
1. Run the attached Android project
2. Swipe over to or select “Page 2”
3. Swipe to or select “Page 3”


### Actual Results
The app will crash with the exception in the description. The crash seems happens on every second instance that the current page is changed. So swiping to “Page 2” and then back to “Page 1” will also crash.


### Version Info
Crash occurs on latest, stable version 2.1.0.6524


### Regression Status
I can confirm that the crash does _not_ occur on Forms 2.0.1.6505
Comment 2 Corneliu Serediuc 2016-03-09 12:57:10 UTC
This bug has not been fixed, nor resolved.

I have updated today to Xamarin.Forms latest stable version 2.1.0.6526 and the error still occurs.
Comment 3 E.Z. Hart [MSFT] 2016-03-09 22:04:01 UTC
(In reply to Corneliu Serediuc from comment #2)
> This bug has not been fixed, nor resolved.
> 
> I have updated today to Xamarin.Forms latest stable version 2.1.0.6526 and
> the error still occurs.

The fix is in the master branch and will be available in the next stable release.