Description
XAML Source Generator (XSG) does not correctly handle attributes placed directly on property element syntax (e.g., <TypeName.Property Attribute="value">).
This is invalid XAML syntax - property elements should contain child elements, not have attributes. The runtime inflator was incorrectly permissive and allowed it.
Decision
XSG should emit a clear error explaining this is invalid XAML syntax. We should not allow this.
Reproduction
<foldable:TwoPaneView x:Name="twoPaneView">
<foldable:TwoPaneView.Pane1
BackgroundColor="#dddddd">
<Frame BorderColor="Red">
<!-- content -->
</Frame>
</foldable:TwoPaneView.Pane1>
</foldable:TwoPaneView>
The BackgroundColor attribute on <foldable:TwoPaneView.Pane1> is invalid - attributes cannot be placed on property elements.
Expected Behavior
XSG should emit a clear error such as:
"Attributes are not allowed on property element 'TwoPaneView.Pane1'. Use child elements instead."
Affected File
src/Controls/samples/Controls.Sample/Pages/Others/TwoPaneViewPage.xaml
Workaround
Fix the XAML to use valid syntax (move BackgroundColor to the child element or use a different approach).
Context
Discovered while enabling XSG on more projects in #33524.
Description
XAML Source Generator (XSG) does not correctly handle attributes placed directly on property element syntax (e.g.,
<TypeName.Property Attribute="value">).This is invalid XAML syntax - property elements should contain child elements, not have attributes. The runtime inflator was incorrectly permissive and allowed it.
Decision
XSG should emit a clear error explaining this is invalid XAML syntax. We should not allow this.
Reproduction
The
BackgroundColorattribute on<foldable:TwoPaneView.Pane1>is invalid - attributes cannot be placed on property elements.Expected Behavior
XSG should emit a clear error such as:
Affected File
src/Controls/samples/Controls.Sample/Pages/Others/TwoPaneViewPage.xamlWorkaround
Fix the XAML to use valid syntax (move BackgroundColor to the child element or use a different approach).
Context
Discovered while enabling XSG on more projects in #33524.