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 crashing when rotating a flyout page #24779

Open
Brosten opened this issue Sep 16, 2024 · 4 comments
Open

Android crashing when rotating a flyout page #24779

Brosten opened this issue Sep 16, 2024 · 4 comments
Labels
area-controls-flyoutpage FlyoutPage migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@Brosten
Copy link

Brosten commented Sep 16, 2024

Description

I'm opening a new issue on this topic, since the existing once are incorrectly closed.

I use a flyout page and when rotating the screen, ~1 time out of 10 the app crashes.
The error message is something like:
androidx.drawerlayout.widget.DrawerLayout.getDrawerViewAbsoluteGravity
java.lang.ClassCastException: androidx.appcompat.widget.LinearLayoutCompat$LayoutParams cannot be cast to androidx.drawerlayout.widget.DrawerLayout$LayoutParams

Other similar, closed reports:
#20858
#18161

Steps to Reproduce

  1. Create a maui project with a flyout page
  2. On details page, put some random content (e.g. I added 50 lables within a VerticalStackLayout).
  3. Rotate the screen a bit back and fourth. Eventually, the app will crash with the above error, or something similar.

Link to public reproduction project repository

No response

Version with bug

8.0.82 SR8.2

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

All versions, what I know of

Did you find any workaround?

From what I found, setting
FlyoutLayoutBehavior = FlyoutLayoutBehavior.Popover;
seems to prevent the crashes. But you also loose the visible flyout that can be nice to have, at least on landscape tablets.

Relevant log output

androidx.drawerlayout.widget.DrawerLayout.getDrawerViewAbsoluteGravity DrawerLayout.java:991
androidx.drawerlayout.widget.DrawerLayout.checkDrawerViewAbsoluteGravity DrawerLayout.java:996
androidx.drawerlayout.widget.DrawerLayout$ViewDragCallback.onViewPositionChanged DrawerLayout.java:2292
androidx.customview.widget.ViewDragHelper.continueSettling ViewDragHelper.java:779
androidx.drawerlayout.widget.DrawerLayout.computeScroll DrawerLayout.java:1375
android.view.View.updateDisplayListIfDirty View.java:24009
android.view.View.draw View.java:24907
android.view.ViewGroup.drawChild ViewGroup.java:4780
android.view.ViewGroup.dispatchDraw ViewGroup.java:4538
android.view.View.updateDisplayListIfDirty View.java:24022
android.view.View.draw View.java:24907
android.view.ViewGroup.drawChild ViewGroup.java:4780
android.view.ViewGroup.dispatchDraw ViewGroup.java:4538
android.view.View.updateDisplayListIfDirty View.java:24022
android.view.View.draw View.java:24907
android.view.ViewGroup.drawChild ViewGroup.java:4780
android.view.ViewGroup.dispatchDraw ViewGroup.java:4538
android.view.View.updateDisplayListIfDirty View.java:24022
android.view.View.draw View.java:24907
android.view.ViewGroup.drawChild ViewGroup.java:4780
android.view.ViewGroup.dispatchDraw ViewGroup.java:4538
android.view.View.updateDisplayListIfDirty View.java:24022
android.view.View.draw View.java:24907
android.view.ViewGroup.drawChild ViewGroup.java:4780
android.view.ViewGroup.dispatchDraw ViewGroup.java:4538
android.view.View.updateDisplayListIfDirty View.java:24022
android.view.View.draw View.java:24907
android.view.ViewGroup.drawChild ViewGroup.java:4780
android.view.ViewGroup.dispatchDraw ViewGroup.java:4538
com.android.internal.policy.DecorView.dispatchDraw DecorView.java:1179
android.view.View.draw View.java:25180
com.android.internal.policy.DecorView.draw DecorView.java:1161
android.view.View.updateDisplayListIfDirty View.java:24036
android.view.ThreadedRenderer.updateViewTreeDisplayList ThreadedRenderer.java:768
android.view.ThreadedRenderer.updateRootDisplayList ThreadedRenderer.java:774
android.view.ThreadedRenderer.draw ThreadedRenderer.java:872
android.view.ViewRootImpl.draw ViewRootImpl.java:6051
android.view.ViewRootImpl.performDraw ViewRootImpl.java:5706
android.view.ViewRootImpl.performTraversals ViewRootImpl.java:4795
android.view.ViewRootImpl.doTraversal ViewRootImpl.java:3288
android.view.ViewRootImpl$TraversalRunnable.run ViewRootImpl.java:11344
android.view.Choreographer$CallbackRecord.run Choreographer.java:1689
android.view.Choreographer$CallbackRecord.run Choreographer.java:1698
android.view.Choreographer.doCallbacks Choreographer.java:1153
android.view.Choreographer.doFrame Choreographer.java:1079
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 Method.java
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:578
com.android.internal.os.ZygoteInit.main ZygoteInit.java:1103
@Brosten Brosten added the t/bug Something isn't working label Sep 16, 2024
Copy link
Contributor

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 added the migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert label Sep 16, 2024
@tj-devel709 tj-devel709 added this to the 9.0-rc2 milestone Sep 18, 2024
@jaosnz-rep
Copy link

@Brosten I tried to verify the issue but it didn't reproduce. Can you share a sample project with us so I can investigate further? Looking forward to your reply!

@Brosten
Copy link
Author

Brosten commented Sep 19, 2024

@jaosnz-rep: Sure, her's a repo.
RotationCrash.zip

I run this on an android tablet emulator, running Android 14 (API 34)
After rapidly rotating the screen in random directions, it crashes after 5-10 rotations.

@jaosnz-rep jaosnz-rep added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Sep 19, 2024
@jaosnz-rep
Copy link

I can repro this issue at Android platform on the latest 17.12.0 Preview 2.0 (8.0.90 & 8.0.82& 8.0.80).

@PureWeen PureWeen modified the milestones: 9.0-rc2, .NET 9 Servicing Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-flyoutpage FlyoutPage migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants