Support XmlnsDefinitionAttribute in "this" assembly#28090
Closed
Support XmlnsDefinitionAttribute in "this" assembly#28090
Conversation
aebf3a8 to
fb2ad0e
Compare
fb2ad0e to
9a0c875
Compare
Contributor
There was a problem hiding this comment.
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.
Contributor
|
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/> |
Contributor
There was a problem hiding this comment.
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
requested changes
Apr 11, 2025
Contributor
StephaneDelcroix
left a comment
There was a problem hiding this comment.
do not merge, have to check code behind support
StephaneDelcroix
added a commit
that referenced
this pull request
Apr 14, 2025
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
Closed
StephaneDelcroix
added a commit
that referenced
this pull request
Apr 24, 2025
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
StephaneDelcroix
added a commit
that referenced
this pull request
May 19, 2025
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
StephaneDelcroix
added a commit
that referenced
this pull request
May 19, 2025
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
StephaneDelcroix
added a commit
that referenced
this pull request
May 19, 2025
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
StephaneDelcroix
added a commit
that referenced
this pull request
May 19, 2025
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
StephaneDelcroix
added a commit
that referenced
this pull request
May 26, 2025
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
StephaneDelcroix
added a commit
that referenced
this pull request
Jun 4, 2025
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
rmarinho
pushed a commit
that referenced
this pull request
Jun 5, 2025
* [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>
Member
|
Stale, not sure if this is still needed. Closing for now. |
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
Adding support for
XmlnsDefinitionAttributefrom "this" assemblyIssues Fixed
#28150