Repository navigation
Conversation
WinUI only supports the `using:` xmlns form. Uno also accepted the WPF-style `clr-namespace:Ns;assembly=Asm` and silently stripped it, which let non-portable XAML build on Uno but fail on WinAppSDK. The declaration is now rejected outright — at build time with the new `UXAML0006` diagnostic, and at run time by `XamlReader` with a `XamlParseException`. Prefixes listed in the root `mc:Ignorable` stay exempt. Validation is deferred to the end of the parse because the reader yields namespace nodes before it reads `mc:Ignorable`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Two files actually used their `clr-namespace:` prefix — CalendarView theme resources (converted) and the markup-extension generation fixture (folded into the `local:` prefix, which already pointed at the same CLR namespace). The rest declared a prefix they never referenced. `themeresources_v2.xaml` is generated by FluentMerge.targets and is regenerated here, not hand-edited. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Generator tests assert `UXAML0006` for a used and an unused prefix, and that an `mc:Ignorable` prefix stays accepted. XamlReader tests cover the same three cases at run time. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Adds a XAML changes section to the 7.0 migration guide, documents `UXAML0006`, and drops the auto-codebehind claim that `clr-namespace:` root elements are supported. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The declaration collected from `VisitMember` (an xmlns declared on an element inside a member, e.g. a `DataTemplate`) had no coverage. It reports the attribute column exactly, unlike the root-element case. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-23928/docs/index.html |
|
The build 225135 found UI Test snapshots differences: Details
|
|
|
Collapsing the two-prefix loop left `Split(new[] { using: }, …)`, a
constant array argument that trips CA1861 under CI analyzers. `IndexOf`
plus `Substring` splits at the first occurrence just as `Split` with a
count of 2 did, and allocates nothing.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23928/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-23928/docs/index.html |
|
The build 225487 found UI Test snapshots differences: Details
|
|
|
GitHub Issue: closes #
PR Type:
🔄 Refactoring (no functional changes, no api changes)
What changed? 🚀
BC42 — remove the
clr-namespace:XAML leniency.WinUI/UWP only supports the
using:MyApp.Controlsxmlns form. Uno additionally accepted theWPF/Silverlight
clr-namespace:MyApp.Controls;assembly=MyLibform, silently stripping the prefixand the
;assembly=token before resolving types. That let non-portable XAML build on Uno and thenfail when the same markup was compiled for WinAppSDK.
The declaration is now rejected outright, with no deprecation cycle:
UXAML0006diagnostic, reported with the file and line of thedeclaration.
XamlReader.Load(and therefore Hot Reload) throws aXamlParseException.The only exemption is a prefix listed in
mc:Ignorableon the root element.Notable implementation details
clr-namespace:xmlns is invalidWinUI markup whether or not the prefix is referenced, and rejecting at the declaration gives an
actionable message from a single choke point per parser instead of threading diagnostic locations
through four resolution call sites.
NamespaceDeclarationnodes before it reads the element's
mc:Ignorableattribute, so declarations are collectedduring the visit and reported once the ignorable set is known.
through to
SearchWithFuzzyMatching, which can still resolve by simple name — and fuzzy matchingis enabled in
XamlGenerationTests. An explicit diagnostic is required.xmlns:android="clr-namespace:…").On the included platform
IsIncludedalready rewrites the URI to the presentation namespace,discarding the CLR namespace; on the excluded platform the elements are dropped. That markup never
did what its author intended, so the error is a true positive.
src/SourceGenerators/System.Xaml/is untouched. Itsclr-namespace:handling is alreadyunreachable on Uno's paths (both entry points construct
XamlSchemaContextwith an empty assemblylist, which gates
ResolveXamlTypeNameoff).Uno.Xaml.Testsstays green.using:. Only two files actually used the prefix; the rest declared one theynever referenced.
themeresources_v2.xamlis generated byFluentMerge.targetsand wasregenerated, not hand-edited.
Validation
Uno.UI-UnitTests-only.slnfSamplesApp.Skia.Generic(Debug + Release)Uno.Xaml.Tests(vendored parser)Uno.UI.SourceGenerators.TestsUXAML0006cases)Uno.UI.UnitTestsWindows_GlobalizationCalendar tests, unrelatedGiven_XamlReader, Skia DesktopFails-before / passes-after: with the two runtime files stashed and rebuilt, the two rejection
tests fail and the
mc:Ignorabletest still passes; with the change applied all three pass.Test coverage spans a used prefix, an unused prefix, an inline-scope declaration (xmlns on an element
inside a member, e.g. a
DataTemplate), and anmc:Ignorableprefix that must keep working.PR Checklist ✅
Screenshots Compare Test Runresults.Breaking change — impact and migration path
This is an intentional breaking change, part of the 7.0 breaking-change rollup (Phase 5), targeting
the
feature/breakingchangesbranch.Impact: any app or library whose XAML declares a
clr-namespace:xmlns now fails to build withUXAML0006, and fails at run time if the markup reachesXamlReader.Load. Unused declarations arerejected too.
Migration:
The assembly is inferred from the compilation, so the
;assembly=token has no replacement — dropit. Prefixes listed in
mc:Ignorableon the root element are unaffected.Documented in
doc/articles/migrating-to-uno-7.md(new XAML changes section plus a migrationchecklist step) and
doc/articles/uno-build-error-codes.md(UXAML0006).🤖 Generated with Claude Code