Repository navigation
Enable implicit xmlns declarations by default - #33834
Merged
Merged
Conversation
Contributor
Author
|
FYI @emaf @noiseonwires |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enables implicit xmlns declarations as a default feature in .NET 11, eliminating the need for standard namespace declarations in XAML files. The core change removes the preview feature requirement and updates all MAUI templates to demonstrate the new simpler XAML syntax.
Changes:
- Removes
[RequiresPreviewFeatures]attribute fromAllowImplicitXmlnsDeclarationAttributeto make it a standard feature - Updates source generator to always emit the assembly attribute (no longer conditional)
- Modernizes all MAUI templates to use simplified XAML without explicit xmlns declarations
- Improves test infrastructure with better diagnostic handling, Helix support for XAML unit tests, and Android device test filtering
- Updates build and CI pipelines for better efficiency and reliability
- Includes various quality improvements (localization updates, iOS bug fix, Gradle updates)
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/Controls/src/Core/AllowImplicitXmlnsDeclarationAttribute.cs |
Removes [RequiresPreviewFeatures] to make implicit xmlns a standard feature |
src/Controls/src/SourceGen/XamlGenerator.cs |
Always emits [assembly: AllowImplicitXmlnsDeclaration] without conditional compilation |
| Template XAML files (40+ files) | Removes explicit xmlns declarations, demonstrating new simplified syntax |
src/Controls/samples/Controls.Sample.Sandbox/MainPage.xaml |
Updates Sandbox to use implicit xmlns |
src/TestUtils/src/UITest.NUnit/UITestBase.cs |
Adds diagnostic file re-attachment for fixture setup failures in Azure DevOps |
src/Core/tests/DeviceTests.Shared/DeviceTestSharedHelpers.cs |
Adds Android support for TestFilter via instrumentation arguments |
src/Controls/tests/Xaml.UnitTests/MockSourceGenerator.cs |
Adds Helix correlation payload support for SourceGen DLL |
src/Controls/tests/Xaml.UnitTests/MSBuild/* |
Adds Helix support for MSBuild tests with conditional path resolution |
eng/helix.proj |
Adds XAML unit test projects and correlation payloads for Helix |
eng/Build.props |
Restructures build to support full solution vs pack-only builds |
eng/pipelines/* |
Updates CI pools, removes OS version constraints, fixes Xcode skip logic |
| Localization files | Updates Chinese, Turkish, Russian, and other language resources for binding/namescope errors |
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellItemRenderer.cs |
Fixes iOS 26+ disabled tab selection via drag gesture |
src/Core/AndroidNative/maui/build.gradle |
Updates to Android SDK 36 and Gradle 8+ base archivesName |
| Various test files | Replaces Thread.Sleep() and Task.Delay() with VerifyScreenshot(retryTimeout:) pattern |
| Documentation | Updates README, development tips, and workload README with clearer build instructions |
StephaneDelcroix
force-pushed
the
feature/implicit-xmlns-default
branch
from
February 2, 2026 21:52
9bb3866 to
b3daaf9
Compare
Member
|
/rebase |
github-actions
Bot
force-pushed
the
feature/implicit-xmlns-default
branch
from
February 3, 2026 19:09
b3daaf9 to
673e869
Compare
StephaneDelcroix
marked this pull request as draft
February 4, 2026 13:16
StephaneDelcroix
force-pushed
the
feature/implicit-xmlns-default
branch
2 times, most recently
from
February 5, 2026 07:59
f5f2c4b to
fb99e0e
Compare
StephaneDelcroix
marked this pull request as ready for review
February 5, 2026 08:00
StephaneDelcroix
force-pushed
the
feature/implicit-xmlns-default
branch
from
February 7, 2026 16:59
23c9af1 to
ca212c2
Compare
StephaneDelcroix
marked this pull request as draft
February 7, 2026 20:24
StephaneDelcroix
marked this pull request as ready for review
February 25, 2026 09:39
StephaneDelcroix
force-pushed
the
feature/implicit-xmlns-default
branch
from
February 27, 2026 15:20
9739bb6 to
cfc86c3
Compare
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 33834Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 33834" |
StephaneDelcroix
force-pushed
the
feature/implicit-xmlns-default
branch
from
March 3, 2026 16:50
cfc86c3 to
e3a08b0
Compare
Contributor
Author
|
/azp run maui-pr-devicetests, maui-pr-uitests |
|
Azure Pipelines successfully started running 2 pipeline(s). |
This was referenced Mar 4, 2026
- Remove [RequiresPreviewFeatures] from AllowImplicitXmlnsDeclarationAttribute - Always emit [assembly: AllowImplicitXmlnsDeclaration] in source generator - Update all templates to use implicit xmlns (remove xmlns= and xmlns:x= declarations) - Update Sandbox app MainPage.xaml XAML files can now omit the default xmlns and xmlns:x declarations as they are implicit.
StephaneDelcroix
force-pushed
the
feature/implicit-xmlns-default
branch
from
March 6, 2026 11:58
e4e4d28 to
532da44
Compare
…ored Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
simonrozsival
approved these changes
Mar 10, 2026
Contributor
Author
|
/azp run maui-pr-devicetests, maui-pr-uitests |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Contributor
Author
|
XLS support for this has been merged |
davidortinau
added a commit
to dotnet/docs-maui
that referenced
this pull request
Apr 10, 2026
In .NET 11 (PR dotnet/maui#33834), implicit xmlns declarations are enabled by default. The compiler automatically injects the standard MAUI and x: namespace declarations, so XAML files can omit them. Changes: - docs/xaml/namespaces/index.md: Add new 'Implicit namespace declarations' section with before/after examples, moniker-gated for .NET 11 (default) and .NET 10 (preview opt-in). - docs/xaml/fundamentals/get-started.md: Add .NET 11 note near xmlns explanation and split the implicit xmlns content into version- specific moniker blocks (.NET 11 default vs .NET 10 opt-in). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description
Starting with .NET 11, implicit xmlns declarations are enabled by default. XAML files no longer need to include the standard namespace declarations.
Changes
[RequiresPreviewFeatures]from AllowImplicitXmlnsDeclarationAttribute[assembly: AllowImplicitXmlnsDeclaration]in source generatorWhat's Implicit
The default implicit namespace is the global MAUI URI:
http://schemas.microsoft.com/dotnet/maui/globalxmlns:xprefix (via XmlnsPrefix attributes)Custom namespaces might require explicit declaration.