Skip to content

Conversation

@StephaneDelcroix
Copy link
Contributor

Description of Change

[XSG] report diagnostic if we can't Add

Copilot AI review requested due to automatic review settings September 3, 2025 08:55
@StephaneDelcroix StephaneDelcroix requested a review from a team as a code owner September 3, 2025 08:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves error reporting in the XAML Source Generator (XSG) by adding diagnostic reporting when content cannot be added to an element that lacks a ContentPropertyAttribute. The change aligns the source generator's error handling with the existing build tasks behavior.

Key Changes

  • Enhanced error diagnostics in the source generator to report when content cannot be set on elements without ContentPropertyAttribute
  • Updated unit tests to verify the new diagnostic reporting functionality
  • Cleaned up commented code and preprocessor directives

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Controls/src/SourceGen/Visitors/SetPropertiesVisitor.cs Added diagnostic reporting for missing ContentPropertyAttribute and removed commented legacy code
src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs Removed extraneous whitespace
src/Controls/tests/Xaml.UnitTests/Issues/Bz43694.rt.xaml.cs Updated test to verify diagnostic generation and removed preprocessor conditionals
src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj Removed commented MauiXamlEnableDiagnostics configuration
src/Controls/tests/SourceGen.UnitTests/InitializeComponent/SimplifyOnPlatform.cs Removed trailing whitespace

// throw new BuildException(BuildExceptionCode.ContentPropertyAttributeMissing, node, null, ((IElementNode)parentNode).XmlType.Name);
else
{
var location = LocationCreate(Context.ProjectItem.RelativePath!, (IXmlLineInfo)node, ((IElementNode)parentNode).XmlType.Name);
Copy link

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method LocationCreate is being called but it's not defined in this class or imported. This will cause a compilation error.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I challenge you on this one, copilot

@jfversluis jfversluis merged commit 2802fab into net10.0 Sep 3, 2025
126 of 149 checks passed
@jfversluis jfversluis deleted the dev/stdelc/xsg/diagOnAdd branch September 3, 2025 14:05
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants