Skip to content

fix: Resolve duplicate materializedProvider local in ResourceDictionary (backport #23500) - #23576

Closed
mergify[bot] wants to merge 1 commit into
release/stable/6.6from
mergify/bp/release/stable/6.6/pr-23500
Closed

mergify[bot] wants to merge 1 commit into
release/stable/6.6from
mergify/bp/release/stable/6.6/pr-23500

Conversation

@mergify

@mergify mergify Bot commented Jun 26, 2026

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!)

This is an automatic backport of pull request #23500 done by [Mergify](https://mergify.com).

(cherry picked from commit bbea80b)

# Conflicts:
#	src/Uno.UI/UI/Xaml/ResourceDictionary.cs
@mergify

mergify Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

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

@mergify mergify Bot added the conflicts Automated merge hit conflicts label Jun 26, 2026
@agneszitte

agneszitte commented Jun 26, 2026 •

Copy link
Copy Markdown
Member

@MartinZikmund, @ajpinedam

Heads up on this Mergify backport. @MartinZikmund you marked the initial PR as "planned" to be backported for the 6.6 release, but I think it may not be applicable to 6.6 and wanted your call before resolving.

Why the cherry-pick fails

The conflict on src/Uno.UI/UI/Xaml/ResourceDictionary.cs is a both modified, but the HEAD (6.6) side of the conflict is empty — the patch is trying to rename a local inside a code block that doesn't exist on 6.6.

#23500 only renames a local materializedProvider → storeProvider inside this branch:

else if (newValue is IDependencyObjectStoreProvider storeProvider)
{
    storeProvider.Store.IsResourceDictionaryItem = true;
}

Comparison with master

  • On master, that else if (newValue is IDependencyObjectStoreProvider …) branch exists, and materializedProvider appears twice in the method → the CS0136 duplicate-local that #23500 fixes.
  • On release/stable/6.6, that else if branch is absent entirely, and materializedProvider has zero occurrences in the file. There is no duplicate local, so nothing to fix.

Root cause

#23500 is a follow-up compile fix to #23413 (fix(alc): resources must not inherit DataContext from their host subtree), which introduced that IDependencyObjectStoreProvider branch. #23413 is not on 6.6 (no backport PR, no backport mergify command), so #23500 has no precursor to fix here.

Options

  1. Close this PR as not-applicable (my recommendation) — #23500 depends on #23413, which isn't backported to 6.6.
  2. If #23413 (the ALC DataContext fix) should land on 6.6:

What would you like to do?

@ajpinedam

Copy link
Copy Markdown
Contributor

@MartinZikmund, @ajpinedam

Heads up on this Mergify backport. @MartinZikmund you marked the initial PR as "planned" to be backported for the 6.6 release, but I think it may not be applicable to 6.6 and wanted your call before resolving.

Why the cherry-pick fails

The conflict on src/Uno.UI/UI/Xaml/ResourceDictionary.cs is a both modified, but the HEAD (6.6) side of the conflict is empty — the patch is trying to rename a local inside a code block that doesn't exist on 6.6.

#23500 only renames a local materializedProvider → storeProvider inside this branch:

else if (newValue is IDependencyObjectStoreProvider storeProvider)

{

    storeProvider.Store.IsResourceDictionaryItem = true;

}

Comparison with master

  • On master, that else if (newValue is IDependencyObjectStoreProvider …) branch exists, and materializedProvider appears twice in the method → the CS0136 duplicate-local that #23500 fixes.

  • On release/stable/6.6, that else if branch is absent entirely, and materializedProvider has zero occurrences in the file. There is no duplicate local, so nothing to fix.

Root cause

#23500 is a follow-up compile fix to #23413 (fix(alc): resources must not inherit DataContext from their host subtree), which introduced that IDependencyObjectStoreProvider branch. #23413 is not on 6.6 (no backport PR, no backport mergify command), so #23500 has no precursor to fix here.

Options

  1. Close this PR as not-applicable (my recommendation) — #23500 depends on #23413, which isn't backported to 6.6.

  2. If #23413 (the ALC DataContext fix) should land on 6.6:

What would you like to do?

Seeing this comment now. I believe option 1 is the best choice

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

Labels

conflicts Automated merge hit conflicts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants