xamarin/Xamarin.Forms

[Bug] Shell - OnAppearing not executing

開放

#6,486 建立於 2019年6月11日

 (44 則留言) (10 個反應) (0 位負責人)C# (1,926 個分叉)batch import
a/shell :shell:e/2 :clock2:help wantedm/high impact :black_large_square:p/1t/bug :bug:up-for-grabs

倉庫指標

星標
 (5,644 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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

貢獻者指南