Bug 60414 - App stateloss on switching other apps java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
Summary: App stateloss on switching other apps java.lang.IllegalStateException: Can no...
Status: IN_PROGRESS
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.3
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-10-27 14:10 UTC by M.D.Prasad
Modified: 2018-03-22 10:43 UTC (History)
3 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 for Bug 60414 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
IN_PROGRESS

Description M.D.Prasad 2017-10-27 14:10:29 UTC
We are working with Xamarin.Forms app and the issue we are facing with andriod platform. 

Steps to Reproduce:
1. When we backgrounding our app and launch other apps on the android phone.
2. When foregrounding our app, unfortunatly it got state loss and re-launching again.
3. After re-launch it's not allowing to navigate to other pages and it is giving us an exception.

Here is the exception info from Hockeyapp.

at caused.AggregateException(s)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()<3dc9ed3d31194319991e686734adcb10>:0
at Java.Interop.JniEnvironment.InstanceMethods.CallIntMethod(JniObjectReference instance, JniMethodInfo method)<a043032cf94a485190047a14918b9f60>:0
at Android.Runtime.JNIEnv.CallIntMethod(IntPtr jobject, IntPtr jmethod)<dbb23921fff044259a062429c809f5d5>:0
at Android.Support.V4.App.FragmentTransactionInvoker.Commit()<27c17fe440cf491ba8255bcefade6e02>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.SwitchContentAsync(Page view, bool animated, bool removed, bool popToRoot)<556464d784854d58957ce21f4c5eb182>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPushAsync(Page view, bool animated)<556464d784854d58957ce21f4c5eb182>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.PushViewAsync(Page page, bool animated)<556464d784854d58957ce21f4c5eb182>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPushed(object sender, NavigationRequestedEventArgs e)<556464d784854d58957ce21f4c5eb182>:0
at Xamarin.Forms.NavigationPage.<PushAsyncInner>d__90.MoveNext()<bf304fc411724e23a42595b76799a13a>:0

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()<3dc9ed3d31194319991e686734adcb10>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)<3dc9ed3d31194319991e686734adcb10>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)<3dc9ed3d31194319991e686734adcb10>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)<3dc9ed3d31194319991e686734adcb10>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()<3dc9ed3d31194319991e686734adcb10>:0
▴at Xamarin.Forms.NavigationPage.<PushAsync>d__48.MoveNext()<bf304fc411724e23a42595b76799a13a>:0
--- End of inner exception stack trace ---
---> (Inner Exception #0) Java.Lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()<3dc9ed3d31194319991e686734adcb10>:0
at Java.Interop.JniEnvironment.InstanceMethods.CallIntMethod(JniObjectReference instance, JniMethodInfo method)<a043032cf94a485190047a14918b9f60>:0
at Android.Runtime.JNIEnv.CallIntMethod(IntPtr jobject, IntPtr jmethod)<dbb23921fff044259a062429c809f5d5>:0
at Android.Support.V4.App.FragmentTransactionInvoker.Commit()<27c17fe440cf491ba8255bcefade6e02>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.SwitchContentAsync(Page view, bool animated, bool removed, bool popToRoot)<556464d784854d58957ce21f4c5eb182>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPushAsync(Page view, bool animated)<556464d784854d58957ce21f4c5eb182>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.PushViewAsync(Page page, bool animated)<556464d784854d58957ce21f4c5eb182>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPushed(object sender, NavigationRequestedEventArgs e)<556464d784854d58957ce21f4c5eb182>:0
at Xamarin.Forms.NavigationPage.<PushAsyncInner>d__90.MoveNext()<bf304fc411724e23a42595b76799a13a>:0

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()<3dc9ed3d31194319991e686734adcb10>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)<3dc9ed3d31194319991e686734adcb10>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)<3dc9ed3d31194319991e686734adcb10>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)<3dc9ed3d31194319991e686734adcb10>:0
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()<3dc9ed3d31194319991e686734adcb10>:0
▴at Xamarin.Forms.NavigationPage.<PushAsync>d__48.MoveNext()<bf304fc411724e23a42595b76799a13a>:0
--- End of managed Java.Lang.IllegalStateException stack trace ---
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss()FragmentManager.java:1493
at android.support.v4.app.FragmentManagerImpl.enqueueAction()FragmentManager.java:1511
at android.support.v4.app.BackStackRecord.commitInternal()BackStackRecord.java:638
at android.support.v4.app.BackStackRecord.commit()BackStackRecord.java:617
at md5b60ffeb829f638581ab2bb9b1a7f4f3f.CellAdapter.n_onItemClick(Native Method)
at md5b60ffeb829f638581ab2bb9b1a7f4f3f.CellAdapter.onItemClick()CellAdapter.java:89
at android.widget.AdapterView.performItemClick()AdapterView.java:339
at android.widget.AbsListView.performItemClick()AbsListView.java:1695
at android.widget.AbsListView$PerformClick.run()AbsListView.java:4171
at android.widget.AbsListView$13.run()AbsListView.java:6772
at android.os.Handler.handleCallback()Handler.java:751
at android.os.Handler.dispatchMessage()Handler.java:95
at android.os.Looper.loop()Looper.java:154
at android.app.ActivityThread.main()ActivityThread.java:6692
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run()ZygoteInit.java:1468
at com.android.internal.os.ZygoteInit.main()ZygoteInit.java:1358
<---
Comment 1 Paul DiPietro [MSFT] 2017-10-27 14:19:19 UTC
Can you reproduce this issue with other projects, and/or are you able to provide us with a reproduction project to look into? The report states the version as 2.3.3; is this in fact the version you're using and have you tested newer ones? Any more information you can provide would be appreciated in this matter.
Comment 2 M.D.Prasad 2017-10-27 15:40:11 UTC
@Paul Dipietro
1. Can you reproduce this issue with other projects, and/or are you able to provide us with a reproduction project to look into?
* We can not re-create another project as it has many things and I don't think our client will accept to share the project, but I hope I can provide what/where you required.

2. The report states the version as 2.3.3; is this in fact the version you're using and have you tested newer ones?
* Yes, we have tried with newer versions of xamarin.forms framework as well but still no luck.

*Atleast according to exception please suggest me where to look or what you need instead whole project, I can provide the information.
Comment 3 M.D.Prasad 2017-10-27 16:12:36 UTC
This issue is able to reproducing only on Ad-Hoc builds which are published in hockeyapp.
Comment 4 juanjose.requena 2018-03-22 10:43:22 UTC
I'm facing the same problem right now with Xamarin.Forms 2.5.0.121934. 

Any update or workaround? I'm receiving 40+ daily crashes reports.