Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Bug] Xaml shouldn't support nested types, giving error instead #12455

@BretJohnson

Description

@BretJohnson

Description

Steps to Reproduce

  1. Use nested types in your XAML, like is done in https://github.com/microsoft/TailwindTraders-Mobile/blob/master/Source/TailwindTraders.Mobile/TailwindTraders.Mobile/Features/Product/Detail/ProductDetailPage.xaml with:
x:TypeArguments="local:ProductDetailViewModel, local:ProductDetailViewModel.State"
  1. Build and debug the app. Note that everything works.
  2. Make a change to the page using incremental Hot Reload. Note that you get the hot reload error (from the parser): Nested types are not supported: ProductDetailModel.State

Expected Behavior

Discussed with @StephaneDelcroix and he said that nested types aren't intended to be support with Xaml. They can produce parsing ambiguities, which is the exact same reason that they aren't supported in WPF/UWP.

So, after discussing, we decided that the proper fix here is to give an error message on the Forms side when nested types are used in XAML so that users remove them from their apps. That will avoid any errors from parsing ambiguities, avoids hot reload related errors (where they don't work), and makes Forms XAML more consistent with WPF/UWP. We believe that few apps use nested types, and those that do would thus have to remove them when upgrading to Forms 5.0.

See also https://devdiv.visualstudio.com/DevDiv/_queries/edit/1180608

Basic Information

  • Version with issue: all

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions