dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.25k stars 1.76k forks source link

[Windows][Bug] Shell shows as blank screen when returning from another page #23724

Open Felicity-R opened 4 months ago

Felicity-R commented 4 months ago

Description

After switching the app's MainPage from a Shell to another page, on returning to the Shell you get a blank white page on Windows. I tested iOS and Android as well but they don't have the issue; they are able to switch back and forth between the two pages multiple times without issue.

I tested in a few different Maui versions: 8.0.70, 8.0.10, and 8.0.3, all of which had the problem.

Steps to Reproduce

  1. Run the app in the linked demo repo.
  2. Click the button on the first page. This will set Application.Current.MainPage to a new page (no a shell).
  3. Click the 'return to shell' button in the new page. This will set Application.Current.MainPage back to the original Shell.

Expected result: You see the shell again. Actual result: On Windows, you just get a blank white screen.

Link to public reproduction project repository

https://github.com/Felicity-R/MainPageTests

Version with bug

8.0.70 SR7

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 10, OS 19043.2364

Did you find any workaround?

Not yet

Relevant log output

No response

github-actions[bot] commented 4 months ago

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.

Felicity-R commented 4 months ago

Found a workaround - putting this in the Shell will make it draw correctly:

    protected override void OnAppearing()
       {
           base.OnAppearing();

           ShellSection currentSection = Shell.Current.CurrentItem.CurrentItem;
           Shell.Current.CurrentItem.CurrentItem = null;
           Shell.Current.CurrentItem.CurrentItem = currentSection;
       }
RoiChen001 commented 4 months ago

I can repro this issue at Windows platform on the latest 17.11.0 Preview 4.0 (8.0.61&8.0.70).