This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 47367 - java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
Summary: java.lang.IllegalStateException: Can not perform this action after onSaveInst...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android (show other bugs)
Version: 2.3.3
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jimmy
URL:
: 46436 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-11-18 16:38 UTC by smorsi27
Modified: 2017-03-16 21:57 UTC (History)
6 users (show)

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


Attachments
repro project (64.85 KB, application/x-zip-compressed)
2017-02-27 17:59 UTC, Jimmy
Details

Description smorsi27 2016-11-18 16:38:29 UTC
QA team is testing our app and they keep coming across this issue intermittantly. It's really hard to reproduce but tends to happen only when backgrounding our app and using other apps on the phone while our app is in the background.

Here's the stacktrace from the device: 

CrashLog 2.0.0(14)
Device : Huawei angler
Build number : 2343525
CPU ABI : arm64-v8a
Kernel version : 3.10.73-gcf36678
Firmware version : 6.0
Screen width : 1440
Screen height : 2392

ject, System.IntPtr jmethod) [0x0000e] in <acad26b07f8142579c4363cd5f650214>:0 
11-18 05:08:40.902 I/MonoDroid(20948):   at Android.Support.V4.App.FragmentTransactionInvoker.Commit () [0x00033] in <71c3e52f1b484794bca1cdfb1b8b1fdb>:0 
11-18 05:08:40.902 I/MonoDroid(20948):   at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.SwitchContentAsync (Xamarin.Forms.Page view, System.Boolean animated, System.Boolean removed, System.Boolean popToRoot) [0x0013f] in <2588223c9557437b982e81aca09a9162>:0 
11-18 05:08:40.902 I/MonoDroid(20948):   at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPushAsync (Xamarin.Forms.Page view, System.Boolean animated) [0x00000] in <2588223c9557437b982e81aca09a9162>:0 
11-18 05:08:40.902 I/MonoDroid(20948):   at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.PushViewAsync (Xamarin.Forms.Page page, System.Boolean animated) [0x00000] in <2588223c9557437b982e81aca09a9162>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPushed (System.Object sender, Xamarin.Forms.NavigationRequestedEventArgs e) [0x0000e] in <2588223c9557437b982e81aca09a9162>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at Xamarin.Forms.NavigationPage+<PushAsyncInner>d__66.MoveNext () [0x00065] in <3b59ae6b0d94490dbc4d42528dcd29bb>:0 
11-18 05:08:40.903 I/MonoDroid(20948): --- End of stack trace from previous location where exception was thrown ---
11-18 05:08:40.903 I/MonoDroid(20948):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <9a7bfc4a60364ed19980caec6c0d5854>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <9a7bfc4a60364ed19980caec6c0d5854>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <9a7bfc4a60364ed19980caec6c0d5854>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <9a7bfc4a60364ed19980caec6c0d5854>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <9a7bfc4a60364ed19980caec6c0d5854>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at Xamarin.Forms.NavigationPage+<PushAsync>d__65.MoveNext () [0x001c4] in <3b59ae6b0d94490dbc4d42528dcd29bb>:0 
11-18 05:08:40.903 I/MonoDroid(20948): --- End of stack trace from previous location where exception was thrown ---
11-18 05:08:40.903 I/MonoDroid(20948):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <9a7bfc4a60364ed19980caec6c0d5854>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <9a7bfc4a60364ed19980caec6c0d5854>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <9a7bfc4a60364ed19980caec6c0d5854>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <9a7bfc4a60364ed19980caec6c0d5854>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <9a7bfc4a60364ed19980caec6c0d5854>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at MobiSave.Droid.UI.XamarinForms.Controls.FooterBar+<LoadMainPage>c__async0+<LoadMainPage>c__AnonStorey34+<LoadMainPage>c__async33.MoveNext () [0x00087] in <27b48db40859439187ce05e05f03cbc4>:0 
11-18 05:08:40.903 I/MonoDroid(20948): --- End of stack trace from previous location where exception was thrown ---
11-18 05:08:40.903 I/MonoDroid(20948):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <9a7bfc4a60364ed19980caec6c0d5854>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (System.Object state) [0x00000] in <9a7bfc4a60364ed19980caec6c0d5854>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at Android.App.SyncContext+<Post>c__AnonStorey0.<>m__0 () [0x00000] in <acad26b07f8142579c4363cd5f650214>:0 
11-18 05:08:40.903 I/MonoDroid(20948):   at Java.Lang.Thread+RunnableImplementor.Run () [0x0000b] in <acad26b07f8142579c4363cd5f650214>:0 
11-18 05:08:40.904 I/MonoDroid(20948):   at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <acad26b07f8142579c4363cd5f650214>:0 
11-18 05:08:40.904 I/MonoDroid(20948):   at (wrapper dynamic-method) System.Object:89e728a8-3a21-49e8-9547-7aa3606ffdd3 (intptr,intptr)
11-18 05:08:40.904 I/MonoDroid(20948):   --- End of managed Java.Lang.IllegalStateException stack trace ---
11-18 05:08:40.904 I/MonoDroid(20948): java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
11-18 05:08:40.904 I/MonoDroid(20948): at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1448)
11-18 05:08:40.904 I/MonoDroid(20948): at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1466)
11-18 05:08:40.904 I/MonoDroid(20948): at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:634)
11-18 05:08:40.904 I/MonoDroid(20948): at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:613)
11-18 05:08:40.904 I/MonoDroid(20948): at mono.java.lang.RunnableImplementor.n_run(Native Method)
11-18 05:08:40.904 I/MonoDroid(20948): at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
11-18 05:08:40.904 I/MonoDroid(20948): at android.os.Handler.handleCallback(Handler.java:739)
11-18 05:08:40.904 I/MonoDroid(20948): at android.os.Handler.dispatchMessage(Handler.java:95)
11-18 05:08:40.904 I/MonoDroid(20948): at android.os.Looper.loop(Looper.java:148)
11-18 05:08:40.904 I/MonoDroid(20948): at android.app.ActivityThread.main(ActivityThread.java:5417)
11-18 05:08:40.904 I/MonoDroid(20948): at java.lang.reflect.Method.invoke(Native Method)
11-18 05:08:40.904 I/MonoDroid(20948): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-18 05:08:40.904 I/MonoDroid(20948): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-18 05:08:40.945 D/ConnectivityService(  917): notifyType CAP_CHANGED for NetworkAgentInfo [WIFI () - 100]
11-18 05:08:40.973 D/AndroidRuntime(20948): Shutting down VM
--------- beginning of crash
11-18 05:08:40.988 E/AndroidRuntime(20948): FATAL EXCEPTION: main
11-18 05:08:40.988 E/AndroidRuntime(20948): Process: com.mobisave.app.qa, PID: 20948
11-18 05:08:40.988 E/AndroidRuntime(20948): java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
11-18 05:08:40.988 E/AndroidRuntime(20948): at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1448)
11-18 05:08:40.988 E/AndroidRuntime(20948): at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1466)
11-18 05:08:40.988 E/AndroidRuntime(20948): at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:634)
11-18 05:08:40.988 E/AndroidRuntime(20948): at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:613)
11-18 05:08:40.988 E/AndroidRuntime(20948): at mono.java.lang.RunnableImplementor.n_run(Native Method)
11-18 05:08:40.988 E/AndroidRuntime(20948): at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
11-18 05:08:40.988 E/AndroidRuntime(20948): at android.os.Handler.handleCallback(Handler.java:739)
11-18 05:08:40.988 E/AndroidRuntime(20948): at android.os.Handler.dispatchMessage(Handler.java:95)
11-18 05:08:40.988 E/AndroidRuntime(20948): at android.os.Looper.loop(Looper.java:148)
11-18 05:08:40.988 E/AndroidRuntime(20948): at android.app.ActivityThread.main(ActivityThread.java:5417)
11-18 05:08:40.988 E/AndroidRuntime(20948): at java.lang.reflect.Method.invoke(Native Method)
11-18 05:08:40.988 E/AndroidRuntime(20948): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-18 05:08:40.988 E/AndroidRuntime(20948): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-18 05:08:40.993 I/Exchange(29254): RestartPingsTask did not start any pings.
Comment 1 smorsi27 2016-11-18 16:43:04 UTC
Looks like it's related to "mono.java.lang.RunnableImplementor.n_run"
Comment 2 adrianknight89 2016-11-24 20:30:42 UTC
Ref https://github.com/xamarin/Xamarin.Forms/pull/527
Comment 3 Andrew 2017-02-21 15:42:45 UTC
this is happening on me too.


java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
android.support.v4.app.FragmentManagerImpl.checkStateLoss()FragmentManager.java:1493
android.support.v4.app.FragmentManagerImpl.enqueueAction()FragmentManager.java:1511
android.support.v4.app.BackStackRecord.commitInternal()BackStackRecord.java:638
android.support.v4.app.BackStackRecord.commit()BackStackRecord.java:617
mono.java.lang.RunnableImplementor.n_run(Native Method)
mono.java.lang.RunnableImplementor.run()RunnableImplementor.java:30
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:6247
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run()ZygoteInit.java:872
com.android.internal.os.ZygoteInit.main()ZygoteInit.java:762
Xamarin caused by: Java.Lang.RuntimeException: Can not perform this action after onSaveInstanceState
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()<f6d63f5a6451450e98666ba1d7d0030d>:0
Java.Interop.JniEnvironment.InstanceMethods.CallIntMethod(JniObjectReference instance, JniMethodInfo method)<dc90f66c05b949529ed8354ee3c6869a>:0
Android.Runtime.JNIEnv.CallIntMethod(IntPtr jobject, IntPtr jmethod)<bc211a0ccb42486c9a788ccb65a218da>:0
Android.Support.V4.App.FragmentTransactionInvoker.Commit()<27c17fe440cf491ba8255bcefade6e02>:0
Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.SwitchContentAsync(Page view, bool animated, bool removed, bool popToRoot)<556464d784854d58957ce21f4c5eb182>:0
Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPushAsync(Page view, bool animated)<556464d784854d58957ce21f4c5eb182>:0
Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.PushViewAsync(Page page, bool animated)<556464d784854d58957ce21f4c5eb182>:0
Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPushed(object sender, NavigationRequestedEventArgs e)<556464d784854d58957ce21f4c5eb182>:0
Xamarin.Forms.NavigationPage.<PushAsyncInner>d__90.MoveNext()<bf304fc411724e23a42595b76799a13a>:0
Xamarin.Forms.NavigationPage.<PushAsync>d__48.MoveNext()<bf304fc411724e23a42595b76799a13a>:0
Mobile.Forms.MVVM.HelperBase.PushPageInternalNoViewModel()<84dc1129d6db499aa1d65b126bdc638a>:0
Mobile.Forms.ViewModel.NewsViewModel.<>c__async17.<>c__AnonStorey1A.<>c__async25.<>c__AnonStorey28.()<84dc1129d6db499aa1d65b126bdc638a>:0
Android.App.SyncContext.<Post>c__AnonStorey0.<>m__0()<bc211a0ccb42486c9a788ccb65a218da>:0
Java.Lang.Thread.RunnableImplementor.Run()<bc211a0ccb42486c9a788ccb65a218da>:0
Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this)<bc211a0ccb42486c9a788ccb65a218da>:0
at (wrapper dynamic-method) System.Object:a355e2af-0fb9-47da-9092-534e251fcfdb (intptr,intptr)
--- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
android.support.v4.app.FragmentManagerImpl.checkStateLoss()FragmentManager.java:1493
android.support.v4.app.FragmentManagerImpl.enqueueAction()FragmentManager.java:1511
android.support.v4.app.BackStackRecord.commitInternal()BackStackRecord.java:638
android.support.v4.app.BackStackRecord.commit()BackStackRecord.java:617
mono.java.lang.RunnableImplementor.n_run(Native Method)
mono.java.lang.RunnableImplementor.run()RunnableImplementor.java:30
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:6247
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run()ZygoteInit.java:872
com.android.internal.os.ZygoteInit.main()ZygoteInit.java:762
Comment 4 Andrew 2017-02-21 15:46:30 UTC
Similar error.  I am using a MasterDetail and have implemented code for a "back" button that keeps track of the page types on a stack.  


Xamarin caused by: java.lang.Exception: LocalTabViewModel; PaceViewModel; NewsViewModel;
---- Message ----
Can not perform this action after onSaveInstanceState
---- HResult ----
-2146233088
---- HelpLink ----
---- Source ----
mscorlib
---- StackTrace ----
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()<f6d63f5a6451450e98666ba1d7d0030d>:0
Java.Interop.JniEnvironment.InstanceMethods.CallIntMethod(JniObjectReference instance, JniMethodInfo method)<dc90f66c05b949529ed8354ee3c6869a>:0
Android.Runtime.JNIEnv.CallIntMethod(IntPtr jobject, IntPtr jmethod)<bc211a0ccb42486c9a788ccb65a218da>:0
Android.Support.V4.App.FragmentTransactionInvoker.Commit()<27c17fe440cf491ba8255bcefade6e02>:0
Xamarin.Forms.Platform.Android.AppCompat.MasterDetailContainer.AddChildView(VisualElement childView)<556464d784854d58957ce21f4c5eb182>:0
Xamarin.Forms.Platform.Android.MasterDetailContainer.set_ChildView(VisualElement value)<556464d784854d58957ce21f4c5eb182>:0
Xamarin.Forms.Platform.Android.AppCompat.MasterDetailPageRenderer.UpdateDetail()<556464d784854d58957ce21f4c5eb182>:0
Xamarin.Forms.Platform.Android.AppCompat.MasterDetailPageRenderer.HandlePropertyChanged(object sender, PropertyChangedEventArgs e)<556464d784854d58957ce21f4c5eb182>:0
<Module>.invoke_void_object_PropertyChangedEventArgs(object, PropertyChangedEventArgs)(wrapper delegate-invoke)
Xamarin.Forms.BindableObject.OnPropertyChanged(string propertyName)<bf304fc411724e23a42595b76799a13a>:0
Xamarin.Forms.Element.OnPropertyChanged(string propertyName)<bf304fc411724e23a42595b76799a13a>:0
Xamarin.Forms.MasterDetailPage.set_Detail(Page value)<bf304fc411724e23a42595b76799a13a>:0
Mobile.Forms.ViewModel.HomeViewModel.OpenDetailPage(Type pageType, bool isSecure, bool pageOnly, bool savePageOnStack, string menuHighlighText, Type alternativeSavedType)<84dc1129d6db499aa1d65b126bdc638a>:0
Mobile.Forms.ViewModel.HomeViewModel.BackButtonHelper(BackMenu menu)<84dc1129d6db499aa1d65b126bdc638a>:0
Mobile.Forms.ViewModel.HomeViewModel.HandleBack(ObservableCollection<T> items)<84dc1129d6db499aa1d65b126bdc638a>:0
--- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
android.support.v4.app.FragmentManagerImpl.checkStateLoss()FragmentManager.java:1493
android.support.v4.app.FragmentManagerImpl.enqueueAction()FragmentManager.java:1511
android.support.v4.app.BackStackRecord.commitInternal()BackStackRecord.java:638
android.support.v4.app.BackStackRecord.commit()BackStackRecord.java:617
md5405079b46081a0a5e16b9af1f0e78ce3.MainActivity.n_onBackPressed(Native Method)
md5405079b46081a0a5e16b9af1f0e78ce3.MainActivity.onBackPressed()MainActivity.java:74
android.app.Activity.onKeyUp()Activity.java:2779
android.view.KeyEvent.dispatch()KeyEvent.java:2707
android.app.Activity.dispatchKeyEvent()Activity.java:3080
android.support.v7.app.AppCompatActivity.dispatchKeyEvent()AppCompatActivity.java:524
android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent()WindowCallbackWrapper.java:50
android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent()AppCompatDelegateImplBase.java:241
android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent()WindowCallbackWrapper.java:50
com.android.internal.policy.DecorView.dispatchKeyEvent()DecorView.java:318
android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent()ViewRootImpl.java:4521
android.view.ViewRootImpl$ViewPostImeInputStage.onProcess()ViewRootImpl.java:4492
android.view.ViewRootImpl$InputStage.deliver()ViewRootImpl.java:3947
android.view.ViewRootImpl$InputStage.onDeliverToNext()ViewRootImpl.java:4000
android.view.ViewRootImpl$InputStage.forward()ViewRootImpl.java:3966
android.view.ViewRootImpl$InputStage.apply()ViewRootImpl.java:3974
android.view.ViewRootImpl$InputStage.deliver()ViewRootImpl.java:3947
android.view.ViewRootImpl$InputStage.onDeliverToNext()ViewRootImpl.java:4000
android.view.ViewRootImpl$InputStage.forward()ViewRootImpl.java:3966
android.view.ViewRootImpl$AsyncInputStage.forward()ViewRootImpl.java:4095
android.view.ViewRootImpl$InputStage.apply()ViewRootImpl.java:3974
android.view.ViewRootImpl$AsyncInputStage.apply()ViewRootImpl.java:4152
android.view.ViewRootImpl$InputStage.deliver()ViewRootImpl.java:3947
android.view.ViewRootImpl$InputStage.onDeliverToNext()ViewRootImpl.java:4000
android.view.ViewRootImpl$InputStage.forward()ViewRootImpl.java:3966
android.view.ViewRootImpl$InputStage.apply()ViewRootImpl.java:3974
android.view.ViewRootImpl$InputStage.deliver()ViewRootImpl.java:3947
android.view.ViewRootImpl$InputStage.onDeliverToNext()ViewRootImpl.java:4000
android.view.ViewRootImpl$InputStage.forward()ViewRootImpl.java:3966
android.view.ViewRootImpl$AsyncInputStage.forward()ViewRootImpl.java:4128
android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent()ViewRootImpl.java:4289
android.view.inputmethod.InputMethodManager$PendingEvent.run()InputMethodManager.java:2365
android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback()InputMethodManager.java:1961
android.view.inputmethod.InputMethodManager.finishedInputEvent()InputMethodManager.java:1952
android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished()InputMethodManager.java:2342
android.view.InputEventSender.dispatchInputEventFinished()InputEventSender.java:141
android.os.MessageQueue.nativePollOnce(Native Method)
android.os.MessageQueue.next()MessageQueue.java:323
android.os.Looper.loop()Looper.java:136
android.app.ActivityThread.main()ActivityThread.java:6247
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run()ZygoteInit.java:872
com.android.internal.os.ZygoteInit.main()ZygoteInit.java:762
Comment 5 Jan Nepras 2017-02-23 12:03:43 UTC
I am having the similar issue. Can I help you to resolve this?

ava.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
android.support.v4.app.FragmentManagerImpl.checkStateLoss()FragmentManager.java:1493
android.support.v4.app.FragmentManagerImpl.enqueueAction()FragmentManager.java:1511
android.support.v4.app.BackStackRecord.commitInternal()BackStackRecord.java:638
android.support.v4.app.BackStackRecord.commit()BackStackRecord.java:617
mono.java.lang.RunnableImplementor.n_run(Native Method)
mono.java.lang.RunnableImplementor.run()RunnableImplementor.java:30
android.os.Handler.handleCallback()Handler.java:739
android.os.Handler.dispatchMessage()Handler.java:95
android.os.Looper.loop()Looper.java:158
android.app.ActivityThread.main()ActivityThread.java:7237
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run()ZygoteInit.java:1230
com.android.internal.os.ZygoteInit.main()ZygoteInit.java:1120
Xamarin caused by: Java.Lang.IllegalStateException: Can not perform this action after onSaveInstanceState
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()<b1141dcb441d45139376de1345f6bcff>:0
Java.Interop.JniEnvironment.InstanceMethods.CallIntMethod(JniObjectReference instance, JniMethodInfo method)<36ce8ba842734b5a971e01c8794ea6eb>:0
Android.Runtime.JNIEnv.CallIntMethod(IntPtr jobject, IntPtr jmethod)<17ba3090c8e64140a45c0beb1b3a7e59>:0
Android.Support.V4.App.FragmentTransactionInvoker.Commit()<27c17fe440cf491ba8255bcefade6e02>:0
Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.SwitchContentAsync(Page view, bool animated, bool removed, bool popToRoot)<556464d784854d58957ce21f4c5eb182>:0
Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPopToRootAsync(Page page, bool animated)<556464d784854d58957ce21f4c5eb182>:0
Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.PopToRootAsync(Page page, bool animated)<556464d784854d58957ce21f4c5eb182>:0
Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnPoppedToRoot(object sender, NavigationRequestedEventArgs e)<556464d784854d58957ce21f4c5eb182>:0
Xamarin.Forms.NavigationPage.<PopToRootAsyncInner>d__89.MoveNext()<bf304fc411724e23a42595b76799a13a>:0
Xamarin.Forms.NavigationPage.<PopToRootAsync>d__46.MoveNext()<bf304fc411724e23a42595b76799a13a>:0
SafetyLineMobileApps.Services.NavigationService.<PopToRootAsync>d__8.MoveNext()<f1c41bf7816f4e068bcd4e3d23c29ea8>:0
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()<b1141dcb441d45139376de1345f6bcff>:0
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)<b1141dcb441d45139376de1345f6bcff>:0
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)<b1141dcb441d45139376de1345f6bcff>:0
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)<b1141dcb441d45139376de1345f6bcff>:0
System.Runtime.CompilerServices.TaskAwaiter.GetResult()<b1141dcb441d45139376de1345f6bcff>:0
at SafetyLineMobileApps.ViewModel.TextMessageViewModel+<<-ctor>b__28_0>d.MoveNext () [0x000d4] in <f1c41bf7816f4e068bcd4e3d23c29ea8>:0
Android.App.SyncContext.<Post>c__AnonStorey0.<>m__0()<17ba3090c8e64140a45c0beb1b3a7e59>:0
Java.Lang.Thread.RunnableImplementor.Run()<17ba3090c8e64140a45c0beb1b3a7e59>:0
Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this)<17ba3090c8e64140a45c0beb1b3a7e59>:0
at (wrapper dynamic-method) System.Object:cce6fc6b-c286-4e90-aee8-468d1170fd45 (intptr,intptr)
--- End of managed Java.Lang.IllegalStateException stack trace ---
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
android.support.v4.app.FragmentManagerImpl.checkStateLoss()FragmentManager.java:1493
android.support.v4.app.FragmentManagerImpl.enqueueAction()FragmentManager.java:1511
android.support.v4.app.BackStackRecord.commitInternal()BackStackRecord.java:638
android.support.v4.app.BackStackRecord.commit()BackStackRecord.java:617
mono.java.lang.RunnableImplementor.n_run(Native Method)
mono.java.lang.RunnableImplementor.run()RunnableImplementor.java:30
android.os.Handler.handleCallback()Handler.java:739
android.os.Handler.dispatchMessage()Handler.java:95
android.os.Looper.loop()Looper.java:158
android.app.ActivityThread.main()ActivityThread.java:7237
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run()ZygoteInit.java:1230
com.android.internal.os.ZygoteInit.main()ZygoteInit.java:1120
Comment 6 Jimmy 2017-02-27 17:21:24 UTC
This may be fixed in Forms 2.3.4.184-pre1.
Comment 7 Jimmy 2017-02-27 17:58:33 UTC
*** Bug 46436 has been marked as a duplicate of this bug. ***
Comment 8 Jimmy 2017-02-27 17:59:41 UTC
Created attachment 20013 [details]
repro project

I'm attaching the repro project from bug 46436 to this report. 

## Steps to reproduce
1. Run the Android project
2. Click "Select Photo"
3. Select a photo


## Observations

### Forms 2.3.3.180 - BAD
After selecting a photo, it tries to return to the app but immediately crashes with 

> "Java.Lang.IllegalStateException: Can not perform this action after onSaveInstanceState"


### Forms 2.3.4.192-pre2 - GOOD
The app returns to the foreground and displays the selected image successfully.
Comment 9 Jimmy 2017-03-16 21:57:10 UTC
Based on the info in comment 8, this appears to be fixed in the 2.3.4 pre-release so I am marking this report as RESOLVED. If you experience this issue with Forms 2.3.4-pre2 or later, please re-open this report and attach an update repro project. Thanks

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