Repository navigation
fix: Emit bindings on controls that have a companion markup extension - #22138
Conversation
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22138/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-22138/docs/index.html |
|
|
|
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or it will be closed in 10 days. |
|
This PR was closed because it has been stalled for 10 days with no activity. |
When a control and a markup extension sharing the same base name exist in the
same namespace (e.g. FluentIcon + FluentIconExtension), the XAML generator
misdetected the control element as a markup extension. Markup-extension type
resolution tries the "Extension" suffix first, so the element <local:FluentIcon>
resolved to FluentIconExtension and binding-code generation on the control's
properties was suppressed.
The "Extension" suffix fallback is a markup-extension *usage* feature
({local:Foo} resolves to FooExtension) and must not apply when checking whether
an *element* is a markup extension. GetMarkupExtensionType now takes an
allowExtensionSuffix flag; the owner-element check in HasMarkupExtension passes
false, while every markup-extension usage site keeps the WinUI suffix-first
resolution unchanged so {local:Foo} still resolves to FooExtension.
Fixes #21992
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Kkyh8YiVNW2ACz3XgW1TfQ
16d43b2 to
6141e1f
Compare
|
/azp run |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-22138/wasm-skia-net9/index.html |
|
|
|
Tick the box to add this pull request to the merge queue (same as
|
GitHub Issue: closes #21992
PR Type
What is the current behavior? 🤔
When a control and a markup extension that share the same base name live in the same namespace (e.g.
FluentIcon+FluentIconExtension), the XAML source generator misdetects the control element as a markup extension.Markup-extension type resolution tries the
Extension-suffixed name first, so for<ic:FluentIcon …>the generator resolvedFluentIconExtension, concluded the element was a markup extension, and suppressed binding-code generation on the control's properties:This diverges from WinUI, where the
Extension-suffix lookup applies only to curly-brace markup-extension usage ({ic:FluentIcon …}), never to object-element syntax.What is the new behavior? 🚀
The
Extension-suffix fallback is now applied only in the context where it is valid.GetMarkupExtensionTypetakes anallowExtensionSuffixflag:HasMarkupExtensionpassesallowExtensionSuffix: false, so a control is no longer confused with its companion markup extension and bindings generate correctly.{local:Foo}still resolves toFooExtension.This matches the documented XAML rule: the
Extensionsuffix is a convenience of curly-brace markup-extension usage and is never appended for object-element syntax.Modified:
XamlFileGenerator.cs—GetMarkupExtensionType(and the namespace-resolution helpers) gained anallowExtensionSuffixparameter;HasMarkupExtension's owner check passesfalse.Added:
Given_MarkupExtension.TestControlAndCompanionExtensionInSameNamespace— a control + companionMyControlExtensionin one namespace, verifying that (a) element-syntaxx:Bindgenerates a binding and (b) brace-syntax{local:MyControl …}still resolves the markup extension. Verified to fail before the fix and pass after.PR Checklist ✅
Screenshots Compare Test Runresults — not applicable (no rendering change).Other information ℹ️
Backwards compatible — the change only affects the edge case where a control and a companion
…Extensionmarkup extension coexist in the same namespace. Standard markup-extension resolution ({local:Foo}→FooExtension) is unchanged.