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

[droid]Frame content is not displayed on android after upgrading to version 5.5.32 #18728

Closed
DavidM29 opened this issue Nov 7, 2024 · 18 comments
Assignees
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working project/navigation-lifecycle 🧬 Categorizes an issue or PR as relevant to the navigation and lifecycle (NavigationView, AppBar, ...) triage/untriaged Indicates an issue requires triaging or verification

Comments

@DavidM29
Copy link

DavidM29 commented Nov 7, 2024

Current behavior

The frame content does not get displayed on android in the latest(5.5.32) version.

Expected behavior

Content should be displayed as it was displayed in the previous versions.

How to reproduce it (as minimally and precisely as possible)

Just add a frame on the page and put something in it, nothing gets displayed on android.
The repro:
UnoApp1.zip

Workaround

Have not found any workarounds.

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

Uno.Sdk UnoVersion UnoToolkitVersion Note
5.5.32 5.5.37 6.3.5 version that is failing
5.4.10 5.4.38 6.2.6 last known working version

Affected platforms

Android

IDE

Visual Studio 2022

IDE version

17.11.4

Relevant plugins

No response

Anything else we need to know?

No response

@DavidM29 DavidM29 added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Nov 7, 2024
@Xiaoy312 Xiaoy312 self-assigned this Nov 7, 2024
@DavidM29
Copy link
Author

DavidM29 commented Nov 7, 2024

@Xiaoy312 There are other problems(probably related to this) with frame in this version, I am not sure how to reproduce them yet. For example even after setting Frame Style to XamlDefaultFrame, pages are not displayed after navigation, it gets fixed sometimes by closing the app (leaving it open in the background) and opening it again, but not always. I suspect there is a problem with visual states, because a button did not correctly change its style after being enabled and the NavigationView pane was not displayed correctly (Both of these elements are in a frame). I am writing this to maybe help diagnose the issue and also because it is really difficult to work with android in this version if you are using Frame navigation, I had to revert back to 5.4.10 for the time being, but would really like to experience the performance improvements introduced in 5.5.

@Xiaoy312 Xiaoy312 added the project/navigation-lifecycle 🧬 Categorizes an issue or PR as relevant to the navigation and lifecycle (NavigationView, AppBar, ...) label Nov 8, 2024
@Xiaoy312 Xiaoy312 changed the title Frame content is not displayed on android after upgrading to version 5.5.32 [droid]Frame content is not displayed on android after upgrading to version 5.5.32 Nov 8, 2024
@Xiaoy312
Copy link
Contributor

Xiaoy312 commented Nov 8, 2024

So a bit of context first, for other that may join in, the sample repro that OP submitted contains two Frames:

  • One from App.xaml.cs, used for global navigation
  • One from MainPage.xaml, added by the user:
     <Frame>
     	<TextBlock Text="More Testing" />
     </Frame>

The toolkit library was also used here.
The user complained that upgrading Uno.Sdk from 5.4.10 to 5.5.32, caused that 2nd Frame to no longer render content.

Uno.Sdk UnoVersion UnoToolkitVersion
5.4.10 5.4.38 6.2.6
5.5.32 5.5.37 6.3.5

^edit: 5.4.10 still doesnt either

@Xiaoy312
Copy link
Contributor

Xiaoy312 commented Nov 8, 2024

@DavidM29
I've looked at the sample, you are using the native frame navigation which only supports page navigation, and does not support direct .Content manipulation.
So there are two mode here:

  • The native mode is enabled by default in the context of your app from having toolkit resources included, and it only supports navigation. Setting the Frame.Content will do nothing here, except for the first time when the Frame is loaded and the content is a Page. You are supposed to only navigate via Frame.Navigate(type) afterward.
  • The winui mode is not enabled by default here, which should work as you would expect on WinUI.

If you intention of "navigation" is purely just loading/rendering the content, and not perform a navigation with (forward/backward navigation capability), I would suggest you to just use a plain ContentControl as a host, instead of Frame.
But if you do requires the navigation with history, then I would suggest you to not set the Frame.Content directly, and instead only Frame.Navigation(type,...).

Does this help you?

@DavidM29
Copy link
Author

DavidM29 commented Nov 8, 2024

@Xiaoy312 Thanks for the explanation.
I used Frame.Content only for the sole purpose of reproducing the issue, I use the Frame for navigation (using Frame.Navigate(type)) in the app I am working on and that is where I encountered the issue.
The app which I am working on uses two Frames like the repro app, however when I last tested, not even the first Frame displayed its content. I can try to create a more detailed repro if you need.

@Xiaoy312
Copy link
Contributor

Xiaoy312 commented Nov 8, 2024

@Xiaoy312 There are other problems(probably related to this) with frame in this version, I am not sure how to reproduce them yet. For example even after setting Frame Style to XamlDefaultFrame, pages are not displayed after navigation, it gets fixed sometimes by closing the app (leaving it open in the background) and opening it again, but not always. I suspect there is a problem with visual states, because a button did not correctly change its style after being enabled and the NavigationView pane was not displayed correctly (Both of these elements are in a frame). I am writing this to maybe help diagnose the issue and also because it is really difficult to work with android in this version if you are using Frame navigation, I had to revert back to 5.4.10 for the time being, but would really like to experience the performance improvements introduced in 5.5.

For example even after setting Frame Style to XamlDefaultFrame, pages are not displayed after navigation, it gets fixed sometimes by closing the app (leaving it open in the background) and opening it again, but not always.

The problem you describe here, should happen only with native navigation, and not XamlDefaultFrame. You can confirm which mode is used by printing a tree-graph of the frame, and looking at the immediate child of said Frame, it should be either ContentPresenter (xaml) or NativeFramePresenter (native):

var tree = myNestedFrame.TreeGraph(); // using Uno.UI.Extensions;

Or, you can add another repro, with the exact setup for me to look at.

While I don't think "the visual states, a button, and the NavigationView" problem are related to the frame issue. But also, I can't really help here without a repro to investigate.

@DavidM29
Copy link
Author

DavidM29 commented Nov 8, 2024

I did not really have time to dive deeper about the "the visual states, a button, and the NavigationView" problem, so that could be unrelated, however those problems also got fixed by rollbacking to previous version.
I will look at what you said and will create a more detailed repro when I am able to.

@DavidM29
Copy link
Author

Hello @Xiaoy312,
So one thing I noticed is that after I changed Uno.Sdk to version 5.5.32 in global.json, Uno.Toolkit seems to have stayed on version 6.0.24, in the fresh uno app that I created for reproducing the issue, Uno.Toolkit is version 6.3.5. Could that be the issue? Is not Uno.Toolkit supposed to be upgraded when upgrading Uno.Sdk version?

I also tested the navigation I use(Frame inside another Frame) in the fresh uno app and did not encounter the problem I am encountering in the real app.

I will upgrade Uno.Toolkit manually and test, will update you on the results. also, I am not sure, do I need to manually upgrade some other packages as well?

@DavidM29
Copy link
Author

After checking with more detail, quite a few packages have not been upgraded to new version, is there a way to upgrade them all or do I have to do it manually? Also to note, most of the packages that have not been upgraded are transitive packages.

@jeromelaban
Copy link
Member

@DavidM29 if the packages have not been updated automatically, it would mean that there's a version override set somewhere. You can find the default versions of uno.sdk in its readme.

@DavidM29
Copy link
Author

@jeromelaban I have not set an override, to be honest I do not even know how to set one, where should I look for it?

@DavidM29
Copy link
Author

@jeromelaban Directory.Build.props looks like this:

<Project>
  <PropertyGroup>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>

    <!--
      Adding NoWarn to remove build warnings
      NU1507: Warning when there are multiple package sources when using CPM with no source mapping
      NETSDK1201: Warning that specifying RID won't create self containing app
      PRI257: Ignore default language (en) not being one of the included resources (eg en-us, en-uk)
    -->
    <NoWarn>$(NoWarn);NU1507;NETSDK1201;PRI257</NoWarn>
  </PropertyGroup>

  <!-- See https://aka.platform.uno/using-uno-sdk#implicit-packages for more information regarding the Implicit Packages version properties. -->
  <PropertyGroup>
    <UnoExtensionsVersion>4.1.24</UnoExtensionsVersion>
    <UnoToolkitVersion>6.0.24</UnoToolkitVersion>
    <UnoThemesVersion>5.0.13</UnoThemesVersion>
    <UnoCSharpMarkupVersion>5.2.14</UnoCSharpMarkupVersion>
  </PropertyGroup>
</Project>

Is this overriding the versions?

@DavidM29
Copy link
Author

Hello again, so, I have not been able to reproduce the issue yet, and I think a small video will better explain the situation I have. I will keep trying to reproduce the issue though.
Here is the video:
https://github.com/user-attachments/assets/59aa5daf-21e4-419e-b1fe-a31c0e89f29f

p.s. I did fix the problem with nuget versions, removed the implicit packages and everything got updated, those were not the problem though, because the issue still persists even after updating to Uno.Sdk 5.5.43

@Xiaoy312
Copy link
Contributor

this part pin the package versions to the specified ones:

  <PropertyGroup>
    <UnoExtensionsVersion>4.1.24</UnoExtensionsVersion>
    <UnoToolkitVersion>6.0.24</UnoToolkitVersion>
    <UnoThemesVersion>5.0.13</UnoThemesVersion>
    <UnoCSharpMarkupVersion>5.2.14</UnoCSharpMarkupVersion>
  </PropertyGroup>

you want to comment these lines out, if you dont want what is in global.json to be overridden

@DavidM29
Copy link
Author

this part pin the package versions to the specified ones:

  <PropertyGroup>
    <UnoExtensionsVersion>4.1.24</UnoExtensionsVersion>
    <UnoToolkitVersion>6.0.24</UnoToolkitVersion>
    <UnoThemesVersion>5.0.13</UnoThemesVersion>
    <UnoCSharpMarkupVersion>5.2.14</UnoCSharpMarkupVersion>
  </PropertyGroup>

you want to comment these lines out, if you dont want what is in global.json to be overridden

Yes I did, every package got updated, but the issue remains, I commented a small video of the issue here:

Hello again, so, I have not been able to reproduce the issue yet, and I think a small video will better explain the situation I have. I will keep trying to reproduce the issue though. Here is the video: https://github.com/user-attachments/assets/59aa5daf-21e4-419e-b1fe-a31c0e89f29f

p.s. I did fix the problem with nuget versions, removed the implicit packages and everything got updated, those were not the problem though, because the issue still persists even after updating to Uno.Sdk 5.5.43

I am working on creating a repro with no success so far...

@airtaxi
Copy link

airtaxi commented Nov 15, 2024

I had the exact same issue, but I managed to get it working. Here’s what I did:

I had to remove the following section:

<PropertyGroup>
    <UnoExtensionsVersion>4.1.14</UnoExtensionsVersion>
    <UnoToolkitVersion>6.0.18</UnoToolkitVersion>
    <UnoThemesVersion>5.0.13</UnoThemesVersion>
    <UnoCSharpMarkupVersion>5.2.13</UnoCSharpMarkupVersion>
</PropertyGroup>

Additionally, deleting the obj and bin folders fixed the problem. I tested it successfully on both net9.0-android and net8.0-android.

@DavidM29
Copy link
Author

Upgraded to Uno.Sdk 5.5.43 and .NET 9, deleted bin and obj folders, cleaned solution, built it and the issue described in the video above still persists, after splitting apps everything gets displayed normally.

@DavidM29
Copy link
Author

@Xiaoy312 After more testing I have discovered that the Frame is not the problem, it's NavigationView, I just removed the NavigationView control and left only the second Frame, everything got displayed as expected. I should probably create a new issue for this right?

@DavidM29
Copy link
Author

@Xiaoy312 I might be annoying you at this point, but I actually found the problem😅. I was calling navigation on second Frame instantly after navigating to the page(ShellPage) that contains the said second Frame, I moved the navigation call to the constructor of the ShellPage and now everything works.
This was the code:

navigationService.MainNavigateTo(typeof(ShellViewModel).FullName!); //Navigates to the shell page where the second frame is located
navigationService.ShellNavigateTo(typeof(HomeViewModel).FullName!); //Navigates the second frame to home page

I moved the second line to the constructor of the ShellPage and now it works, what I am not sure about is that, should this code have ever worked? and should it be working now, or not?

Nonetheless, my issue is fixed.
Thanks a lot for the help provided and sorry if some of my comments were not actually related to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working project/navigation-lifecycle 🧬 Categorizes an issue or PR as relevant to the navigation and lifecycle (NavigationView, AppBar, ...) triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

No branches or pull requests

4 participants