Repository navigation
fix(databinding): reject bindable metadata resolved across ALC boundaries (backport #24096) - #26272
Conversation
…ries Generated bindable metadata providers match types by full name, so when the same assembly is loaded in a second AssemblyLoadContext (a host application previewing a secondary app), a lookup for the secondary context's type returns the host context's IBindableType. Its typed getters then throw InvalidCastException and controls binding such types (e.g. FeedView's FeedViewState) silently render blank. Validate the provider result against the requested type identity: IBindableType already carries its Type, so a mismatch now falls back to the reflection path instead of returning foreign metadata. (cherry picked from commit 3257675)
RunWithProvider swaps the static BindingPropertyHelper.BindableMetadataProvider and clears the binder caches, so concurrent execution with other tests touching that shared state could flake. [DoNotParallelize] pins the historical serial behavior explicitly instead of relying on it. (cherry picked from commit 2c4a2ed)
|
Claude finished @agneszitte's task in 3m 8s —— View job Code Review —
|
| Severity | Location | Finding |
|---|---|---|
| Nit | Given_Binder.MetadataProviderIdentity.cs:21 |
Missing [GitHubWorkItem("https://github.com/unoplatform/uno/issues/24095")] per unit-tests convention (inline comment) |
| Info (out of scope) | src/Uno.UI/DirectUI/PropertyAccess.cs:240 |
The HAS_UNO path still calls BindableMetadataProvider.GetBindableTypeByType directly — same cross-ALC risk, different code path (custom-property / x:Bind, not standard {Binding}). Likely not exercised by the FeedView repro but worth a follow-up. This file isn't in the PR diff so it was equally unfixed in the original #24096. |
Positive notes
[DoNotParallelize]is correctly applied to protect the globalBindableMetadataProviderstate during test runs.- The
StubMetadataProviderreturning a constant_resultregardless of the requestedTypecorrectly simulates the generated provider's by-full-name resolution behaviour. - Commit titles follow Conventional Commits (
fix(databinding):,test(databinding):). internal static GetValidatedBindableTypeis appropriately scoped and reachable from unit tests via the existingInternalsVisibleTodeclaration inAssemblyInfo.cs.
Code review assessment (by diff inspection). No local build or runtime execution performed.
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
GitHub Issue: related to #24095 and https://github.com/unoplatform/studio.live/issues/5628
PR Type:
🐞 Bugfix
What changed? 🚀
Backport of #24096 to
release/stable/6.7: its 2 commits, cherry-picked with-x(3257675, 2c4a2ed). No conflicts.Studio 3.3 ships on the 6.7 stables. There, Gallery samples that show their data in a
FeedViewrender blank pages (https://github.com/unoplatform/studio.live/issues/5628): Studio and the previewed app each load their ownUno.Extensions.Reactive.UI, so the app'sFeedViewStateresolves to Studio's generated binding metadata, whose getters then fail withInvalidCastException. With #24096, the binder only uses metadata built for the exact requested type, and falls back to reflection otherwise.BindingPropertyHelper.cs,BindablePropertyDescriptor.csandTypeActivator.csend up identical toservicing/6.8, which has had fix(databinding): reject bindable metadata resolved across ALC boundaries #24096 since August.DataContextis onFrameworkElementonly. Likeservicing/6.8, which doesn't have it either, 6.7 doesn't need it.Validation: Derek built
Uno.UIfrom the6.7.359tag with these commits and ran Studio 3.3 (desktop) on the FitApp repro: no more cast failures, and the data shows (results). WASM is still to be checked, with a 6.7 build that has this PR. TheGiven_Binder.MetadataProviderIdentityunit tests come with it.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code