Skip to content

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

Closed

Description

@ajpinedam

Current behavior 🐛

CI builds (and local master builds) fail to compile Uno.UI for the Skia and Reference net10.0 targets with CS0136:

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 [Uno.UI.Skia.csproj::TargetFramework=net10.0]
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 [Uno.UI.Reference.csproj::TargetFramework=net10.0]

This is a merge-time regression, not a defect in either change on its own. Two independently-merged PRs each introduced a pattern variable named materializedProvider in ResourceDictionary.GetValueWithKeyOverride (or its lazy-materialization helper):

  • fix(theming): resolve binding & resource ThemeResource against owner theme (commit 84a8eadd1f) added 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 (commit 58a07c27d2) added 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 built cleanly in isolation; the conflict only surfaces once both are on master.

Expected behavior 🎯

Uno.UI compiles cleanly for all targets; CI is green.

How to reproduce it (as minimally and precisely as possible) 🔬

  1. Check out master (after both commits above were merged).
  2. Build the Skia or Reference target of Uno.UI, e.g. dotnet build src/Uno.UI-Skia-only.slnf.
  3. Compilation fails with the CS0136 errors above.

No app repro is required — this is a build break in the Uno source tree itself.

Workaround 🛠️

Rename one of the two materializedProvider pattern variables so the inner-scope and enclosing-scope names no longer collide (e.g. rename the finally-block occurrence to storeProvider). Both are independent casts to IDependencyObjectStoreProvider of different values (newValue vs value), so the rename is purely a scoping fix with no behavioral change.

Renderer 🎨

  • Skia

Affected platforms 📱💻🖥️

  • Build tasks (all Skia + Reference net10.0 consumers)

Anything else we need to know? 💬

Pure internal build break — affects contributors building from source / CI, not published packages. Fix PR incoming.

Activity

  1. added
    triage/untriaged
    on Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/untriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions