Bug 53179 - PopAsync crashing after RemovePage when support packages are updated to 25.1.1
Summary: PopAsync crashing after RemovePage when support packages are updated to 25.1.1
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android (show other bugs)
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: 2.4.0
Assignee: Samantha Houts [MSFT]
URL:
: 54308 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-03-09 10:34 UTC by Josha Munnik
Modified: 2017-10-02 17:19 UTC (History)
47 users (show)

See Also:
Tags: crash, android, support packages, navigation, fr
Is this bug a regression?: ---
Last known good build:


Attachments
repro project (49.75 KB, application/zip)
2017-03-20 18:47 UTC, Jimmy [MSFT]
Details
OnAppearing repro attempt (295.77 KB, application/x-zip-compressed)
2017-08-08 19:41 UTC, E.Z. Hart [MSFT]
Details
multiple remove repro (52.60 KB, application/x-zip-compressed)
2017-08-17 16:39 UTC, Antonio Ibarra
Details

Description Josha Munnik 2017-03-09 10:34:59 UTC
After upgrading the various Xamarin.Android.XXXX packages from 23.3.0 to 25.1.1 with NuGet, an app will crash when using Page.Navigation.RemovePage (for example to remove the page below the top page on the stack) and then Page.Navigation.ASyncPop().
Comment 1 Jimmy [MSFT] 2017-03-09 16:10:20 UTC
Thank you for filing this report! Let me attempt to reproduce this with a sample project to confirm the issue and I will update the report accordingly.
Comment 2 Jimmy [MSFT] 2017-03-20 18:47:51 UTC
Created attachment 20471 [details]
repro project

I was able to reproduce this crash with the repro project I've attached. I am confirming this report so the team can investigate further.

I tested with Forms 2.3.3.193 and 2.3.4-pre5. The crash occurs _after_ updating the Android support packages to v25.1.1. When the support packages are at the default v23.3.0 the crash does _not_ occur.

Crash stack trace: https://gist.github.com/jimmgarrido/ce38ea7c1549e7b5f891d43352c10f84
 

### Steps to reproduce 
1. Run the attached repro project on Android
2. Press "Next Page" twice
3. Press "Remove previous page"
4. Press "Back"


### Expected Results
You will be returned to page 1


### Actual Results
The app crashes
Comment 3 Paul DiPietro [MSFT] 2017-03-31 18:46:20 UTC
*** Bug 54308 has been marked as a duplicate of this bug. ***
Comment 4 Mark Downes 2017-04-04 19:59:24 UTC
I am also experiencing this exact bug.
Comment 5 Josha Munnik 2017-04-06 12:22:51 UTC
With the new release of Xamarin I did some tests.

This bug does not happen with 24.2.1

This bug still happens with 25.1.0 & 25.1.0

Here the stack trace from the exception:

04-06 15:20:42.823 E/AndroidRuntime(21947): FATAL EXCEPTION: main
04-06 15:20:42.823 E/AndroidRuntime(21947): Process: NavStackTest.Android, PID: 21947
04-06 15:20:42.823 E/AndroidRuntime(21947): java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.unFocus(android.view.View)' on a null object reference
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4937)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at android.view.ViewGroup.removeViewAt(ViewGroup.java:4899)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1540)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:757)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2355)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2146)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2098)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2008)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at android.os.Handler.handleCallback(Handler.java:739)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at android.os.Handler.dispatchMessage(Handler.java:95)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at android.os.Looper.loop(Looper.java:158)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at android.app.ActivityThread.main(ActivityThread.java:7229)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at java.lang.reflect.Method.invoke(Native Method)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
04-06 15:20:42.823 E/AndroidRuntime(21947): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Comment 6 Josha Munnik 2017-04-06 12:24:28 UTC
Typo, versions 25.1.0 and 25.1.1
Comment 7 Joe Manke 2017-04-06 18:47:45 UTC
I experience this crash doing either a push or a pop after calling RemovePage().
Comment 8 tim.ahrentlov 2017-04-11 09:55:14 UTC
I also experience this crash doing either a push or a pop after calling RemovePage().
Comment 9 David Romero 2017-04-16 00:56:54 UTC
I experience this crash doing a pop after calling RemovePage().
Comment 10 spsteve 2017-04-18 20:48:24 UTC
I also experience this crash doing either a push or a pop after calling RemovePage().
Comment 11 batmaci 2017-05-15 21:38:37 UTC
Same problem with 25.3.1 version.
Comment 12 Leon 2017-05-16 08:53:11 UTC
Same critical issue, cant release my app because of this bug.
Comment 13 batmaci 2017-05-16 16:17:06 UTC
why is this not a priority fix? we would like to use latest support library with latest xamarin. it is 2 months and nobody is picking this up. Please give us a workaround or fix. Thank you.
Comment 14 Pavel 2017-05-25 09:14:21 UTC
Hi Xamarin guys!
How about this bug? I cannot integrate Firebase components and release my app because of this bug! Please fix it!
Comment 15 Samantha Houts [MSFT] 2017-05-25 18:08:43 UTC
https://github.com/xamarin/Xamarin.Forms/pull/933
Comment 16 Rui Marinho 2017-06-14 13:42:54 UTC
Should be fixed on 2.3.6-pre1
Comment 17 Jens-Christian 2017-06-15 07:46:25 UTC
Why 2.3.6-pre1 and not a service release for 2.3.4?
Comment 18 Leon 2017-06-15 09:40:06 UTC
Confirmed fixed in 2.3.6-pre1
Comment 19 Leon 2017-06-16 07:28:39 UTC
Unfortunately not fixed, though it was. But it still crashes, gives me another stacktrace.

Step to reproduce:

Navigation.RemovePage(Navigation.NavigationStack[Navigation.NavigationStack.Count - 2]);
await Navigation.PopAsync(true);

Java.Lang.NullPointerException: 
  at java.lang.NullPointerException
  at at android.view.ViewGroup.removeViewInternal(ViewGroup.java:3830)
  at at android.view.ViewGroup.removeViewAt(ViewGroup.java:3794)
  at at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1540)
  at at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
  at at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
  at at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363)
  at at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149)
  at at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)
  at at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013)
  at at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
  at at android.os.Handler.handleCallback(Handler.java:733)
  at at android.os.Handler.dispatchMessage(Handler.java:95)
  at at android.os.Looper.loop(Looper.java:136)
  at at android.app.ActivityThread.main(ActivityThread.java:5017)
  at at java.lang.reflect.Method.invokeNative(Native Method)
  at at java.lang.reflect.Method.invoke(Method.java:515)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  at at dalvik.system.NativeStart.main(Native Method)
Comment 20 Jared 2017-06-22 20:30:50 UTC
I'm still getting this on the nightly build.

Caused by this line in the our app: myPage.Navigation.RemovePage(myPage);

Here's the stack trace generated: 

Attempt.unFocus(View)
android.view.ViewGroup.removeViewInternal()ViewGroup.java:4943
android.view.ViewGroup.removeViewAt()ViewGroup.java:4906
android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState()FragmentManager.java:1540
android.support.v4.app.FragmentManagerImpl.moveToState()FragmentManager.java:1595
android.support.v4.app.BackStackRecord.executeOps()BackStackRecord.java:758
android.support.v4.app.FragmentManagerImpl.executeOps()FragmentManager.java:2363
android.support.v4.app.FragmentManagerImpl.executeOpsTogether()FragmentManager.java:2149
android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps()FragmentManager.java:2103
android.support.v4.app.FragmentManagerImpl.execPendingActions()FragmentManager.java:2013
android.support.v4.app.FragmentManagerImpl$1.run()FragmentManager.java:710
android.os.Handler.handleCallback()Handler.java:751
android.os.Handler.dispatchMessage()Handler.java:95
android.os.Looper.loop()Looper.java:154
android.app.ActivityThread.main()ActivityThread.java:6682
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run()ZygoteInit.java:1520
com.android.internal.os.ZygoteInit.main()ZygoteInit.java:1410
caused.unFocus(View)
--- End of managed Java.Lang.RuntimeException stack trace ---
Attempt.unFocus(View)
android.view.ViewGroup.removeViewInternal()ViewGroup.java:4943
android.view.ViewGroup.removeViewAt()ViewGroup.java:4906
android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState()FragmentManager.java:1540
android.support.v4.app.FragmentManagerImpl.moveToState()FragmentManager.java:1595
android.support.v4.app.BackStackRecord.executeOps()BackStackRecord.java:758
android.support.v4.app.FragmentManagerImpl.executeOps()FragmentManager.java:2363
android.support.v4.app.FragmentManagerImpl.executeOpsTogether()FragmentManager.java:2149
android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps()FragmentManager.java:2103
android.support.v4.app.FragmentManagerImpl.execPendingActions()FragmentManager.java:2013
android.support.v4.app.FragmentManagerImpl$1.run()FragmentManager.java:710
android.os.Handler.handleCallback()Handler.java:751
android.os.Handler.dispatchMessage()Handler.java:95
android.os.Looper.loop()Looper.java:154
android.app.ActivityThread.main()ActivityThread.java:6682
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run()ZygoteInit.java:1520
com.android.internal.os.ZygoteInit.main()ZygoteInit.java:1410
Comment 21 David Ortinau [MSFT] 2017-06-27 14:04:36 UTC
We are revisiting this issue now and will have an update shortly. Running through tests and isolating side effects of the fix.
Comment 22 HRO Jordy 2017-07-11 11:56:13 UTC
Any news when this bugfix will be released?
Comment 23 Pavel 2017-07-11 12:20:20 UTC
+1 ... any news?
Comment 24 robins 2017-07-11 13:24:07 UTC
+1
Comment 25 tim.ahrentlov 2017-07-11 13:59:58 UTC
+1
Comment 26 Leon 2017-07-11 14:00:19 UTC
+1
Comment 27 Mark Downes 2017-07-11 14:04:38 UTC
+1
Comment 28 David Ortinau [MSFT] 2017-07-12 22:27:29 UTC
PR: https://github.com/xamarin/Xamarin.Forms/pull/1053
Comment 29 Tom Gilder 2017-07-24 11:05:43 UTC
Could we have an ETA on this being on NuGet (prerelease or stable)?

An upcoming release of our app is blocked due to issue.
Comment 30 Pavel 2017-07-24 11:54:59 UTC
The same situation ...
Comment 31 HRO Jordy 2017-07-24 13:15:58 UTC
+1
Comment 32 LDJ 2017-07-26 09:34:35 UTC
Wow. Surely this is a show-stopper of a bug? If I upgrade, it literally breaks all navigation in my application. Can't believe this fix is being held back for a version with other features...
Comment 33 batmaci 2017-07-26 10:32:18 UTC
in Which version of package is included? is it pre release?
Comment 34 Jens-Christian 2017-07-31 08:06:59 UTC
When will the next service release of 2.3.4 with this fix be released?
Comment 35 Daniel Pease 2017-07-31 14:23:49 UTC
This bug should be high priority. We have a production app in multiple countries crashing due to this bug. When will it be released?
Comment 36 Maxim Alexeyev 2017-08-01 02:58:54 UTC
Because of this bug, you can't upgrade to 25.x of Android libraries, which prevents to upgrade to latest Facebook SDK (which requires 25.x), and beware that Facebook will discontinue support for older SDK. Cascading effects in place.
Comment 37 batmaci 2017-08-01 13:41:29 UTC
more than facebook. I want to upgrade to admobs sdk, userdialogs plugin and many more. basically this bug prevents us to improve quality of our apps. it is major fix should be considered
Comment 38 Pavel 2017-08-02 08:11:58 UTC
The same situation with normal Firebase integration. I cannot add PUSH support for our Android application :(.
Comment 39 David Ortinau [MSFT] 2017-08-03 17:05:00 UTC
We have created a stable Service Release (2.3.4.261) for this issue and posted to GitHub. I've confirmed the crash issue is resolved using the attached project on this ticket. 

All following here, please take a moment to confirm this addresses your issues. If we're looking good, we'll promote this to NuGet.

https://github.com/xamarin/Xamarin.Forms/releases/tag/release-2.3.4-sr4

Of course, do a full obliterate and clean, updating all your Forms NuGets in all projects to make sure you don't have version mismatches. I've been seeing an uptick of reports of build issues when people (myself included) don't take care of that.
Comment 40 Jens-Christian 2017-08-04 06:48:03 UTC
I have tested with the 2.3.4-sr4 nuget from GitHub and latest version of Xamarin.Android.* packages, our application works fine now regarding this bug.
Comment 41 RockStar 2017-08-06 15:46:09 UTC
I use XF 2.3.5.256-pre6 and have this bug. Please fix this issue.
Comment 42 Antonio Ibarra 2017-08-07 17:52:30 UTC
Hi, I upgraded my project to Xamarin.Forms 2.3.4.261 and Xamarin.Android.Support 25.3.1 and my APP now crash in the same method:

Navigation.RemovePage(view);

With the a different error: "Java.Lang.IllegalStateException: FragmentManager is already executing transactions"

The stacktrace is:

08-07 13:32:40.137 I/MonoDroid( 4593): UNHANDLED EXCEPTION:
08-07 13:32:40.142 I/MonoDroid( 4593): Java.Lang.IllegalStateException: FragmentManager is already executing transactions
08-07 13:32:40.142 I/MonoDroid( 4593):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <3fd174ff54b146228c505f23cf75ce71>:0 
08-07 13:32:40.142 I/MonoDroid( 4593):   at Java.Interop.JniEnvironment+InstanceMethods.CallBooleanMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) [0x00068] in <bd30a18775d94dc8b6263aecd1ca9077>:0 
08-07 13:32:40.142 I/MonoDroid( 4593):   at Android.Runtime.JNIEnv.CallBooleanMethod (System.IntPtr jobject, System.IntPtr jmethod) [0x0000e] in <d855bac285f44dda8a0d8510b679b1e2>:0 
08-07 13:32:40.142 I/MonoDroid( 4593):   at Android.Support.V4.App.FragmentManagerInvoker.ExecutePendingTransactions () [0x00033] in <7e083afc7c9045f59e01d9c14931060d>:0 
08-07 13:32:40.142 I/MonoDroid( 4593):   at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.RemovePage (Xamarin.Forms.Page page) [0x0002c] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\NavigationPageRenderer.cs:556 
08-07 13:32:40.142 I/MonoDroid( 4593):   at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnRemovePageRequested (System.Object sender, Xamarin.Forms.Internals.NavigationRequestedEventArgs e) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\NavigationPageRenderer.cs:478 
08-07 13:32:40.142 I/MonoDroid( 4593):   at Xamarin.Forms.NavigationPage.RemovePage (Xamarin.Forms.Page page) [0x00065] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\NavigationPage.cs:390 
08-07 13:32:40.142 I/MonoDroid( 4593):   at Xamarin.Forms.NavigationPage+NavigationImpl.OnRemovePage (Xamarin.Forms.Page page) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\NavigationPage.cs:443 
08-07 13:32:40.143 I/MonoDroid( 4593):   at Xamarin.Forms.NavigationProxy.RemovePage (Xamarin.Forms.Page page) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\NavigationProxy.cs:126 
08-07 13:32:40.143 I/MonoDroid( 4593):   at Xamarin.Forms.NavigationProxy.OnRemovePage (Xamarin.Forms.Page page) [0x0001d] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\NavigationProxy.cs:213 
08-07 13:32:40.143 I/MonoDroid( 4593):   at Xamarin.Forms.NavigationProxy.RemovePage (Xamarin.Forms.Page page) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\NavigationProxy.cs:126 
08-07 13:32:40.143 I/MonoDroid( 4593):   at Modelo.Views.Operaciones.RecuperarClave.ExitoRecuperarClaveView.OnAppearing () [0x0004f] in C:\Dev\Modelo\Modelo\Modelo\Views\Operaciones\RecuperarClave\ExitoRecuperarClaveView.xaml.cs:25 
08-07 13:32:40.143 I/MonoDroid( 4593):   at Xamarin.Forms.Page.Xamarin.Forms.IPageController.SendAppearing () [0x00024] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Page.cs:305 
08-07 13:32:40.143 I/MonoDroid( 4593):   at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnResume () [0x00041] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\FragmentContainer.cs:141 
08-07 13:32:40.143 I/MonoDroid( 4593):   at Android.Support.V4.App.Fragment.n_OnResume (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <7e083afc7c9045f59e01d9c14931060d>:0 
08-07 13:32:40.143 I/MonoDroid( 4593):   at (wrapper dynamic-method) System.Object:1afcee61-17f0-4aa2-99cf-8cee3e31889b (intptr,intptr)
08-07 13:32:40.143 I/MonoDroid( 4593):   --- End of managed Java.Lang.IllegalStateException stack trace ---
08-07 13:32:40.143 I/MonoDroid( 4593): java.lang.IllegalStateException: FragmentManager is already executing transactions
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.support.v4.app.FragmentManagerImpl.ensureExecReady(FragmentManager.java:1956)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2007)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:763)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.n_onResume(Native Method)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.onResume(FragmentContainer.java:83)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.support.v4.app.Fragment.performResume(Fragment.java:2238)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1346)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.os.Handler.handleCallback(Handler.java:751)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.os.Handler.dispatchMessage(Handler.java:95)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.os.Looper.loop(Looper.java:154)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at android.app.ActivityThread.main(ActivityThread.java:6077)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at java.lang.reflect.Method.invoke(Native Method)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
08-07 13:32:40.143 I/MonoDroid( 4593): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
08-07 13:32:40.143 I/MonoDroid( 4593): 

I am trying to delete a page inside an OnAppearing override.
Comment 43 E.Z. Hart [MSFT] 2017-08-08 19:41:11 UTC
Created attachment 24084 [details]
OnAppearing repro attempt

Antonio,

I've been trying to reproduce the problem you're describing, but so far I haven't had any luck. I've attached my repro attempt - can you take a look and tell me what I'm missing? (Or if you've got your own repro project, could you upload that?)

My project simply pushes three pages onto the stack; the third page has an OnAppearing override which removes the previous page. It runs without throwing the exception you describe.
Comment 44 Antonio Ibarra 2017-08-08 21:33:04 UTC
E.Z. Hart,

I downloaded you repro and I noticed that the version of the repro Android Support library is 23.3.0 but I run it without modification anyways and occurred another error.

I run you repro with the following Android Support Library: 23.3.0 - 25.3.1 and 25.4.0.1 (i noticed a new version) with the same Xamarin.Forms 2.3.4.261, in all three version the repro crash for me, without modify your code.

These are the following crash error, one for each (3) Android Support:

23.3.0 -> "Recursive entry to executePendingTransactions"
25.3.1 -> "FragmentManager is already executing transactions"
25.4.0.1 -> "FragmentManager is already executing transactions"

#################################################
######## CRASH With Android Support 23.3.0 ######
08-08 16:22:45.993 E/mono    ( 3558): 
08-08 16:22:45.993 E/mono    ( 3558): Unhandled Exception:
08-08 16:22:45.993 E/mono    ( 3558): Java.Lang.IllegalStateException: Recursive entry to executePendingTransactions
08-08 16:22:45.993 E/mono    ( 3558):   --- End of managed Java.Lang.IllegalStateException stack trace ---
08-08 16:22:45.993 E/mono    ( 3558): java.lang.IllegalStateException: Recursive entry to executePendingTransactions
08-08 16:22:45.993 E/mono    ( 3558): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1589)
08-08 16:22:45.993 E/mono    ( 3558): 	at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570)
08-08 16:22:45.993 E/mono    ( 3558): 	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.n_onResume(Native Method)
08-08 16:22:45.993 E/mono    ( 3558): 	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.onResume(FragmentContainer.java:83)
08-08 16:22:45.993 E/mono    ( 3558): 	at android.support.v4.app.Fragment.performResume(Fragment.java:2020)
08-08 16:22:45.993 E/mono    ( 3558): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1107)
08-08 16:22:45.993 E/mono    ( 3558): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
08-08 16:22:45.993 E/mono    ( 3558): 	at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
08-08 16:22:45.993 E/mono    ( 3558): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
08-08 16:22:45.993 E/mono    ( 3558): 	at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
08-08 16:22:45.993 E/mono    ( 3558): 	at android.os.Handler.handleCallback(Handler.java:751)
08-08 16:22:45.993 E/mono    ( 3558): 	at android.os.Handler.dispatchMessage(Handler.java:95)
08-08 16:22:45.993 E/mono    ( 3558): 	at android.os.Looper.loop(Looper.java:154)
08-08 16:22:45.993 E/mono    ( 3558): 	at android.app.ActivityThread.main(ActivityThread.java:6077)
08-08 16:22:45.993 E/mono    ( 3558): 	at java.lang.reflect.Method.invoke(Native Method)
08-08 16:22:45.993 E/mono    ( 3558): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
08-08 16:22:45.993 E/mono    ( 3558): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
08-08 16:22:45.993 E/mono    ( 3558): 
08-08 16:22:45.993 E/mono-rt ( 3558): [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.IllegalStateException: Recursive entry to executePendingTransactions
08-08 16:22:45.993 E/mono-rt ( 3558):   --- End of managed Java.Lang.IllegalStateException stack trace ---
08-08 16:22:45.993 E/mono-rt ( 3558): java.lang.IllegalStateException: Recursive entry to executePendingTransactions
08-08 16:22:45.993 E/mono-rt ( 3558): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1589)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:570)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.n_onResume(Native Method)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.onResume(FragmentContainer.java:83)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at android.support.v4.app.Fragment.performResume(Fragment.java:2020)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1107)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at android.os.Handler.handleCallback(Handler.java:751)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at android.os.Handler.dispatchMessage(Handler.java:95)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at android.os.Looper.loop(Looper.java:154)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at android.app.ActivityThread.main(ActivityThread.java:6077)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at java.lang.reflect.Method.invoke(Native Method)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
08-08 16:22:45.993 E/mono-rt ( 3558): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
08-08 16:22:45.993 E/mono-rt ( 3558): 
######## END CRASH With Android Support 23.3.0 ######
#####################################################

#################################################
######## CRASH With Android Support 25.3.1 ######
08-08 16:36:32.531 E/mono    ( 4002): 
08-08 16:36:32.531 E/mono    ( 4002): Unhandled Exception:
08-08 16:36:32.531 E/mono    ( 4002): Java.Lang.IllegalStateException: FragmentManager is already executing transactions
08-08 16:36:32.531 E/mono    ( 4002):   --- End of managed Java.Lang.IllegalStateException stack trace ---
08-08 16:36:32.531 E/mono    ( 4002): java.lang.IllegalStateException: FragmentManager is already executing transactions
08-08 16:36:32.531 E/mono    ( 4002): 	at android.support.v4.app.FragmentManagerImpl.ensureExecReady(FragmentManager.java:1956)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2007)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:763)
08-08 16:36:32.531 E/mono    ( 4002): 	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.n_onResume(Native Method)
08-08 16:36:32.531 E/mono    ( 4002): 	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.onResume(FragmentContainer.java:83)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.support.v4.app.Fragment.performResume(Fragment.java:2238)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1346)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.os.Handler.handleCallback(Handler.java:751)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.os.Handler.dispatchMessage(Handler.java:95)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.os.Looper.loop(Looper.java:154)
08-08 16:36:32.531 E/mono    ( 4002): 	at android.app.ActivityThread.main(ActivityThread.java:6077)
08-08 16:36:32.531 E/mono    ( 4002): 	at java.lang.reflect.Method.invoke(Native Method)
08-08 16:36:32.531 E/mono    ( 4002): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
08-08 16:36:32.531 E/mono    ( 4002): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
08-08 16:36:32.531 E/mono    ( 4002): 
08-08 16:36:32.531 E/mono-rt ( 4002): [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.IllegalStateException: FragmentManager is already executing transactions
08-08 16:36:32.531 E/mono-rt ( 4002):   --- End of managed Java.Lang.IllegalStateException stack trace ---
08-08 16:36:32.531 E/mono-rt ( 4002): java.lang.IllegalStateException: FragmentManager is already executing transactions
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.support.v4.app.FragmentManagerImpl.ensureExecReady(FragmentManager.java:1956)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2007)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:763)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.n_onResume(Native Method)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.onResume(FragmentContainer.java:83)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.support.v4.app.Fragment.performResume(Fragment.java:2238)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1346)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.os.Handler.handleCallback(Handler.java:751)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.os.Handler.dispatchMessage(Handler.java:95)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.os.Looper.loop(Looper.java:154)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at android.app.ActivityThread.main(ActivityThread.java:6077)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at java.lang.reflect.Method.invoke(Native Method)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
08-08 16:36:32.531 E/mono-rt ( 4002): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
08-08 16:36:32.531 E/mono-rt ( 4002): 
######## END CRASH With Android Support 25.3.1 ######
#####################################################

###################################################
######## CRASH With Android Support 25.4.0.1 ######
08-08 16:45:02.405 E/mono    ( 4293): 
08-08 16:45:02.405 E/mono    ( 4293): Unhandled Exception:
08-08 16:45:02.405 E/mono    ( 4293): Java.Lang.IllegalStateException: FragmentManager is already executing transactions
08-08 16:45:02.405 E/mono    ( 4293):   --- End of managed Java.Lang.IllegalStateException stack trace ---
08-08 16:45:02.405 E/mono    ( 4293): java.lang.IllegalStateException: FragmentManager is already executing transactions
08-08 16:45:02.405 E/mono    ( 4293): 	at android.support.v4.app.FragmentManagerImpl.ensureExecReady(FragmentManager.java:2002)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2058)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:771)
08-08 16:45:02.405 E/mono    ( 4293): 	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.n_onResume(Native Method)
08-08 16:45:02.405 E/mono    ( 4293): 	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.onResume(FragmentContainer.java:83)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.support.v4.app.Fragment.performResume(Fragment.java:2294)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1387)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1569)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1636)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2415)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2201)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2155)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2064)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:718)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.os.Handler.handleCallback(Handler.java:751)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.os.Handler.dispatchMessage(Handler.java:95)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.os.Looper.loop(Looper.java:154)
08-08 16:45:02.405 E/mono    ( 4293): 	at android.app.ActivityThread.main(ActivityThread.java:6077)
08-08 16:45:02.405 E/mono    ( 4293): 	at java.lang.reflect.Method.invoke(Native Method)
08-08 16:45:02.405 E/mono    ( 4293): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
08-08 16:45:02.405 E/mono    ( 4293): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
08-08 16:45:02.405 E/mono    ( 4293): 
08-08 16:45:02.405 E/mono-rt ( 4293): [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.IllegalStateException: FragmentManager is already executing transactions
08-08 16:45:02.405 E/mono-rt ( 4293):   --- End of managed Java.Lang.IllegalStateException stack trace ---
08-08 16:45:02.405 E/mono-rt ( 4293): java.lang.IllegalStateException: FragmentManager is already executing transactions
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.support.v4.app.FragmentManagerImpl.ensureExecReady(FragmentManager.java:2002)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2058)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:771)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.n_onResume(Native Method)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at md5270abb39e60627f0f200893b490a1ade.FragmentContainer.onResume(FragmentContainer.java:83)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.support.v4.app.Fragment.performResume(Fragment.java:2294)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1387)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1569)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1636)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2415)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2201)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2155)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2064)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:718)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.os.Handler.handleCallback(Handler.java:751)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.os.Handler.dispatchMessage(Handler.java:95)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.os.Looper.loop(Looper.java:154)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at android.app.ActivityThread.main(ActivityThread.java:6077)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at java.lang.reflect.Method.invoke(Native Method)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
08-08 16:45:02.405 E/mono-rt ( 4293): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
08-08 16:45:02.405 E/mono-rt ( 4293): 
######## END CRASH With Android Support 25.4.0.1 ######
#######################################################

Note: The crash occurred in the same line where we call Navigation.RemovePage, in Xamarin.Forms 2.3.4.247 the crash occurred in Navigation.PopAsync (not in Navigation.RemovePage).

Maybe in your environment the error is no raised by the debugger? only logged?
Comment 45 E.Z. Hart [MSFT] 2017-08-09 14:49:36 UTC
(In reply to Antonio Ibarra from comment #44)
> E.Z. Hart,
> 
> I downloaded you repro and I noticed that the version of the repro Android
> Support library is 23.3.0 but I run it without modification anyways and
> occurred another error.
> 
> I run you repro with the following Android Support Library: 23.3.0 - 25.3.1
> and 25.4.0.1 (i noticed a new version) with the same Xamarin.Forms
> 2.3.4.261, in all three version the repro crash for me, without modify your
> code.
> 
> These are the following crash error, one for each (3) Android Support:
> 
> 23.3.0 -> "Recursive entry to executePendingTransactions"
> 25.3.1 -> "FragmentManager is already executing transactions"
> 25.4.0.1 -> "FragmentManager is already executing transactions"
> Maybe in your environment the error is no raised by the debugger? only
> logged?

Antonio,

My mistake, I forgot to update the Android Support library in my repro. I've just confirmed that the "FragmentManager is already executing transactions" issue definitely happens with version 25. I'm taking a look at the issue now.
Comment 46 Rui Marinho 2017-08-15 00:22:33 UTC
Should be fixed on 2.4
Comment 47 Jack Martin 2017-08-16 07:33:54 UTC
When shall this bug be fixed & included??
STILL CRASHING!!!
Comment 48 Maxim Alexeyev 2017-08-16 11:43:46 UTC
What is ETA for release of 2.4 (final release, not beta)?
Comment 49 David Ortinau [MSFT] 2017-08-16 16:33:04 UTC
PR: https://github.com/xamarin/Xamarin.Forms/pull/1094

Will be doing a stable service release for this as before. I'll post the release here, hopefully before end of the day.
Comment 50 David Ortinau [MSFT] 2017-08-17 00:18:24 UTC
Service Release posted and available on NuGet. 2.3.4.

https://www.nuget.org/packages/Xamarin.Forms/2.3.4.267

https://developer.xamarin.com/releases/xamarin-forms/xamarin-forms-2.3/2.3.4-sr5/
Comment 51 Paulo Ortins 2017-08-17 00:51:54 UTC
Thanks David. It fixed the issues for me.
Comment 52 Antonio Ibarra 2017-08-17 16:38:28 UTC
Hi, with Xamarin 2.3.4.267 the original problem "android.view.View.unFocus(android.view.View)' on a null object reference" is back when I try to remove two pages...

With Xamarin 2.3.4.261 (the one with the OnAppearing problem) I no had problem deleting more than one page. (I changed my production project to prevent page removal in OnAppearing override)

I make a simple modification to original repro. I will upload now.
Thanx
Comment 53 Antonio Ibarra 2017-08-17 16:39:33 UTC
Created attachment 24277 [details]
multiple remove repro
Comment 54 Paulo Ortins 2017-08-18 11:36:57 UTC
Remove multiple pages still crashes for me too.
Comment 55 David Ortinau [MSFT] 2017-08-18 12:58:28 UTC
We are reviewing this today
Comment 56 batmaci 2017-08-19 12:31:11 UTC
It is still crashing when you try remove multiple pages. I get exception

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.unFocus(android.view.View)' on a null object reference
	at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4591)
	at android.view.ViewGroup.removeViewAt(ViewGroup.java:4553)
	at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1581)
	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1636)
	at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
	at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2415)
	at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2201)
	at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2155)
	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2064)
	at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:718)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:234)
	at android.app.ActivityThread.main(ActivityThread.java:5526)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Xamarin caused by: Java.Lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.unFocus(android.view.View)' on a null object reference
  --- End of managed Java.Lang.NullPointerException stack trace ---
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.unFocus(android.view.View)' on a null object reference
	at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4591)
	at android.view.ViewGroup.removeViewAt(ViewGroup.java:4553)
	at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1581)
	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1636)
	at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
	at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2415)
	at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2201)
	at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2155)
	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2064)
	at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:718)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:234)
	at android.app.ActivityThread.main(ActivityThread.java:5526)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Comment 57 LDJ 2017-08-20 15:42:05 UTC
@DavidOrtinau: What was the outcome of the review?
Comment 58 David Ortinau [MSFT] 2017-08-21 18:54:02 UTC
Reviewing this PR now: https://github.com/xamarin/Xamarin.Forms/pull/1108
Comment 59 Maxim Alexeyev 2017-08-24 02:34:45 UTC
2.3.4.267 still fails after updating to latest Xamarin.Android.Support.xxx libs (25.4.0.1). Same code works on 24.2.1. Fails on removing last page from stack.
Comment 60 Jack Martin 2017-08-29 02:38:59 UTC
update to 25.4.0.2 STILL CRASHING!!!
Comment 61 Valonk 2017-08-29 09:04:09 UTC
Downgrading isn't an option for us.
 Is there any news about this bug? 

Got the PR reviewed? 
This is very annoying.
Comment 62 Samantha Houts [MSFT] 2017-08-29 18:16:29 UTC
Should be fixed in 2.3.4-SR6 and 2.4.0-pre2. Thank you!
Comment 63 christian.bilodeau 2017-08-30 15:49:27 UTC
Still crashing for me after updating to 2.3.4.270 unfortunately.

08-30 11:34:45.324 E/AndroidRuntime(20373): java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.unFocus(android.view.View)' on a null object reference
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4942)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at android.view.ViewGroup.removeViewAt(ViewGroup.java:4904)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1540)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at android.os.Handler.handleCallback(Handler.java:739)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at android.os.Handler.dispatchMessage(Handler.java:95)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at android.os.Looper.loop(Looper.java:148)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at android.app.ActivityThread.main(ActivityThread.java:7331)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at java.lang.reflect.Method.invoke(Native Method)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
08-30 11:34:45.324 E/AndroidRuntime(20373): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Comment 64 Valonk 2017-08-30 17:18:23 UTC
@christian.bilodeau@nventive.com you need to update to 2.4.0-pre2.  2.3.4-SR6 still crashes for me.
Comment 65 christian.bilodeau 2017-08-30 17:36:31 UTC
Thanks a lot, I confirm that it works on 2.4.0-pre2 and still crashes on stable.
Comment 66 Valonk 2017-08-30 17:56:57 UTC
@christian.bilodeau@nventive.comno problem but careful I think it's not worth it because 2.4.0-pre2 brings a lot of its own problems with it.
Comment 67 christian.bilodeau 2017-08-30 17:58:46 UTC
Got it, ideally SR7 is coming soon then!
Comment 68 George Josh Karabin 2017-08-31 16:55:55 UTC
If I look at the test case file for this bug, it looks pretty thin: 

https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla53179.cs

Maybe there are other test cases out there to cover all of the types of crashes that people are seeing, but maybe not. The "edit nav stack from OnAppearing" reproduction doesn't appear to be covered there, for instance.

Speaking as an "agile chicken" I would observe that this kind of code is going to be really fragile going forward if that test case list doesn't grow. Focusing on adding tests there would be a good investment.  I'm can't justify doing the work on my own
as updating my SDK isn't a requirement for my projects right now, so I'll leave it at that. I
Comment 69 batmaci 2017-09-02 15:27:10 UTC
It doesnt crash now but it still DOESNT work using in OnAppearing method of the page. is there any good reason for it please?`
Comment 70 batmaci 2017-09-02 15:39:58 UTC
Correction, actually It also works, please ignore my previous comment. Found mistake in my own code. thanks for the update
Comment 71 E.Z. Hart [MSFT] 2017-09-05 17:25:31 UTC
(In reply to George Josh Karabin from comment #68)
> If I look at the test case file for this bug, it looks pretty thin: 
> 
> https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Controls.
> Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla53179.cs
> 
> Maybe there are other test cases out there to cover all of the types of
> crashes that people are seeing, but maybe not. The "edit nav stack from
> OnAppearing" reproduction doesn't appear to be covered there, for instance.

It's covered here:

https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/RemovePageOnAppearing.cs

And the original version of this issue is covered here: 

https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/PopAfterRemove.cs

I'll admit the mapping of "Bugzilla case" -> "Test case" isn't obvious/consistent here. It's definitely something we need to address.
Comment 72 George Josh Karabin 2017-09-05 17:35:33 UTC
Thanks for providing the breadcrumbs to follow. I'm glad to see that the tests are there - it increases my confidence level. Hopefully SR-6 has a fork in it now!
Comment 73 christian.bilodeau 2017-09-18 12:43:06 UTC
Hi, any news on fixing the stable version?
Comment 74 softsan 2017-09-18 16:23:59 UTC
Hi,

We are on latest 2.3.4.270 and found following error:

Java.Lang.IllegalStateExceptionFragmentManager is already executing transactions
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <cdd0ce4f453c4b27a788fe2a7e16e0b6>:0 
  at Java.Interop.JniEnvironment+InstanceMethods.CallBooleanMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) [0x00068] in <df0313fb348d4ed3a3da45d82e312364>:0 
  at Android.Runtime.JNIEnv.CallBooleanMethod (System.IntPtr jobject, System.IntPtr jmethod) [0x0000e] in <62722017133c428bb6fcd27468b98d09>:0 
  at Android.Support.V4.App.FragmentManagerInvoker.ExecutePendingTransactions () [0x00033] in <7e083afc7c9045f59e01d9c14931060d>:0 
  at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.SwitchContentAsync (Xamarin.Forms.Page page, System.Boolean animated, System.Boolean removed, System.Boolean popToRoot) [0x00111] in <cc2cf9fed10c4c718bb9bb6c0f20842f>:0 
  at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPopViewAsync (Xamarin.Forms.Page page, System.Boolean animated) [0x00021] in <cc2cf9fed10c4c718bb9bb6c0f20842f>:0 
  at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.PopViewAsync (Xamarin.Forms.Page page, System.Boolean animated) [0x00000] in <cc2cf9fed10c4c718bb9bb6c0f20842f>:0 
  at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPopped (System.Object sender, Xamarin.Forms.Internals.NavigationRequestedEventArgs e) [0x0000e] in <cc2cf9fed10c4c718bb9bb6c0f20842f>:0 
  at Xamarin.Forms.NavigationPage+<Xamarin-Forms-INavigationPageController-PopAsyncInner>d__63.MoveNext () [0x0006e] in <4de88a84ae584d17a69d369a63c2b0d8>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <cdd0ce4f453c4b27a788fe2a7e16e0b6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <cdd0ce4f453c4b27a788fe2a7e16e0b6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <cdd0ce4f453c4b27a788fe2a7e16e0b6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <cdd0ce4f453c4b27a788fe2a7e16e0b6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <cdd0ce4f453c4b27a788fe2a7e16e0b6>:0 
  at Xamarin.Forms.NavigationPage+<PopAsync>d__38.MoveNext () [0x001b9] in <4de88a84ae584d17a69d369a63c2b0d8>:0
Comment 75 christian.bilodeau 2017-09-26 14:05:33 UTC
For information, I have the same "FragmentManager is already executing transactions" when I update to 2.4.0.275-pre3 and exit a TabbedPage. Bumping this as I really want to stay on stable, but this Bugzilla is still valid for the stable branch. Shoudln't be marked as "RESOLVED FIXED".
Comment 76 E.Z. Hart [MSFT] 2017-09-26 20:02:25 UTC
(In reply to christian.bilodeau from comment #75)
> For information, I have the same "FragmentManager is already executing
> transactions" when I update to 2.4.0.275-pre3 and exit a TabbedPage. Bumping
> this as I really want to stay on stable, but this Bugzilla is still valid
> for the stable branch. Shoudln't be marked as "RESOLVED FIXED".

Can you elaborate on what you mean by "exit a TabbedPage"? Or provide a minimal repro project so we can see what you mean?
Comment 77 christian.bilodeau 2017-10-02 17:19:05 UTC
Hi!

Sorry for the late response. The issue I was referring to turned out to be related to that instead: https://bugzilla.xamarin.com/show_bug.cgi?id=40258.

The RemovePage bug is fixed on my side with the latest stable version. Thank you!

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