xamarin/Xamarin.Forms

[Bug] Shell - OnAppearing not executing

Aperta

#6486 aperta il 11 giu 2019

 (44 commenti) (10 reazioni) (0 assegnatari)C# (1926 fork)batch import
a/shell :shell:e/2 :clock2:help wantedm/high impact :black_large_square:p/1t/bug :bug:up-for-grabs

Metriche repository

Star
 (5644 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Description

I have overrided the OnAppearing (and OnDisappearing) methods in the AppShell of a new project. The OnAppearing never seems to execute. Shell inherits from Page, so it should probably use OnAppearing. This would be nice for executing code that needs to be await'ed and cannot be in the constructor.

Steps to Reproduce

  1. Create a new Xamarin Forms Project and select the Shell template
  2. Open AppShell.xaml.cs
  3. Add an override for OnAppearing
  4. Add code in the OnAppearing to write to the Console
  5. Set breakpoint
  6. Run the project

Expected Behavior

The breakpoint should be hit or at least the Console WriteLine should be visible in the output window.

Actual Behavior

The breakpoint is never hit and the text does not show up in the output window.

Basic Information

  • Version with issue: 4.0.0.482894
  • Last known good version: N/A
  • IDE: Visual Studio 2019 for Windows 16.1.2
  • Platform Target Frameworks:
    • iOS: 12.10.0.153
    • Android: N/A
    • UWP: N/A
  • Android Support Library Version: N/A
  • Nuget Packages: Just what comes with the template
  • Affected Devices:

Screenshots

Reproduction Link

https://github.com/seansparkman/ShellNavigationExample/blob/master/ShellNavigationRegistration/ShellNavigationRegistration/AppShell.xaml.cs#L27

Also resolve the issue with OnNavigated not firing https://github.com/xamarin/xamarin.forms/issues/6486#issuecomment-540595443

Guida contributor