Skip to content

Conversation

@StephaneDelcroix
Copy link
Contributor

Description of Change

while expanding markup nodes to element and value nodes, some line info weren't transferred. Fixing this produces better #line pragmas and VisualDiagnostics

Issues Fixed

Copilot AI review requested due to automatic review settings September 17, 2025 07:12
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 corrects line information transfer when expanding markup nodes to element and value nodes in XAML source generation. The fix ensures proper #line pragma generation and improves VisualDiagnostics accuracy by preserving line numbers and positions from the original XAML source.

Key changes:

  • Transfers XML line information when creating ValueNode instances during markup expansion
  • Updates ValueNode constructors to include line number and position parameters
  • Modernizes code patterns with primary constructors and pattern matching

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
ExpandMarkupsVisitor.cs Core implementation adding line info preservation during markup expansion and code modernization
SimplifyOnPlatform.cs Test case updated to verify correct line number (9) in generated #line pragma
SetBinding.cs Test case updated to verify correct line numbers (6) in generated code and VisualDiagnostics calls
CompiledBindings.cs Test case updated to verify correct line numbers (8) in generated code and VisualDiagnostics calls

@StephaneDelcroix StephaneDelcroix force-pushed the dev/stdelc/xsg/lineinfoOnMoarkups branch 2 times, most recently from c00c1b6 to 6f0b6d4 Compare September 17, 2025 09:30
@StephaneDelcroix StephaneDelcroix force-pushed the dev/stdelc/xsg/lineinfoOnMoarkups branch from 6f0b6d4 to e2300c1 Compare September 17, 2025 11:31
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

if (contextProvider != null)
{
contextProvider.Context.ReportDiagnostic(Diagnostic.Create(Descriptors.XamlParserError, LocationHelpers.LocationCreate(contextProvider.Context.ProjectItem.RelativePath!, xmlLineInfo!, match), xpe.Message));
return null!;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

don't ask what changed for that return null to be needed, I have no idea

@StephaneDelcroix StephaneDelcroix merged commit f1d786d into net10.0 Sep 17, 2025
149 checks passed
@StephaneDelcroix StephaneDelcroix deleted the dev/stdelc/xsg/lineinfoOnMoarkups branch September 17, 2025 19:25
@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 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.

3 participants