[XSG] Correct lineinfo for expanded markups#31641
Merged
StephaneDelcroix merged 1 commit intonet10.0from Sep 17, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 |
c00c1b6 to
6f0b6d4
Compare
6f0b6d4 to
e2300c1
Compare
| if (contextProvider != null) | ||
| { | ||
| contextProvider.Context.ReportDiagnostic(Diagnostic.Create(Descriptors.XamlParserError, LocationHelpers.LocationCreate(contextProvider.Context.ProjectItem.RelativePath!, xmlLineInfo!, match), xpe.Message)); | ||
| return null!; |
Contributor
Author
There was a problem hiding this comment.
don't ask what changed for that return null to be needed, I have no idea
simonrozsival
approved these changes
Sep 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
while expanding markup nodes to element and value nodes, some line info weren't transferred. Fixing this produces better
#linepragmas and VisualDiagnosticsIssues Fixed