-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Support XmlnsDefinitionAttribute in "this" assembly #28090
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
Conversation
aebf3a8 to
fb2ad0e
Compare
fb2ad0e to
9a0c875
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.
PR Overview
This PR implements support for XmlnsDefinitionAttribute in "this" assembly, addressing issue #28150.
- Added a new control and assembly attribute to enable XmlnsDefinitionAttribute support.
- Updated assembly resolution logic in ModuleDefinitionExtensions for improved matching.
- Refactored XmlnsDefinition attribute gathering in XmlTypeExtensions and updated the accessibility of GetXmlnsDefinition.
Reviewed Changes
| File | Description |
|---|---|
| src/Controls/tests/Xaml.UnitTests/Issues/MauiXmlnsDefControl.cs | Introduces a new control with an assembly-level XmlnsDefinition attribute for testing. |
| src/Controls/src/Build.Tasks/ModuleDefinitionExtensions.cs | Enhances assembly matching logic by checking both Name and FullName. |
| src/Controls/src/Build.Tasks/XmlTypeExtensions.cs | Refactors attribute gathering using a helper method and changes the accessibility of GetXmlnsDefinition. |
| src/Controls/tests/Xaml.UnitTests/Issues/MauiXmlnsDef.xaml.cs | Provides unit tests to validate the new XmlnsDefinition functionality. |
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
|
could you rebase on #28909 (when it's green) and un-draft it ? then it's probably good to be merged. Or do you want me to take over this ? |
| x:Class="Microsoft.Maui.Controls.Xaml.UnitTests.MauiXmlnsDef"> | ||
| <StackLayout> | ||
| <!-- Following control is available via default xmlns --> | ||
| <MauiXmlnsDefControl/> |
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.
the changes works for XamlC, but if you add a x:Name to this the code generator will fail. I'm looking at this
StephaneDelcroix
left a comment
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.
do not merge, have to check code behind support
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
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
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
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
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
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
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
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
* [X] implicit xmlns declarations Make the default xmlns implicitely pointing to maui default xmlns pre-load all available XmlsPrefixes for use the capability is disabled by default, and you need to opt-in - fixes #28849 - fixes #28850 - fixes #28847 * [X] global xmlns 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 * [X] Protect some xmlns protect maui and x: xmlns from overloading. - fixes #28836 * be less strict while checking for protected xmlns * fail on collision * fixing default assembly * load from current assembly * fix DataTemplate * fix BPConverter * [X] report diagnostice on ambiguous type * Update src/Controls/src/Build.Tasks/TypeReferenceExtensions.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/Controls/src/Build.Tasks/TypeReferenceExtensions.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Stale, not sure if this is still needed. Closing for now. |
Description of Change
Adding support for
XmlnsDefinitionAttributefrom "this" assemblyIssues Fixed
#28150