Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android crashes on Modal Animation when backgrounded #23399

Closed
rs-lkroneman opened this issue Jul 2, 2024 · 1 comment · Fixed by #23400
Closed

Android crashes on Modal Animation when backgrounded #23399

rs-lkroneman opened this issue Jul 2, 2024 · 1 comment · Fixed by #23400

Comments

@rs-lkroneman
Copy link
Contributor

rs-lkroneman commented Jul 2, 2024

Description

While an animation is in progress and the app is backgrounded the app crashes with an java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState

This is currently our number 1 exception in production.

All of our stack traces point to the ModalContainer.Destroy() method

We looked at the following issues to see if they were related or had any workarounds, they seem like similar issues but didn't seem like the same to us.

Further we believe that updating the line to use CommitAllowingStateLossEx instead of Commit would fix the issue, however we're unaware of the implications of that change.

Steps to Reproduce

Unable to reproduce locally, but it was introduced after upgrading from Xamarin.Forms

Link to public reproduction project repository

No response

Version with bug

8.0.40 SR5

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No

Relevant log output

AndroidX.Fragment.App.FragmentTransactionInvoker.Commit()
Microsoft.Maui.Controls.Platform.ModalNavigationManager.ModalContainer.Destroy()
Microsoft.Maui.Controls.Platform.ModalNavigationManager.<>c__DisplayClass8_0.<PopModalPlatformAsync>b__0(Animator a)
Microsoft.Maui.Controls.Platform.GenericAnimatorListener.OnAnimationEnd(Animator animation)
Android.Animation.AnimatorListenerAdapter.n_OnAnimationEnd_Landroid_animation_Animator_(IntPtr jnienv, IntPtr native__this, IntPtr native_animation)
Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V(_JniMarshal_PPL_V callback, IntPtr jnienv, IntPtr klazz, IntPtr p0)
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
androidx.fragment.app.FragmentManager.checkStateLoss FragmentManager.java:1632
androidx.fragment.app.FragmentManager.enqueueAction FragmentManager.java:1672
androidx.fragment.app.BackStackRecord.commitInternal BackStackRecord.java:341
androidx.fragment.app.BackStackRecord.commit BackStackRecord.java:306
crc64338477404e88479c.GenericAnimatorListener.n_onAnimationEnd(Native Method)
crc64338477404e88479c.GenericAnimatorListener.onAnimationEnd GenericAnimatorListener.java:41
android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd ViewPropertyAnimator.java:1115
android.animation.Animator$AnimatorListener.onAnimationEnd Animator.java:711
android.animation.Animator$AnimatorCaller$$ExternalSyntheticLambda1.call(Unknown Source:4)
android.animation.Animator.callOnList Animator.java:669
android.animation.Animator.notifyListeners Animator.java:608
android.animation.Animator.notifyEndListeners Animator.java:633
android.animation.ValueAnimator.endAnimation ValueAnimator.java:1306
android.animation.ValueAnimator.doAnimationFrame ValueAnimator.java:1566
android.animation.AnimationHandler.doAnimationFrame AnimationHandler.java:344
android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame(Unknown Source:0)
android.animation.AnimationHandler$1.doFrame AnimationHandler.java:86
android.view.Choreographer$CallbackRecord.run Choreographer.java:1687
android.view.Choreographer$CallbackRecord.run Choreographer.java:1698
android.view.Choreographer.doCallbacks Choreographer.java:1153
android.view.Choreographer.doFrame Choreographer.java:1069
android.view.Choreographer$FrameDisplayEventReceiver.run Choreographer.java:1646
android.os.Handler.handleCallback Handler.java:958
android.os.Handler.dispatchMessage Handler.java:99
android.os.Looper.loopOnce Looper.java:230
android.os.Looper.loop Looper.java:319
android.app.ActivityThread.main ActivityThread.java:8919
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:578
com.android.internal.os.ZygoteInit.main ZygoteInit.java:1103
@rs-lkroneman rs-lkroneman added the t/bug Something isn't working label Jul 2, 2024
Copy link
Contributor

github-actions bot commented Jul 2, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@PureWeen PureWeen self-assigned this Jul 3, 2024
@PureWeen PureWeen added this to the .NET 8 SR8 milestone Jul 3, 2024
@PureWeen PureWeen moved this from Todo to In Progress in MAUI SDK Ongoing Jul 3, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in MAUI SDK Ongoing Jul 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants