xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

Root page not updating on backbutton pressed with more than one page on the stack (Android Only) #15740

Open sisaacks opened 1 year ago

sisaacks commented 1 year ago

Description

Data on the root page is not updating when you have more than one page on the stack and press the back button more than once.

Steps to Reproduce

I have registered routes in App.Xaml

Routing.RegisterRoute("Page1", typeof(Page1View));
Routing.RegisterRoute("Page2", typeof(Page2View));

Scenario 1 On the root page I call await Shell.Current.GoToAsync("/Page1", false); I make some changes save the data press the backbutton, reload the root page and all the data is updated, just as I would expect.

Scenario 2 On the root page I call await Shell.Current.GoToAsync("/Page1", false); I make some changes, save the data then I make this call: await Shell.Current.GoToAsync("/Page2", false); Now I press the back button and it takes me to Page1, then I press the back button again and it takes me to the root page. I reload the root page. But the data does not update. I have tried this on multiple Android devices.

I can put a break point on the collection...I can see that the data is indeed updated....but it does not update on the view. Again this only happens with two or more pages. This ONLY happening on Android.

UPDATE (5/11/23): I subscribed to the back button press using Shell in Xamarin. I added code, watched all the data update, but the UI did not update. I then added all the same code to a regular button and the code executed and the root page updated. IT seems to me there is an issue with the back button.

Expected Behavior

I would expect the view to update

Actual Behavior

The view is not updating

Basic Information

1.

Visual Studio: Help > About Microsoft Visual Studio 
Microsoft Visual Studio Professional 2022
Version 17.5.4
VisualStudio.17.Release/17.5.5+33627.172
Microsoft .NET Framework
Version 4.8.09032

Installed Version: Professional

Visual C++ 2022   00476-80000-00000-AA473
Microsoft Visual C++ 2022

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools   17.5.318.41597
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.5.318.41597
Azure App Service Tools v3.0.0

Azure Data Lake Tools for Visual Studio   2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   17.5.318.41597
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools   4.5.2-3.23171.7+d17f741546fad2786cbd6394d08619544e53a36d
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Cookiecutter   17.0.22336.2
Provides tools for finding, instantiating and customizing templates in cookiecutter format.

Extensibility Message Bus   1.4.3 (main@2a4517a)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft Azure Hive Query Language Service   2.6.5000.0
Language service for Hive query

Microsoft Azure Stream Analytics Language Service   2.6.5000.0
Language service for Azure Stream Analytics

Microsoft Azure Tools for Visual Studio   2.9
Support for Azure Cloud Services projects

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio   17.5.9 (11975e6)
Support for debugging Mono processes with Visual Studio.

Node.js Tools   1.5.50105.3 Commit Hash:882de61a7c99ae988d4c62029301292a3e0b1d56
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager   6.5.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Python - Profiling support   17.0.22336.2
Profiling support for Python projects.

Python with Pylance   17.0.22336.2
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Razor (ASP.NET Core)   17.5.2.2316603+9f1b6856460af1e592d387ebef416eadddac453f
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   17.2.40120.0
Microsoft SQL Server Data Tools

Syntax Visualizer   1.0
An extension for visualizing Roslyn SyntaxTrees.

Test Adapter for Boost.Test   1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test   1.0
Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   17.0.20105.2003
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.5.2-3.23171.7+d17f741546fad2786cbd6394d08619544e53a36d
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual C++ for Cross Platform Mobile Development (Android)   17.0.33312.129
Visual C++ for Cross Platform Mobile Development (Android)

Visual F# Tools   17.5.0-beta.23053.5+794b7c259d9646a7eb685dad865aa27da7940a21
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

VSPackage Extension   1.0
VSPackage Visual Studio Extension Detailed Info

Xamarin   17.5.0.173 (d17-5@33e727c)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   17.5.3.46 (remotes/origin/d17-5@e4dd80b2bb)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   17.5.41 (ba80d05)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   13.2.0.0 (d17-5/797e2e1)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: 6dd9def
    Java.Interop: xamarin/java.interop/main@149d70fe
    SQLite: xamarin/sqlite/3.40.0@fdc1e34
    Xamarin.Android Tools: xamarin/xamarin-android-tools/main@9f02d77

Xamarin.iOS and Xamarin.Mac SDK   16.2.0.5 (7738c90c9)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Build Logs

Screenshots

Reproduction Link

Workaround