Skip to content

[Breaking change]: WPF throws MC3063 error for empty ColumnDefinitions or RowDefinitions #47743

@himgoyalmicro

Description

@himgoyalmicro

Description

Starting with .NET 10 Preview 5, WPF applications will fail to build if <Grid.ColumnDefinitions> or <Grid.RowDefinitions> are declared but left empty in XAML. This results in error MC3063, indicating that the property does not have a value.

Previously, such declarations were allowed and did not cause build failures. Although empty ColumnDefinitions or RowDefinitions have minimal impact on the UI—since WPF defaults to a single row and column—all child elements are placed in that single cell unless otherwise specified.

Version

.NET 10 Preview 5

Previous behavior

WPF applications with empty <Grid.ColumnDefinitions> or <Grid.RowDefinitions> compiled successfully, even though the layout definitions were incomplete.

Example:

<Grid>
  <Grid.ColumnDefinitions>
  </Grid.ColumnDefinitions>
</Grid>

New behavior

The same code now fails to compile with the following error:
Example:
error MC3063: Property 'ColumnDefinitions' does not have a value.

Type of breaking change

  • Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
  • Behavioral change: Existing binaries might behave differently at run time.

Reason for change

This change is a direct consequence of our efforts to support Grid XAML Shorthand Syntax (dotnet/wpf#9802). The PR that caused this change: dotnet/wpf#10866

Recommended action

Ensure that all <Grid.ColumnDefinitions> and <Grid.RowDefinitions> contains at least one valid or element.

Corrected example:

<Grid>
  <Grid.ColumnDefinitions>
    <ColumnDefinition />
  </Grid.ColumnDefinitions>
</Grid>

Feature area

Windows Presentation Foundation (WPF)

Affected APIs

No response


Associated WorkItem - 479055

Metadata

Metadata

Assignees

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.breaking-changeIndicates a .NET Core breaking change

Type

No type

Projects

Status

🔖 Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions