-
Notifications
You must be signed in to change notification settings - Fork 823
Doc XAML gen error handling #21846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doc XAML gen error handling #21846
Conversation
There was a problem hiding this 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 XAML generation error handling by introducing a new XamlGenerationException type with location information, refactoring exception handling to provide better error messages to end users, and adding infrastructure to safely continue generation after recoverable errors.
Key changes:
- Introduces
XamlGenerationExceptionfor generation-time errors with location tracking - Adds
Safely()methods to handle errors gracefully during code generation - Improves error messages to be user-focused rather than implementation-focused
- Changes
XamlObjectDefinitionfrom class to record for immutability - Updates error message format in generated code from
#errorto// [ERROR]comments
Reviewed Changes
Copilot reviewed 12 out of 69 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
XamlGenerationException.cs |
New exception type implementing IXamlLocation for generation errors |
XamlFileGenerator.Errors.cs |
New file with error handling infrastructure including Safely() methods |
XamlParsingException.cs |
Updated to implement IXamlLocation, removed nullable properties |
IXamlLocation.cs |
Added FilePath property to interface |
XamlObjectDefinition.cs |
Changed to record, refactored constructors to require location info |
XamlMemberDefinition.cs |
Added FilePath property from owner |
XamlFileDefinition.cs |
Implements IXamlLocation |
XamlFileGenerator.cs |
Major refactoring to use new error handling, wrapped generation blocks with Safely() |
XamlFileGenerator.Reflection.cs |
Improved null-checking with pattern matching |
XamlCodeGeneration.cs |
Updated to handle collection of errors instead of single exception |
XamlFileParser.cs |
Updated constructor calls for XamlObjectDefinition |
| Test files | Updated expected error messages and diagnostic format |
Comments suppressed due to low confidence (1)
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs:1
- Using object initializer syntax
{ Type = _runXamlType }with a record'sinitproperty after construction is inconsistent with the immutability principle of records. Consider passing_runXamlTypethrough the constructor or creating a dedicated constructor for this scenario.
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlObjectDefinition.cs
Show resolved
Hide resolved
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs
Show resolved
Hide resolved
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs
Show resolved
Hide resolved
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs
Show resolved
Hide resolved
|
π€ Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21846/docs/index.html |
|
π€ Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21846/wasm-skia-net9/index.html |
|
|
b7d39d9 to
8645aae
Compare
There was a problem hiding this 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 1 out of 1 changed files in this pull request and generated 4 comments.
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Errors.cs
Outdated
Show resolved
Hide resolved
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Errors.cs
Outdated
Show resolved
Hide resolved
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Errors.cs
Outdated
Show resolved
Hide resolved
src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.Errors.cs
Outdated
Show resolved
Hide resolved
|
π€ Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21846/docs/index.html |
|
π€ Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21846/wasm-skia-net9/index.html |
|
The build 183530 found UI Test snapshots differences: Details
|
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this 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 1 out of 1 changed files in this pull request and generated no new comments.
|
π€ Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21846/docs/index.html |
|
π€ Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-21846/wasm-skia-net9/index.html |
|
|
|
The build 183652 found UI Test snapshots differences: Details
|
|
@Mergifyio backport release/stable/6.4 |
β Backports have been created
|
docs for #21837
π Documentation content changes
Doc XAML gen error handling
PR Checklist β
Screenshots Compare Test Runresults.