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

FlyoutPage Android app crashing on orientation change #20858

Closed
PratzelBoy opened this issue Feb 27, 2024 · 10 comments · Fixed by #22453
Closed

FlyoutPage Android app crashing on orientation change #20858

PratzelBoy opened this issue Feb 27, 2024 · 10 comments · Fixed by #22453

Comments

@PratzelBoy
Copy link

Description

On Android, using your sample FlyoutPage project, the application crashes on a simple orientation change.
https://github.com/dotnet/maui/assets/140050432/46b96486-f2b3-4d0e-82fa-21dd4a60ca6b

The command 'dotnet workload list' give the following output on my setup:

Welcome to .NET 8.0!

SDK Version: 8.0.200

Installed Workload Id Manifest Version Installation Source

maui-windows 8.0.6/8.0.100 VS 17.10.34607.79, VS 17.9.34616.47
maccatalyst 17.2.8022/8.0.100 VS 17.10.34607.79, VS 17.9.34616.47
ios 17.2.8022/8.0.100 VS 17.10.34607.79, VS 17.9.34616.47
android 34.0.79/8.0.100 VS 17.10.34607.79, VS 17.9.34616.47
aspire 8.0.0-preview.3.24105.21/8.0.100 VS 17.10.34607.79

Steps to Reproduce

  1. Download maui-sample project (https://github.com/dotnet/maui-samples/tree/main/8.0/Navigation/FlyoutPageSample)
  2. Allow all possible orientations in the Android Activity by adding "ScreenOrientation = ScreenOrientation.FullSensor" in the MainActivity class
  3. Install and launch the app on a device or emulator
  4. Give the device/emulator a portrait or reverse portrait orientation and close the left navigation menu if it's already opened
  5. Reopen the left navigation menu (the page displayed on the right side must now have a semi transparent overlay)
  6. Turn the device in landscape or reverse landscape orientation
  7. The app crashes

Link to public reproduction project repository

https://github.com/dotnet/maui-samples/tree/main/8.0/Navigation/FlyoutPageSample

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android API 32, Android API 34...

Did you find any workaround?

No response

Relevant log output

[AndroidRuntime] Shutting down VM
[AndroidRuntime] FATAL EXCEPTION: main
[AndroidRuntime] Process: com.companyname.flyoutpagesample, PID: 13830
[AndroidRuntime] java.lang.ClassCastException: androidx.appcompat.widget.LinearLayoutCompat$LayoutParams cannot be cast to androidx.drawerlayout.widget.DrawerLayout$LayoutParams
[AndroidRuntime] 	at androidx.drawerlayout.widget.DrawerLayout.getDrawerViewAbsoluteGravity(DrawerLayout.java:991)
[AndroidRuntime] 	at androidx.drawerlayout.widget.DrawerLayout.checkDrawerViewAbsoluteGravity(DrawerLayout.java:996)
[AndroidRuntime] 	at androidx.drawerlayout.widget.DrawerLayout$ViewDragCallback.onViewPositionChanged(DrawerLayout.java:2292)
[AndroidRuntime] 	at androidx.customview.widget.ViewDragHelper.continueSettling(ViewDragHelper.java:779)
[AndroidRuntime] 	at androidx.drawerlayout.widget.DrawerLayout.computeScroll(DrawerLayout.java:1375)
[AndroidRuntime] 	at android.view.View.updateDisplayListIfDirty(View.java:21562)
[AndroidRuntime] 	at android.view.View.draw(View.java:22435)
[AndroidRuntime] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[AndroidRuntime] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[AndroidRuntime] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[AndroidRuntime] 	at android.view.View.draw(View.java:22435)
[AndroidRuntime] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[AndroidRuntime] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[AndroidRuntime] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[AndroidRuntime] 	at android.view.View.draw(View.java:22435)
[AndroidRuntime] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[AndroidRuntime] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[AndroidRuntime] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[AndroidRuntime] 	at android.view.View.draw(View.java:22435)
[AndroidRuntime] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[AndroidRuntime] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[AndroidRuntime] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[AndroidRuntime] 	at android.view.View.draw(View.java:22435)
[AndroidRuntime] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[AndroidRuntime] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[AndroidRuntime] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[AndroidRuntime] 	at android.view.View.draw(View.java:22435)
[AndroidRuntime] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[AndroidRuntime] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[AndroidRuntime] 	at android.view.View.draw(View.java:22707)
[AndroidRuntime] 	at com.android.internal.policy.DecorView.draw(DecorView.java:819)
[AndroidRuntime] 	at android.view.View.updateDisplayListIfDirty(View.java:21579)
[AndroidRuntime] 	at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:534)
[AndroidRuntime] 	at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:540)
[AndroidRuntime] 	at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:616)
[AndroidRuntime] 	at android.view.ViewRootImpl.draw(ViewRootImpl.java:4531)
[AndroidRuntime] 	at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4251)
[AndroidRuntime] 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3374)
[AndroidRuntime] 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2179)
[AndroidRuntime] 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8798)
[AndroidRuntime] 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
[AndroidRuntime] 	at android.view.Choreographer.doCallbacks(Choreographer.java:845)
[AndroidRuntime] 	at android.view.Choreographer.doFrame(Choreographer.java:780)
[AndroidRuntime] 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
[AndroidRuntime] 	at android.os.Handler.handleCallback(Handler.java:938)
[AndroidRuntime] 	at android.os.Handler.dispatchMessage(Handler.java:99)
[AndroidRuntime] 	at android.os.Looper.loopOnce(Looper.java:201)
[AndroidRuntime] 	at android.os.Looper.loop(Looper.java:288)
[AndroidRuntime] 	at android.app.ActivityThread.main(ActivityThread.java:7870)
[AndroidRuntime] 	at java.lang.reflect.Method.invoke(Native Method)
[AndroidRuntime] 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
[AndroidRuntime] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
**Java.Lang.ClassCastException:** 'androidx.appcompat.widget.LinearLayoutCompat$LayoutParams cannot be cast to androidx.drawerlayout.widget.DrawerLayout$LayoutParams'

[monodroid-assembly] Shared library 'liblog' not loaded, p/invoke '__android_log_print' may fail
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Java.Lang.ClassCastException: androidx.appcompat.widget.LinearLayoutCompat$LayoutParams cannot be cast to androidx.drawerlayout.widget.DrawerLayout$LayoutParams
[MonoDroid] 
[MonoDroid]   --- End of managed Java.Lang.ClassCastException stack trace ---
[MonoDroid] java.lang.ClassCastException: androidx.appcompat.widget.LinearLayoutCompat$LayoutParams cannot be cast to androidx.drawerlayout.widget.DrawerLayout$LayoutParams
[MonoDroid] 	at androidx.drawerlayout.widget.DrawerLayout.getDrawerViewAbsoluteGravity(DrawerLayout.java:991)
[MonoDroid] 	at androidx.drawerlayout.widget.DrawerLayout.checkDrawerViewAbsoluteGravity(DrawerLayout.java:996)
[MonoDroid] 	at androidx.drawerlayout.widget.DrawerLayout$ViewDragCallback.onViewPositionChanged(DrawerLayout.java:2292)
[MonoDroid] 	at androidx.customview.widget.ViewDragHelper.continueSettling(ViewDragHelper.java:779)
[MonoDroid] 	at androidx.drawerlayout.widget.DrawerLayout.computeScroll(DrawerLayout.java:1375)
[MonoDroid] 	at android.view.View.updateDisplayListIfDirty(View.java:21562)
[MonoDroid] 	at android.view.View.draw(View.java:22435)
[MonoDroid] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[MonoDroid] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[MonoDroid] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[MonoDroid] 	at android.view.View.draw(View.java:22435)
[MonoDroid] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[MonoDroid] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[MonoDroid] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[MonoDroid] 	at android.view.View.draw(View.java:22435)
[MonoDroid] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[MonoDroid] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[MonoDroid] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[MonoDroid] 	at android.view.View.draw(View.java:22435)
[MonoDroid] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[MonoDroid] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[MonoDroid] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[MonoDroid] 	at android.view.View.draw(View.java:22435)
[MonoDroid] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[MonoDroid] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[MonoDroid] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[MonoDroid] 	at android.view.View.draw(View.java:22435)
[MonoDroid] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[MonoDroid] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[MonoDroid] 	at android.view.View.draw(View.java:22707)
[MonoDroid] 	at com.android.internal.policy.DecorView.draw(DecorView.java:819)
[MonoDroid] 	at android.view.View.updateDisplayListIfDirty(View.java:21579)
[MonoDroid] 	at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:534)
[MonoDroid] 	at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:540)
[MonoDroid] 	at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:616)
[MonoDroid] 	at android.view.ViewRootImpl.draw(ViewRootImpl.java:4531)
[MonoDroid] 	at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4251)
[MonoDroid] 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3374)
[MonoDroid] 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2179)
[MonoDroid] 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8798)
[MonoDroid] 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
[MonoDroid] 	at android.view.Choreographer.doCallbacks(Choreographer.java:845)
[MonoDroid] 	at android.view.Choreographer.doFrame(Choreographer.java:780)
[MonoDroid] 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
[MonoDroid] 	at android.os.Handler.handleCallback(Handler.java:938)
[MonoDroid] 	at android.os.Handler.dispatchMessage(Handler.java:99)
[MonoDroid] 	at android.os.Looper.loopOnce(Looper.java:201)
[MonoDroid] 	at android.os.Looper.loop(Looper.java:288)
[MonoDroid] 	at android.app.ActivityThread.main(ActivityThread.java:7870)
[MonoDroid] 	at java.lang.reflect.Method.invoke(Native Method)
[MonoDroid] 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
[MonoDroid] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
[MonoDroid] 
[MonoDroid]   --- End of managed Java.Lang.ClassCastException stack trace ---
[MonoDroid] java.lang.ClassCastException: androidx.appcompat.widget.LinearLayoutCompat$LayoutParams cannot be cast to androidx.drawerlayout.widget.DrawerLayout$LayoutParams
[MonoDroid] 	at androidx.drawerlayout.widget.DrawerLayout.getDrawerViewAbsoluteGravity(DrawerLayout.java:991)
[MonoDroid] 	at androidx.drawerlayout.widget.DrawerLayout.checkDrawerViewAbsoluteGravity(DrawerLayout.java:996)
[MonoDroid] 	at androidx.drawerlayout.widget.DrawerLayout$ViewDragCallback.onViewPositionChanged(DrawerLayout.java:2292)
[MonoDroid] 	at androidx.customview.widget.ViewDragHelper.continueSettling(ViewDragHelper.java:779)
[MonoDroid] 	at androidx.drawerlayout.widget.DrawerLayout.computeScroll(DrawerLayout.java:1375)
[MonoDroid] 	at android.view.View.updateDisplayListIfDirty(View.java:21562)
[MonoDroid] 	at android.view.View.draw(View.java:22435)
[MonoDroid] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[MonoDroid] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[MonoDroid] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[MonoDroid] 	at android.view.View.draw(View.java:22435)
[MonoDroid] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[MonoDroid] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[MonoDroid] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[MonoDroid] 	at android.view.View.draw(View.java:22435)
[MonoDroid] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[MonoDroid] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[MonoDroid] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[MonoDroid] 	at android.view.View.draw(View.java:22435)
[MonoDroid] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[MonoDroid] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[MonoDroid] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[MonoDroid] 	at android.view.View.draw(View.java:22435)
[MonoDroid] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[MonoDroid] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[MonoDroid] 	at android.view.View.updateDisplayListIfDirty(View.java:21570)
[MonoDroid] 	at android.view.View.draw(View.java:22435)
[MonoDroid] 	at android.view.ViewGroup.drawChild(ViewGroup.java:4528)
[MonoDroid] 	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4289)
[MonoDroid] 	at android.view.View.draw(View.java:22707)
[MonoDroid] 	at com.android.internal.policy.DecorView.draw(DecorView.java:819)
[MonoDroid] 	at android.view.View.updateDisplayListIfDirty(View.java:21579)
[MonoDroid] 	at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:534)
[MonoDroid] 	at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:540)
[MonoDroid] 	at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:616)
[MonoDroid] 	at android.view.ViewRootImpl.draw(ViewRootImpl.java:4531)
[MonoDroid] 	at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4251)
[MonoDroid] 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3374)
[MonoDroid] 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2179)
[MonoDroid] 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8798)
[MonoDroid] 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
[MonoDroid] 	at android.view.Choreographer.doCallbacks(Choreographer.java:845)
[MonoDroid] 	at android.view.Choreographer.doFrame(Choreographer.java:780)
[MonoDroid] 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
[MonoDroid] 	at android.os.Handler.handleCallback(Handler.java:938)
[MonoDroid] 	at android.os.Handler.dispatchMessage(Handler.java:99)
[MonoDroid] 	at android.os.Looper.loopOnce(Looper.java:201)
[MonoDroid] 	at android.os.Looper.loop(Looper.java:288)
[MonoDroid] 	at android.app.ActivityThread.main(ActivityThread.java:7870)
[MonoDroid] 	at java.lang.reflect.Method.invoke(Native Method)
[MonoDroid] 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
[MonoDroid] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
@jfversluis
Copy link
Member

Hey there, thanks for the report! I have trouble reproducing this. I loaded the sample app, made the change you suggested and run it on a Pixel 5 emulator with API 33 and I can rotate and open and close the flyout as much as I want but nothing seems to happen. Is it specific to tablets? Is there anything else I'm missing?

@jfversluis jfversluis added the s/needs-info Issue needs more info from the author label Feb 27, 2024
@ghost
Copy link

ghost commented Feb 27, 2024

Hi @PratzelBoy. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@PratzelBoy
Copy link
Author

@jfversluis yes, it seems to be reproducible only on tablets. The emulator I used has this config.ini:

disk.dataPartition.size=6442450944
fastboot.chosenSnapshotFile=
fastboot.forceChosenSnapshotBoot=no
fastboot.forceColdBoot=no
fastboot.forceFastBoot=yes
hw.accelerometer=yes
hw.arc=no
hw.audioInput=yes
hw.battery=yes
hw.camera.back=virtualscene
hw.camera.front=emulated
hw.cpu.ncore=4
hw.dPad=no
hw.gps=no
hw.gpu.mode=auto
hw.initialOrientation=landscape
hw.keyboard=yes
hw.lcd.density=320
hw.lcd.height=1600
hw.lcd.width=2560
hw.mainKeys=no
hw.ramSize=2048
hw.sdCard=yes
hw.sensors.orientation=yes
hw.sensors.proximity=no
hw.trackBall=no
runtime.network.latency=none
runtime.network.speed=full
sdcard.size=512M
skin.dynamic=yes
skin.name=pixel_tablet
skin.path=[UNDISCLOSED]
vm.heapSize=192
AvdId=Pixel_Tablet_API_32
PlayStore.enabled=false
abi.type=x86_64
avd.ini.displayname=Pixel Tablet API 32
hw.cpu.arch=x86_64
hw.device.hash2=MD5:3eb16c85159ad6e1cbb3263194d1a735
hw.device.manufacturer=Google
hw.device.name=pixel_tablet
hw.gpu.enabled=yes
image.sysdir.1=system-images\android-32\google_apis\x86_64
showDeviceFrame=yes
tag.display=Google APIs
tag.id=google_apis

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Feb 27, 2024
@jfversluis
Copy link
Member

With a tablet I see it indeed, interesting!

Possibly related #18161

@jfversluis jfversluis removed the s/needs-attention Issue has more information and needs another look label Feb 27, 2024
@jfversluis jfversluis added this to the Backlog milestone Feb 27, 2024
@ghost
Copy link

ghost commented Feb 27, 2024

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@imuller
Copy link
Contributor

imuller commented May 15, 2024

Same here. This only happens when the FlyoutPage flyout is presented in portrait mode. When it's always open, for example in landscape mode or the flyout is closed, the app won't crash.

@jfversluis Is this something that can get priority? Because this prevents the use of the FlyoutPage on Android devices.

@jfversluis
Copy link
Member

@imuller unfortunately I'm not in charge of priorities, there is a lot involved to determine those. Unfortunately this didn't bubble up yet it seems. If this is really something that is blocking you you might consider giving us a hand an pull down the .NET MAUI repository and have a look yourself or even provide a PR!

@guyvaio
Copy link

guyvaio commented Jun 12, 2024

Another regression. MS should consider continuing support on Xamarin as long as such basic features do not work properly in MAUI.

@guyvaio
Copy link

guyvaio commented Aug 19, 2024

Not fixed. Please see #18161

@Brosten
Copy link

Brosten commented Sep 12, 2024

Why is this issue closed? I see no open issue addressing it. The crash is rather easy to reproduce with latest MAUI.
The workaround by @guyvaio sadly didn't fix it for us either..

@github-actions github-actions bot locked and limited conversation to collaborators Oct 13, 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.

8 participants