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 合并指标
 (30 天内没有已合并 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

贡献者指南