Skip to content

fix: Resolve duplicate materializedProvider local in ResourceDictionary - #23500

Merged
carldebilly merged 1 commit into
unoplatform:masterfrom
ajpinedam:dev/anpi/fix.skia.resourcedictionary-scope
Jun 18, 2026
Merged

carldebilly merged 1 commit into
unoplatform:masterfrom
ajpinedam:dev/anpi/fix.skia.resourcedictionary-scope

Conversation

@ajpinedam

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #23499

PR Type:

🐞 Bugfix

What changed? 🚀

Fixes a CS0136 build break in ResourceDictionary.cs that fails CI (and local master builds) for the Skia and Reference net10.0 targets:

src/Uno.UI/UI/Xaml/ResourceDictionary.cs(591,58): error CS0136: A local or parameter named 'materializedProvider' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter

This is a merge-time collision, not a defect in either change on its own. Two independently-merged PRs each introduced a pattern variable named materializedProvider:

  • fix(theming): resolve binding & resource ThemeResource against owner theme (84a8eadd1f) — if (value is IDependencyObjectStoreProvider materializedProvider ...) in the enclosing block scope, after the try/finally.
  • fix(alc): resources must not inherit DataContext from their host subtree (58a07c27d2) — else if (newValue is IDependencyObjectStoreProvider materializedProvider) inside the nested finally block.

A pattern variable in the enclosing block has scope spanning the rest of that block, so the inner-scope (finally) declaration collides with it even though it appears textually earlier. Each branch compiled cleanly in isolation; the conflict only surfaced once both landed on master.

This PR renames the finally-block occurrence to storeProvider. The two are independent casts to IDependencyObjectStoreProvider of different values (newValue vs value), so the rename is a pure scoping fix with no behavioral change.

PR Checklist ✅

  • 🧪 Added Runtime tests, UI tests, or a manual test sample (for bug fixes / features, if applicable) — N/A: compile-only fix, covered by the existing build; behavior unchanged.
  • 📚 Docs have been added/updated following the documentation template (for bug fixes / features) — N/A.
  • 🖼️ Validated PR Screenshots Compare Test Run results.
  • ❗ Contains NO breaking changes
  • 👀 Reviewed 2 other open pull requests (optional but appreciated!)

Copilot AI review requested due to automatic review settings June 18, 2026 18:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a CS0136 build break in ResourceDictionary.TryMaterializeLazy by eliminating a pattern-variable name collision introduced by merged changes, restoring successful compilation for Skia and Reference targets.

Changes:

  • Renamed the finally-block pattern variable from materializedProvider to storeProvider to avoid scope collision with the later materializedProvider declaration.
  • Kept behavior unchanged (same IDependencyObjectStoreProvider cast and IsResourceDictionaryItem assignment).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ajpinedam
ajpinedam enabled auto-merge June 18, 2026 18:52
@unodevops

Copy link
Copy Markdown
Contributor

@carldebilly
carldebilly disabled auto-merge June 18, 2026 19:51
@carldebilly
carldebilly merged commit 3f79b8a into unoplatform:master Jun 18, 2026
35 of 47 checks passed
jbourque-kahua added a commit to jbourque-kahua/uno that referenced this pull request Jun 18, 2026
The merge of upstream PR unoplatform#23500 (fix: Resolve duplicate materializedProvider local) left both the old 'materializedNewValueProvider' branch and the upstream 'storeProvider' branch in ResourceDictionary.cs, with broken closing-brace indentation that tripped IDE0055 in Analyze (csharp).

Co-authored-by: Copilot <[email protected]>
@agneszitte

Copy link
Copy Markdown
Member

@mergify backport release/stable/6.6

@mergify

mergify Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

backport release/stable/6.6

✅ Backports have been created

Details

Cherry-pick of bbea80b has failed:

On branch mergify/bp/release/stable/6.6/pr-23500
Your branch is up to date with 'origin/release/stable/6.6'.

You are currently cherry-picking commit bbea80b3e1.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   src/Uno.UI/UI/Xaml/ResourceDictionary.cs

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CS0136 build break in ResourceDictionary.cs: duplicate 'materializedProvider' local

6 participants