-
Notifications
You must be signed in to change notification settings - Fork 1.8k
XAML xmlns simplifications #29298
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
base: main
Are you sure you want to change the base?
XAML xmlns simplifications #29298
Conversation
protect maui and x: xmlns from overloading. - fixes #28836
Allow aggregating multiple xmlns into a single new global http://schemas.microsoft.com/dotnet/maui/global using XmlnsDefinition attribute, like this ```csharp [assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "http://schemas.microsoft.com/dotnet/2021/maui")] ``` the x: xmlns can not be aggregated, as it serves important purposes for the parsers this also brings #28090 to fix #28150 - fixes #28150 - fixes #28843 - closes #28090
for XLS support
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 simplifies and unifies the XAML XML namespace definitions across multiple target platforms by updating the XmlnsDefinitionAttribute constructor signature and adding support for implicit XMLNS declarations. Key changes include:
- Changing constructor parameters for XmlnsDefinitionAttribute from (string xmlNamespace, string clrNamespace) to (string xmlNamespace, string target) across PublicAPI files.
- Introducing a new AllowImplicitXmlnsDeclarationAttribute and updating related XAML parsing tasks.
- Adjustments to error messages and XML namespace management in build tasks.
Reviewed Changes
Copilot reviewed 39 out of 43 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/Controls/src/Core/PublicAPI/netstandard/PublicAPI.Shipped.txt | Updated XmlnsDefinitionAttribute signature. |
src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt | Added AllowImplicitXmlnsDeclarationAttribute and related members. |
src/Controls/src/Core/PublicAPI/net-windows/*.txt | Updated public API definitions to reflect the new signature and attribute. |
src/Controls/src/Core/PublicAPI/net-tizen/*.txt | Updated public API definitions uniformly for Tizen. |
src/Controls/src/Core/PublicAPI/net-maccatalyst/*.txt | Updated public API definitions uniformly for MacCatalyst. |
src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt | Updated iOS public API definitions. |
src/Controls/src/Core/PublicAPI/net-android/*.txt | Updated Android public API definitions. |
src/Controls/src/Core/Properties/AssemblyInfo.cs | Added a new XmlnsPrefix for xaml. |
src/Controls/src/Core/AllowImplicitXmlnsDeclarationAttribute.cs | Introduced new attribute for implicit XMLNS declarations. |
src/Controls/src/Build.Tasks/XmlTypeExtensions.cs | Adjusted XML namespace handling and error messaging. |
src/Controls/src/Build.Tasks/XamlTask.cs and XamlCTask.cs | Updated parsing logic to work with the new implicit XMLNS functionality. |
Files not reviewed (4)
- Microsoft.Maui-vscode.sln: Language not supported
- src/Controls/docs/Microsoft.Maui.Controls/XmlnsDefinitionAttribute.xml: Language not supported
- src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Shipped.txt: Language not supported
- src/Controls/src/Core/PublicAPI/net/PublicAPI.Shipped.txt: Language not supported
Comments suppressed due to low confidence (1)
src/Controls/src/Build.Tasks/XmlTypeExtensions.cs:51
- The error message contains a duplicated phrase ('Can't add assembly') which may confuse users. Consider removing the duplicate to clarify the message.
throw new BuildException(BuildExceptionCode.InvalidXaml, null, null, $"Protected Xmlns {attribute.XmlNamespace}. Can't add assembly Can't add assembly {attribute.Target}/{attribute.AssemblyName}.");
this is a merge of #28909, #28969, #29203 and #29181
it's probably easier to review independent PRs, but merging them is a nightmare