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

NavigationPage breaks after some navigation forth and back #20032

Closed
kraemernet opened this issue Jan 20, 2024 · 3 comments
Closed

NavigationPage breaks after some navigation forth and back #20032

kraemernet opened this issue Jan 20, 2024 · 3 comments
Labels
area-navigation NavigationPage migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 s/needs-info Issue needs more info from the author s/not-a-bug This isn't actually a bug, or is working as expected t/bug Something isn't working

Comments

@kraemernet
Copy link

kraemernet commented Jan 20, 2024

Description

NavigationPage breaks after some navigation forth and back.

Navigation_bug_maui.mp4

Steps to Reproduce

For my Git project:
Navigate to the settings subpage and back a couple of times, around 10-15 times.

Link to public reproduction project repository

https://github.com/kraemernet/MauiNavigationApp.git

Version with bug

8.0.6

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

Android 13.0 API 33

Did you find any workaround?

No response

Relevant log output

No response

@kraemernet kraemernet added the t/bug Something isn't working label Jan 20, 2024
@drasticactions
Copy link
Contributor

I couldn't reproduce your issue, but looking at your code...

https://github.com/kraemernet/MauiNavigationApp/blob/master/MauiApp/SettingsPage.xaml.cs#L9-L12

Instead of creating a new subpage every time you navigate, could you instead keep one instance of that page and navigate using that?

public partial class SettingsPage : ContentPage
{    public SettingsPage()
	{
        InitializeComponent();
        _settingsSubPage = new SettingsSubPage();
    }
    
    private SettingsSubPage _settingsSubPage;

    private void GoToSubPage_Clicked(object sender, EventArgs e)
    {
        Navigation.PushAsync(_settingsSubPage);
    }
}

@drasticactions drasticactions added the s/needs-info Issue needs more info from the author label Jan 21, 2024
@ghost
Copy link

ghost commented Jan 21, 2024

Hi @kraemernet. 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.

@kraemernet
Copy link
Author

kraemernet commented Jan 21, 2024

As I saw your answer, I recognized that there is an 'await' and 'async' missing. If I add them, it works for me.
I also recognized it has nothing to do with the FlyoutPage, so I edited the title in case someone finds this.

private void GoToSubPage_Clicked(object sender, EventArgs e)
{
  Navigation.PushAsync(new SettingsSubPage());
}

to

private async void GoToSubPage_Clicked(object sender, EventArgs e)
{
  await Navigation.PushAsync(new SettingsSubPage());
}

Thank you for your answer and your time.

@kraemernet kraemernet changed the title FlyoutPage + NavigationPage | Navigation stuck after some time NavigationPage breaks after some navigation forth and back Jan 21, 2024
@samhouts samhouts added area-navigation NavigationPage s/not-a-bug This isn't actually a bug, or is working as expected labels Jan 25, 2024
@samhouts samhouts added migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 labels Feb 1, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-navigation NavigationPage migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 s/needs-info Issue needs more info from the author s/not-a-bug This isn't actually a bug, or is working as expected t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants