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

ios Shell #22452

Open
Gekidoku opened this issue May 16, 2024 · 16 comments · Fixed by #24567
Open

ios Shell #22452

Gekidoku opened this issue May 16, 2024 · 16 comments · Fixed by #24567
Assignees
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout fixed-in-8.0.90 fixed-in-9.0.0-rc.2.24503.2 p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/iOS 🍎 potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-attention Issue has more information and needs another look t/bug Something isn't working

Comments

@Gekidoku
Copy link

Gekidoku commented May 16, 2024

Description

Im having a small issue with my Shell.
This used to work the way i have it right now. but since i installed .net 8.0.5 on my mac and the latest workload it stopped working.
In my function I set the mainpage like so

App.AppShell = new AppShellPlanning() { BackgroundColor = Colors.Black };
MainThread.BeginInvokeOnMainThread(async () =>
{
    await Task.Delay(100);
    App.Current.MainPage = App.AppShell;
});

The delay is there for an earlier issue, if didnt stick it in there it would crash sometimes back in ios 16.something.

Now when it executes with XCode 15.2 on an iphone simulator for 17.0 it gets to the last line and then logs this in the console

[TableView] Warning once only: UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. Make a symbolic breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy to catch this in the debugger and see what caused this to occur, so you can avoid this action altogether if possible, or defer it until the table view has been added to a window. Table view: <_UIMoreListTableView: 0x118af7e00; frame = (0 0; 0 0); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x600000cc3cc0>; backgroundColor = <UIDynamicSystemColor: 0x6000017cad00; name = tableBackgroundColor>; layer = <CALayer: 0x600000bc09e0>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}; dataSource: <UIMoreListController: 0x1077b4600>>

What is odd is that my shell only has this in it at the moment (stripped everything away to see what was causing it)

 public AppShellPlanning()
 {
     InitializeComponent();       
     Shell.SetTabBarIsVisible(this, false);
     var SplashPage = new FlyoutItem()
     {
         Title = "Dashboard",
         Icon = ImageSource.FromFile("Db.png"),

     };
     SplashPage.Items.Add(new ShellContent()
     {
         Route = "SplashPage",
         ContentTemplate = new DataTemplate(typeof(SplashPage)),
         
     });
    
     this.Items.Add(SplashPage);
}

If I change my mainpage code to just set a navigation page of Splashpage then it does work, but I need the shell navigation.

//This works but is not a solution
 MainThread.BeginInvokeOnMainThread(async () =>
 {
     await Task.Delay(100);
     App.Current.MainPage = new NavigationPage(new SplashPage()) { Style = Application.Current.Resources["MyNavPage"] as Style, };
 });

Using visual studio code on mac

Steps to Reproduce

No response

Link to public reproduction project repository

should throw the error on app launch

Version with bug

8.0.21 SR4.1

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS

Did you find any workaround?

No response

Relevant log output

No response

@Gekidoku Gekidoku added the t/bug Something isn't working label May 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.

@Gekidoku
Copy link
Author

Attempted to build for ios 17.2 same result.
also the same when i build for ios 17.4.

on android this works

@PureWeen PureWeen added the potential-regression This issue described a possible regression on a currently supported version., verification pending label May 17, 2024
@PureWeen PureWeen self-assigned this May 17, 2024
@PureWeen PureWeen added this to the .NET 8 SR6 milestone May 17, 2024
@Eilon Eilon added the area-controls-shell Shell Navigation, Routes, Tabs, Flyout label May 17, 2024
@RoiChen001 RoiChen001 added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels May 21, 2024
@RoiChen001
Copy link

Can repro this issue at iOS platform on the latest 17.10 Preview 7(8.0.20&8.0.21).

@PureWeen PureWeen modified the milestones: .NET 8 SR6, .NET 8 SR7 Jun 7, 2024
@PureWeen PureWeen added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Jun 15, 2024
@PureWeen PureWeen modified the milestones: .NET 8 SR7, .NET 8 SR8 Jun 15, 2024
@Gekidoku
Copy link
Author

What is the status for this issue?
Cant build on ios now and we have updates that are in our android app that our ios users also would like to have.

@Gekidoku
Copy link
Author

Update on my part,
now using .net SDK 8.0.302
Maui SDK 8.0.300
XCode 17.4

Same issue still

@PureWeen PureWeen modified the milestones: .NET 8 SR8, .NET 8 SR9 Jul 2, 2024
@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 3, 2024
@samhouts samhouts added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 10, 2024
@PureWeen
Copy link
Member

PureWeen commented Aug 9, 2024

@Gekidoku I'm not clear on your exact blocker here

This warning

[TableView] Warning once only: UITableView was told to layout its visible cells and other

Isn't a blocker and shouldn't break your app

@PureWeen PureWeen added the s/needs-info Issue needs more info from the author label Aug 9, 2024
@PureWeen PureWeen modified the milestones: .NET 8 SR9, Backlog Aug 9, 2024
@Gekidoku
Copy link
Author

Gekidoku commented Aug 10, 2024

I dont really have more info. Since the app stops with that being the last message in the console.
Going by earlier messages i see roi was able to repro it with my repro project.

The repro project worked in earlier versions of .net 8 as far as I see i made no big changes to it.

As its the weekend now and my code is at work i can't provide more info at this time. Monday I'll try another build and see if I can find more in the console.

@dotnet-policy-service dotnet-policy-service bot 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 Aug 10, 2024
@Gekidoku
Copy link
Author

Gekidoku commented Aug 12, 2024

Ok i have two screen recordings
One is of the app in the repro
other is of my actual app.
Unfocus App
Here i now see that the app launches and creates the flyout menu. however it freezes as soon as i select an item.
Only thing i changed is i added
UIBackgroundModes

fetch
remote-notification

to the info .plist

Here is the video of my actual app.
here
To reiterate, this app works on android. exactly the same. only difference is that i use VerticalStackLayouts on iOS and Android uses CollectionViews. because collectionviews were showing strange behavior on ios.
I cross tested this by using VerticalStackLayout on android as well but this worked just fine.
Also in previous versions of .net Maui this worked..

as you can see the last thing i see in the debug console is
2024-08-12 13:43:47.992633+0200 UnfocusTest[72938:42431714] [TableView] Warning once only: UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. Make a symbolic breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy to catch this in the debugger and see what caused this to occur, so you can avoid this action altogether if possible, or defer it until the table view has been added to a window. Table view: <_UIMoreListTableView: 0x10e593e00; frame = (0 0; 0 0); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x600000c6cc60>; backgroundColor = <UIDynamicSystemColor: 0x600001753b40; name = tableBackgroundColor>; layer = <CALayer: 0x60000065f200>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}; dataSource: <UIMoreListController: 0x10cf2a8c0>>
2024-08-12 13:43:48.002617+0200 UnfocusTest[72938:42431714] Simulator user has requested new graphics quality: 100

@Gekidoku
Copy link
Author

Gekidoku commented Aug 12, 2024

Note that if i change my project file in my unfocus app to be net7.0-ios;
then it does work.

However for my actual app this isnt a solution.
Since that would mean maining a .net8 version and a .net7 version.

and some libraries i use only have a .net8 version.

@Gekidoku
Copy link
Author

Gekidoku commented Oct 7, 2024

Seeing as the bot set this as done last month.
Is a workload version available with this fix in it?

@Gekidoku
Copy link
Author

@samhouts
Im still getting a freeze when setting an app shell. even if only has 1 dummy page as a child.

On my dummy app it does load the shell. but then as soon as you select an item it freezes.
https://github.com/Gekidoku/UnfocusTest <-- dummy app
If you run it on .net9 and press the switchmain button to switch to a shell page. and then select an item in the menu the whole app freezes. except for the setmainpage option which is a button that just changes the mainpage.
https://github.com/Gekidoku/UnfocusTest

@samhouts samhouts reopened this Oct 17, 2024
@github-project-automation github-project-automation bot moved this from Done to In Progress in MAUI SDK Ongoing Oct 17, 2024
@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Oct 17, 2024
@Gekidoku
Copy link
Author

Included is a screen recording from vscode using .net9 (it has the same issue as .net8)
In this example i switched to the new method of setting mainwindow. with overriding createwindow and setting application.current.window[0].page to switch it.

REC-20241018090328.mp4

@Gekidoku
Copy link
Author

Gekidoku commented Oct 18, 2024

Another comment yet again.
This time I took my actual app. but ripped out the entire contents of the AppShell i normally use and just put in a Dummy page that has a label with text as the first FlyoutItem.

Cant really share the entire app since it contains company data.
Also you'll see library security warnings. these are fixed by now and didnt make a difference.

screenrec.mp4

@Gekidoku
Copy link
Author

Gekidoku commented Oct 18, 2024

Having alot of fun here..
updated visual studio on my windows machine to 17.12.0 Preview 3. and now my android app gets stuck in a GC loop.....
Maybe this is also happening on the ios build but its just not send to the terminal.

@Gekidoku
Copy link
Author

Android gc loop is "fixed" by going back to

in the issue #25382 i linked my pages as i use them in my production app.

@Gekidoku
Copy link
Author

Allright we have progress.
I found the cause.
Hold your horses. its due to a style i have

 <Color x:Key="Primary">#28aadc</Color>
 <Color x:Key="PrimaryDarkText">White</Color>
 <Color x:Key="FlyoutColor">LightBlue</Color>
<Style x:Key="BaseStyle" TargetType="Element">
    <Setter Property="Shell.ForegroundColor" >
        <Setter.Value>
            <OnPlatform x:TypeArguments="Color">
                <On Platform="iOS" Value="White"/>
                <On Platform="Android" Value="Transparent"/>
            </OnPlatform>
        </Setter.Value>
    </Setter>
    <Setter Property="Shell.TitleColor" Value="White" />
    <Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
    <Setter Property="Shell.UnselectedColor" Value="Black" />
  
 
    <Setter Property="Shell.FlyoutBackground" Value="{AppThemeBinding Light={StaticResource PrimaryBackground},Dark={StaticResource PrimaryDarkBackground}}"/>
</Style>
<Style TargetType="FlyoutItem" BasedOn="{StaticResource BaseStyle}" />
<Style Class="FlyoutItemLabelStyle" TargetType="Label">
    <Setter Property="TextColor" Value="Black"></Setter>
</Style>
<Style Class="FlyoutItemLayoutStyle" TargetType="Layout" ApplyToDerivedTypes="True">
   
    <Setter Property="VisualStateManager.VisualStateGroups">
        <VisualStateGroupList>
            <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Normal">
                    <VisualState.Setters>
                        <Setter Property="Background" Value="Transparent" />
                        <Setter TargetName="FlyoutItemLabel" Property="Label.TextColor" Value="{StaticResource Primary}" />
                    </VisualState.Setters>
                </VisualState>
                <VisualState x:Name="Selected">
                    <VisualState.Setters>

                        <Setter Property="Background" Value="{StaticResource FlyoutColor}" />
                        <Setter TargetName="FlyoutItemLabel" Property="Label.TextColor" Value="{StaticResource PrimaryDarkText}" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateGroupList>
    </Setter>
</Style>

Removing this style causes the app to no longer freeze when setting the app shell as the main page.
Now im not quite sure which part of this style is causing this.
I've had this style since we switched to using Shell back in Xamarin

@PureWeen PureWeen removed their assignment Dec 10, 2024
@PureWeen PureWeen modified the milestones: Backlog, .NET 9 Servicing Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout fixed-in-8.0.90 fixed-in-9.0.0-rc.2.24503.2 p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint platform/iOS 🍎 potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

6 participants