Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements support for implicit xmlns declarations by pre-loading available XmlnsPrefix attributes and updating various XAML parsing and code-behind generation routines. Key changes include:
- Adding implicit namespace support in XamlParser, XamlLoader, and related build tasks.
- Refactoring CodeBehindGenerator to incorporate new assembly cache information (including xmlns prefixes) and updated type signatures.
- Updating and adding test cases to verify the new implicit xmlns behavior.
Reviewed Changes
Copilot reviewed 11 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Controls/tests/Xaml.UnitTests/HRTests.cs | Adds a new SetUp method to reset Application.Current for test isolation. |
| src/Controls/tests/Xaml.UnitTests/GlobalXmlns.xaml.cs | Introduces tests for validating behavior when implicit xmlns declarations are used. |
| src/Controls/tests/SourceGen.UnitTests/SourceGenXamlTests.cs | Adds tests verifying global namespace handling and behavior when non-XAML is provided. |
| src/Controls/src/Xaml/XamlParser.cs | Adds GetXmlnsPrefixAttributes to return preloaded xmlns prefixes using new array initializer syntax. |
| src/Controls/src/Xaml/XamlParser.Namespaces.cs | Introduces DefaultImplicitUri to serve as the default implicit xmlns. |
| src/Controls/src/Xaml/XamlLoader.cs | Updates XmlNamespaceManager initialization to include the default implicit xmlns and additional prefixes. |
| src/Controls/src/SourceGen/CodeBehindGenerator.cs | Refactors methods (including ComputeXamlProjectItem and TryParseXaml) to support the new assembly caches and adjust type signatures accordingly. |
| src/Controls/src/Core/Properties/AssemblyInfo.cs | Adds an assembly attribute for the XAML 2009 namespace prefix. |
| src/Controls/src/Build.Tasks/* | Updates XAML parsing tasks to use module-specific xmlns prefix resolution. |
Files not reviewed (3)
- Microsoft.Maui-vscode.sln: Language not supported
- src/Controls/src/SourceGen/Controls.SourceGen.csproj: Language not supported
- src/Controls/tests/Xaml.UnitTests/GlobalXmlns.xaml: Language not supported
Comments suppressed due to low confidence (1)
src/Controls/src/SourceGen/CodeBehindGenerator.cs:142
- The variable 'text' is not defined in this scope. It appears that the content from the ProjectItem should be used instead, for example by referencing projectItem.Text.
using var reader = XmlReader.Create(new StringReader(text.ToString(),
fef2947 to
a146b52
Compare
69f2ad0 to
7ebd1fc
Compare
Contributor
Author
|
closing in favour of #29579 |
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
Make the default xmlns implicitely pointing to maui default xmlns pre-load all available XmlsPrefixes for use
Enable this feature by adding this into the .csproj
Issues Fixed