xamarin/Xamarin.Forms

[Bug] Hot Reload & An element with the same key already exists in Namescope

开放

#8,398 创建于 2019年11月6日

 (7 条评论) (0 个反应) (0 位负责人)C# (1,926 个派生)batch import
a/Xaml </>e/5 :clock5:external-hotreloadhelp wantedinactivet/bug :bug:up-for-grabs

仓库指标

星标
 (5,644 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

Description

A File | New Xamarin Forms project with updates applied (as detailed below) causes an exception that breaks execution when CLR Exceptions are enabled

Steps to Reproduce

  1. File | New Xamarin Forms project

  2. Update the following in the csproj files:

    <PackageReference Include="Xamarin.Forms" Version="4.3.0.947036" />
    <PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" />
    <PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
  1. Added any element and give it a x:Name. The attached demo project has two buttons added.

  2. Enabled Hot Reload

  3. Run the application (emulator or physical device), modify the MainPage.xaml (such as the button text). Red squiggles appear under the Button elements with a tip indicating the error being reported. The application continues to run. See screen shots provided.

  4. Enable CLR exceptions and repeat step 5.

  5. An exception will be raised as provided in the attached screen shots. The application will continue to run but it interrupts debugging.

Expected Behavior

Hot Reload should reload the XAML without error.

Actual Behavior

When modifying a page with hot reload enabled an exception is raised (suppressed when CLR exceptions are not enabled)

Basic Information

  • Version with issue: Xamarin Forms 4.3.0.947036
  • Last known good version: Unknown
  • IDE: Visual Studio for Windows

Screenshots

Screen shots are included in the attached.

Reproduction Link

A demo application is attached. NamescopeError.zip

VS bug #1158393

贡献者指南