Skip to content

Tests: remove dedicated ListView coverage - #37995

Merged
kubaflo merged 611 commits into
dotnet:mainfrom
kubaflo:kubaflo-crispy-doodle
Sep 1, 2026
Merged

kubaflo merged 611 commits into
dotnet:mainfrom
kubaflo:kubaflo-crispy-doodle

Conversation

@kubaflo

@kubaflo kubaflo commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Root Cause

The dedicated ListView test bucket still included unit tests, device tests, issue-based UI tests, HostApp fixtures, and pipeline entries even though some of the remaining UI scenarios are really covering other features such as context actions, visibility, refresh, shadow, cells, custom renderers, images, and progress bars.

Description of Change

  • removed the dedicated ListView unit test file and Controls.DeviceTests/Elements/ListView coverage
  • removed dedicated UITestCategories.ListView issue tests plus their unreferenced HostApp fixtures and snapshot baselines
  • reclassified non-ListView-primary UI tests into their actual categories instead of deleting them
  • removed the ListView UI-test pipeline bucket and the now-unused UITestCategories.ListView / TestCategory.ListView constants
  • removed the stale iOS and Mac Catalyst Issue5503 app-delegate hook that became unreferenced once that HostApp page was deleted

Key Technical Details

Retained UI coverage was reclassified to these categories:

  • ContextActions
  • IsEnabled
  • CustomRenderers
  • Image
  • ProgressBar
  • ToolbarItem
  • Shadow
  • IsVisible
  • RefreshView
  • Cells

Issues Fixed

N/A

Validation

  • dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj
    • hits an existing locale-sensitive failure in BindingUnitTests.TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull (3.14 vs 3,14)
  • dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj --no-restore --filter "FullyQualifiedName!=Microsoft.Maui.Controls.Core.UnitTests.BindingUnitTests.TwoWayBindingToNullableDoublePropertyWithEmptyStringBecomesNull"
  • dotnet build Microsoft.Maui.BuildTasks.slnf
  • dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net11.0-ios -p:BuildIpa=false -p:RuntimeIdentifier=iossimulator-arm64
  • dotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -f net11.0-maccatalyst -p:RuntimeIdentifier=maccatalyst-arm64
  • dotnet build src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj
  • dotnet build src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj
  • dotnet build src/Controls/tests/TestCases.Mac.Tests/Controls.TestCases.Mac.Tests.csproj
  • dotnet build src/Controls/tests/TestCases.WinUI.Tests/Controls.TestCases.WinUI.Tests.csproj -p:EnableWindowsTargeting=true
  • dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -f net11.0-ios -p:BuildIpa=false -p:RuntimeIdentifier=iossimulator-arm64
  • dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -f net11.0-maccatalyst -p:RuntimeIdentifier=maccatalyst-arm64
  • python3 + yaml.safe_load parse of eng/pipelines/common/ui-tests.yml

Copilot AI and others added 30 commits July 29, 2026 00:29
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 66f84348-6476-4097-8b7f-f240338e85c3
…dotnet/dotnet, dotnet/macios (dotnet#36838)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

This pull request updates the .NET 11 Preview 7 dependency set from
dotnet/android, dotnet/macios, and the authoritative dotnet/dotnet VMR
build.

## Preview 7 dependency builds

| Repository | BAR build | Commit | Key versions |
|---|---:|---|---|
| dotnet/android | 324594 | `d7f90faae8e11b59d6be85902d01136643bc848b` |
Android SDK `37.0.0-preview.7.2129` |
| dotnet/macios | 324578 | `9f5d610822e4dc76ba3b786a1112bb7bd2fc5ba1` |
Apple SDKs `26.5.11991-net11-p7` |
| dotnet/dotnet | 324583 | `7bcb9009c40399c9073e7db938250486229cc85d` |
SDK `11.0.100-preview.7.26376.106`; runtime `11.0.0-preview.7.26376.106`
|

The dotnet/dotnet build is the blessed Preview 7 SDK/runtime build
identified by .NET Release Tracker. Its dependency flow also refreshes
the coherent Arcade SDK/toolset versions and generated `eng/common`
files.

[marker]: <> (Begin:Coherency Updates)
## Coherency Updates

The following updates ensure that dependencies with a
*CoherentParentDependency*
attribute were produced in a build used as input to the parent
dependency's build.
See [Dependency Description
Format](https://github.com/dotnet/arcade/blob/master/Documentation/DependencyDescriptionFormat.md#dependency-description-overview)

[DependencyUpdate]: <> (Begin)

- **Coherency Updates**:
- **Microsoft.MacCatalyst.Sdk.net10.0_26.5**: from 26.5.10309 to
26.5.10310 (parent: Microsoft.MacCatalyst.Sdk.net11.0_26.5)
- **Microsoft.macOS.Sdk.net10.0_26.5**: from 26.5.10309 to 26.5.10310
(parent: Microsoft.macOS.Sdk.net11.0_26.5)
- **Microsoft.iOS.Sdk.net10.0_26.5**: from 26.5.10309 to 26.5.10310
(parent: Microsoft.iOS.Sdk.net11.0_26.5)
- **Microsoft.tvOS.Sdk.net10.0_26.5**: from 26.5.10309 to 26.5.10310
(parent: Microsoft.tvOS.Sdk.net11.0_26.5)

[DependencyUpdate]: <> (End)

[marker]: <> (End:Coherency Updates)

[marker]: <> (Begin:75b5e9c4-324e-485e-a1b0-7ada74fcd89d)
## From https://github.com/dotnet/macios
- **Subscription**:
[75b5e9c4-324e-485e-a1b0-7ada74fcd89d](https://maestro.dot.net/subscriptions?search=75b5e9c4-324e-485e-a1b0-7ada74fcd89d)
- **Build**:
[20260723.14](https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=14747822)
([324578](https://maestro.dot.net/channel/9594/github:dotnet:macios/build/324578))
- **Date Produced**: July 27, 2026 4:45:16 PM UTC
- **Commit**:
[9f5d610822e4dc76ba3b786a1112bb7bd2fc5ba1](dotnet/macios@9f5d610)
- **Branch**:
[release/11.0.1xx-preview7](https://github.com/dotnet/macios/tree/release/11.0.1xx-preview7)

[DependencyUpdate]: <> (Begin)

- **Dependency Updates**:
  - From [26.5.11989-net11-p7 to 26.5.11991-net11-p7][1]
     - Microsoft.iOS.Sdk.net11.0_26.5
     - Microsoft.MacCatalyst.Sdk.net11.0_26.5
     - Microsoft.macOS.Sdk.net11.0_26.5
     - Microsoft.tvOS.Sdk.net11.0_26.5

[1]: dotnet/macios@a04ce3e...9f5d610

[DependencyUpdate]: <> (End)

[marker]: <> (End:75b5e9c4-324e-485e-a1b0-7ada74fcd89d)

[marker]: <> (Begin:c50a40ab-b403-4e1c-b662-e2372393610f)
## From https://github.com/dotnet/android
- **Subscription**:
[c50a40ab-b403-4e1c-b662-e2372393610f](https://maestro.dot.net/subscriptions?search=c50a40ab-b403-4e1c-b662-e2372393610f)
- **Build**:
[11.0.0-preview.7.26373.1+azdo.14747476](https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=14747476)
([324594](https://maestro.dot.net/channel/9594/github:dotnet:android/build/324594))
- **Date Produced**: July 27, 2026 5:41:51 PM UTC
- **Commit**:
[d7f90faae8e11b59d6be85902d01136643bc848b](dotnet/android@d7f90fa)
- **Branch**:
[release/11.0.1xx-preview7](https://github.com/dotnet/android/tree/release/11.0.1xx-preview7)

[DependencyUpdate]: <> (Begin)

- **Dependency Updates**:
  - From [37.0.0-ci.main.2139 to 37.0.0-preview.7.2129][2]
     - Microsoft.Android.Sdk.Windows

[2]: dotnet/android@2c84312...d7f90fa

[DependencyUpdate]: <> (End)

[marker]: <> (End:c50a40ab-b403-4e1c-b662-e2372393610f)

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2dc6fe17-a949-439b-beab-35156f158c76
Copilot-Session: 84e2cc34-f170-423f-bbba-bf23e780e86f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 66f84348-6476-4097-8b7f-f240338e85c3
…lution template (refs dotnet#36846) (dotnet#36855)

Workflow artifact: ci-fix
Artifact kind: fix
Refs: dotnet#36846
Target branch: net11.0
Attempt: 1/10



## Attempt 1 of 10

Remove the obsolete `app.UseWebAssemblyDebugging()` call (and its
companion `inspectUri` debug config) from the Blazor Web solution
template so the generated project builds clean on .NET 11.

## Root cause
The `maui-blazor-solution` template's `MauiApp.1.Web/Program.cs` and
`Program.Main.cs` emitted `app.UseWebAssemblyDebugging();` inside the
`#if (UseWebAssembly)` development block, and
`Properties/launchSettings.json` set the matching `inspectUri`.
`UseWebAssemblyDebugging()` is obsolete as of .NET 11 and surfaces as
build diagnostic **ASPDEPR011**, breaking `dotnet new` template builds
for WebAssembly configurations (repro builds 1528586 / 1528665).

## Fix
Removed the `UseWebAssemblyDebugging()` call from both `Program.cs` and
`Program.Main.cs`. Because WebAssembly no longer contributes any
development-only pipeline step, the guard is narrowed from `#if
(UseWebAssembly || IndividualLocalAuth)` to `#if (IndividualLocalAuth)`,
preserving the existing `UseMigrationsEndPoint()` behavior for the
Individual Local Auth configuration and the `else`/non-development
branch for all others. The obsolete `inspectUri` entries were removed
from both `http` and `https` launch profiles. This mirrors the
equivalent change in the ASP.NET Core .NET 11 Blazor Web templates.

## What is unverified / where I need help
- Full `dotnet new` template instantiation + build across every
parameter permutation (`UseWebAssembly` x `IndividualLocalAuth` x
http/https/LocalhostTld) was not run in this environment; CI template
integration tests should exercise these.
- Please confirm no remaining WebAssembly debugging affordance is
expected in the generated project for .NET 11.

## Validation
- Command: `not run because template instantiation/build is exercised by
CI integration tests, not locally available here`
- Result: not run

## Evidence
- Original failing builds (from tracking issue):
https://dev.azure.com/dnceng-public/public/_build/results?buildId=1528586
and
https://dev.azure.com/dnceng-public/public/_build/results?buildId=1528665

---
Filed by `ci-status-fix-net11`. This is the single PR for
dotnet#36846: the workflow watches its own CI and pushes up to **10
attempts on this same PR** (it never opens a second PR). It advances
only when the fix's own build settles red and that red is caused by the
fix. In round 1 a maintainer still needs to comment `/azp run maui-pr`
to exercise the new commit.




> [!WARNING]
> <details>
> <summary>Firewall blocked 1 domain</summary>
>
> The following domain was blocked by the firewall during workflow
execution:
>
> - `awmgmcpg`
>> To allow these domains, add them to the `network.allowed` list in
your workflow frontmatter:
>
> ```yaml
> network:
>   allowed:
>     - defaults
>     - "awmgmcpg"
> ```
>
> See [Network
Configuration](https://github.github.com/gh-aw/reference/network/) for
more information.
>
> </details>


> Generated by [CI Failure Fixer
(net11.0)](https://github.com/dotnet/maui/actions/runs/30318597385) ·
440.2 AIC · ⌖ 19.6 AIC · ⊞ 3.7K ·
[◷](https://github.com/search?q=repo%3Adotnet%2Fmaui+%22gh-aw-workflow-id%3A+ci-status-fix-net11%22&type=pullrequests)

<!-- gh-aw-agentic-workflow: CI Failure Fixer (net11.0), engine:
copilot, version: 1.0.71, model: claude-opus-4.8, id: 30318597385,
workflow_id: ci-status-fix-net11, run:
https://github.com/dotnet/maui/actions/runs/30318597385 -->

<!-- gh-aw-workflow-id: ci-status-fix-net11 -->
<!-- gh-aw-workflow-call-id: dotnet/maui/ci-status-fix-net11 -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dotnet#36900)

Description:
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

CollectionView UI tests on Windows were failing in CI because the
visual-regression snapshot baselines no longer matched the current
rendered output. This PR updates the snapshot images used by these tests
so they reflect the correct expected UI, resolving the CI failures.

**Changes:**
- Added new baseline snapshot
`windows-cv1/CollectionViewSelectedItemBackgroundLost.png`
- Added new baseline snapshot
`windows-cv1/ItemShouldbeScrolledbasedOnGroupHeader.png`
- Updated baseline snapshot
`windows/ItemShouldbeScrolledbasedOnGroupHeader.png`
- Updated baseline snapshot
`windows/VerifySelectionModeSingleWhenProgrammaticSelectionWorksWithVerticalList.png`

**Issue Fixed**
 Fixes dotnet#36810
…stic suppressions) (dotnet#36868)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description

Building `Controls.Xaml.UnitTests` locally in **Debug** currently fails
with 16 errors. These are stale diagnostic suppressions that only
surface in local/dev builds: `Directory.Build.props` defaults
`TreatWarningsAsErrors=true`, whereas CI overrides it to `false`
(`eng/pipelines/arcade/variables.yml`), so these warnings never broke CI
— only local builds.

Two independent stale suppressions:

- **MAUIX2017 — "property is being set multiple times" (5 negative-test
fixtures).** The duplicate implicit-content-property diagnostic was
renumbered `MAUIX2015` → `MAUIX2017` in the `main`→`net11.0` merge
(`1895265f9b`), but the fixtures that intentionally exercise this
scenario still suppressed the old number (`NoWarn="67;2015"`), and the
project still listed `MAUIX2015` in `WarningsNotAsErrors`. Updated both
to `MAUIX2017` for `Bz40906.xaml`, `Maui3059.xaml`, `Maui20616.xaml`,
`Maui20818.xaml`, and `TestSharedResourceDictionary.xaml`.
- **CS8632 — nullable annotations without a `#nullable` context
(`Issues/Maui34998.xaml.cs`).** The file uses `EventHandler?` /
`object?` but had no `#nullable` directive. Added `#nullable enable`.

### Verification

`Controls.Xaml.UnitTests` now builds and runs locally (net TFM, Debug):
**2039 passed, 8 skipped**.

> [!NOTE]
> Two unrelated tests (`TwoWayDecimalBinding_INPC`,
`TwoWayDecimalBinding_VMToUI`) fail on locales that use a comma decimal
separator (e.g. `fr-FR`) — `Expected: 25,75` vs `Actual: 2575`. That's a
pre-existing culture-sensitivity issue in those tests, out of scope for
this PR.

### Notes

- Test-project-only change; no product code and no public API changes.
- CI is unaffected (it already builds with
`TreatWarningsAsErrors=false`); this purely unblocks local Debug builds
of the project.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Skip remove/re-add metadata updates for built-in platform items that are already active, while retaining shared backend metadata correction. Add a regression test for Compile ordering.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 66f84348-6476-4097-8b7f-f240338e85c3
…tion (dotnet#36885)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Root cause

The .NET 11 lazy parent resource propagation path enumerates synthetic
`AppThemeBinding.AppThemeResource` keys through `GetMergedResourceKeys`,
but its on-demand `TryGetResource` lookup only searched resource
dictionaries. The synthetic key therefore remained unresolved and
dynamic resources could retain `AppTheme.Unspecified` when a parent was
assigned without an existing resource listener.

### Description of Change

Resolve `AppThemeBinding.AppThemeResource` directly from the
`Application` found in the element parent chain. This keeps the lazy
keys-only path consistent with full merged-resource snapshots and
preserves Application-wins semantics.

### Behavioral impact

App-theme dynamic resources now resolve to `Application.RequestedTheme`
when parent propagation occurs, including views that did not already
have a resource listener. Other resource lookup behavior is unchanged.

### Validation

-
`AppThemeTests.ParentSetResolvesAppThemeDynamicResourceWithoutListener`:
Debug 1/1 passed; Release 1/1 passed
- `DynamicResourceTests|ResourceDictionaryTests|AppThemeTests`: Debug
72/72 passed; Release 72/72 passed
- All runs targeted `net11.0` with platform target frameworks disabled
- `git diff --check` passed

### Issues Fixed

Fixes dotnet#36794

Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 84e2cc34-f170-423f-bbba-bf23e780e86f
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 66f84348-6476-4097-8b7f-f240338e85c3
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 66f84348-6476-4097-8b7f-f240338e85c3
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 66f84348-6476-4097-8b7f-f240338e85c3
Use one-hour future timestamps so slow integration builds cannot overtake invalidation sentinels and produce false failures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 66f84348-6476-4097-8b7f-f240338e85c3
…teComponent (dotnet#36833)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description

Makes the **XAML Incremental Hot Reload (XIHR)** source generator
deterministic and Edit-and-Continue (EnC) stable. This addresses
feedback that the generator produced non-deterministic output because it
carried mutable static state across generator runs (a monotonic
`__version` counter plus an accumulating patch chain in
`XamlHotReloadState`), which:

- left **stale/invalid patches** behind when an edit was reverted (e.g.
`Level2` → `Level22` → `Level2` kept the invalid `Level22` patch
forever, sometimes producing uncompilable code), and
- caused `UpdateComponent()` to **appear → disappear → reappear** across
generations, destabilizing Roslyn's EnC delta tracking (`MethodsAdded` /
`GetPreviousMethodHandle`).

### What changed

- **Content-hash `__version`.** `InitializeComponent` and
`UpdateComponent` now stamp `__version` with a stable, deterministic
FNV-1a hash of the current XAML content
(`GeneratorHelpers.StableContentHash`) instead of a monotonic counter.
The value is a pure function of the current content — identical XAML
always yields the same identity, and reverting an edit restores the
earlier identity. The counter never leaks into generated output.
- **Always-emit `UpdateComponent()` from the first generation.** The
method is now emitted on every generation (first compile, no-op edits,
unchanged rebuilds), so a XIHR type never gains or loses the method
across generations — the member-stability property Roslyn EnC requires.
Because patch property-sets are absolute, a single previous→current
patch brings any live instance to the current state regardless of the
edit it was last at, and a revert collapses to the earlier
patch/identity.
- **Inherited-XAML fix.** A XAML class deriving from another XAML class
emits its own `UpdateComponent()`, which hides the base's; the generated
file suppresses `CS0108` (the hiding is intentional — each level patches
its own tree). This was latent before (only surfaced on edit);
always-emit surfaces it at build time.
- **Removed dead mutable state.** Dropped the accumulating `PatchBodies`
chain and the now-unused `GetVersion` / `GetPatchBodies` /
`UpdateAndClearPatches` from `XamlHotReloadState` — that accumulation
was the mechanism behind the revert-leaves-stale-patch bug.

### Tests

All 462 `SourceGen.UnitTests` pass. New coverage:

- `ContentHash_IsDeterministic_And_RevertRestoresIdentity` — `__version`
is content-derived; a revert restores the earlier identity.
-
`RevertedGeneration_InitializeComponent_IsByteIdentical_ToInitialGeneration`
(property + structural edits) — `InitializeComponent` is
**byte-identical** whether V1 is generated cleanly or reached by
reverting V1→V2→V1.
- `PropertyRevert_AppliedViaHotReload_ReturnsToBaseline` — a **live
`MetadataUpdater.ApplyUpdate` V1→V2→V1**, asserting the instance
property returns to its baseline value at runtime (reverse transition).
- `UpdateComponent_OnInheritedXamlClass_CompilesWithoutHidingWarning` —
reproduces and locks the inherited-XAML `CS0108` fix.
- Existing pipeline/E2E tests updated for the content-hash / always-emit
design.

### Notes

- This is a source-generator-only change (`src/Controls/src/SourceGen`);
no public API changes.
- Empirically verified (via the byte-identical test) that node IDs are
already deterministic, so no `NodeIdHelper` rewrite was needed.


---

### Update — diagnostics classification (addressing @kirillkovch
feedback)

Making `UpdateComponent()` always-present broke Hot Reload
**diagnostics**: the SDK's "is this a XAML change?" signal was the mere
*presence* of `UpdateComponent()` on an updated type, so once it's
always present, **every** delta — even a pure C#/code-behind edit — was
reported to VS/VS Code XamlTools as an IXHR change (`HandledTypes.Count`
always > 0).

Rather than revert always-emit (which Tomas noted isn't mandatory), we
keep it (member stability / no EnC churn) and make the classifier
accurate:

- **SourceGen** emits a static, EnC-updating `internal static int
__XamlContentHash()` in `InitializeComponent` (same deterministic hash
as `__version`). A pure C# edit does not regenerate the XAML code, so
this method body — and its returned hash — is unchanged.
- **Runtime** (`XamlIncrementalHotReloadHandler`) now classifies a type
as a XAML change **iff its `__XamlContentHash()` changed** vs. the last
value observed (per-type cache; first-delta baseline recovered from a
live instance's stamped `__version`). Only changed types populate
`HandledTypes` and get dispatched; unchanged-content deltas →
`HandledTypes` empty → correctly non-XAML.

The `HotReloadDiagnostics` / `UpdateRequested` reflection contract
(consumed by XamlTools) is **shape-unchanged**; only the population of
`HandledTypes` is now precise. This is strictly more accurate than the
prior behavior — it also fixes the pre-existing misclassification where
editing the code-behind of a previously-XAML-edited page was reported as
a XAML change.

> [!NOTE]
> This changes the semantics of
`HotReloadDiagnostics.UpdateRequested.HandledTypes` (a reflection
contract consumed by the VS / VS Code "XamlTools" hot reload
diagnostics). The member shape/names are unchanged, but the VS-side team
should validate the more-precise `HandledTypes` population.

New tests: `UpdateApplication_ReportsXamlChange_ButNotUnchangedContent`
(drives the real handler through `ApplyUpdate`) and an extended
`ContentHash_IsDeterministic_And_RevertRestoresIdentity`.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…1.0) (dotnet#34519)

- [x] Merge origin/net11.0 into our branch
- [x] Remove the `_MauiFixTrimmerRootAssemblyMetadata` workaround target
from `Microsoft.Maui.Controls.targets`
- [x] Remove `RootMode="All"` from `TrimmerRootAssembly` items in
`AOTTemplateTest.cs`

<!-- START COPILOT CODING AGENT TIPS -->
---

🔒 GitHub Advanced Security automatically protects Copilot coding agent
pull requests. You can protect all pull requests by enabling Advanced
Security for your repositories. [Learn more about Advanced
Security.](https://gh.io/cca-advanced-security)

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
Co-authored-by: Sven Boemer <sbomer@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 66f84348-6476-4097-8b7f-f240338e85c3
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 66f84348-6476-4097-8b7f-f240338e85c3
…time (dotnet#36908)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

## Summary

- Replace the `26376.106` VMR SDK/runtime dependency set merged by
dotnet#36838 with the final release-designated Preview 7 `26378.106` build.
- Update all 35 dependencies originating from `dotnet/dotnet` to VMR BAR
324774.
- Keep Android at `37.0.0-preview.7.2129` and restore the four net11
Apple workload pins to `26.5.11991-net11-p7` from Apple BAR 324578.
- Preserve the net10 Apple `26.5.10310` pins, WiX `6.0.3-dotnet.4`, and
the merged AppTheme and Blazor fixes.

## Provenance

- **.NET Release Tracker:** SDK `11.0.100-preview.7.26378.106`; runtime
`11.0.0-preview.7.26378.106`; stage build `3033875` (`Staging Done`).
- **VMR BAR/Maestro:** BAR `324774`; build `20260728.6`; branch
`release/11.0.1xx-preview7`; commit
`ab4a9a5f25db0b29e980a7acfab46bc4eca924c3`; channel `.NET 11.0.1xx SDK
Preview 7`.
- **Apple BAR/Maestro:** BAR `324578`; build `20260723.14`; branch
`release/11.0.1xx-preview7`; package version `26.5.11991-net11-p7`;
commit `9f5d610822e4dc76ba3b786a1112bb7bd2fc5ba1`; channels `.NET 11
Workload Release` and `.NET 11.0.1xx SDK Preview 7`.
- **Android BAR/Maestro:** BAR `324594`; version
`37.0.0-preview.7.2129`; commit
`d7f90faae8e11b59d6be85902d01136643bc848b`; unchanged by this PR.
- Release Tracker designates the SDK/runtime versions. Android and Apple
component provenance comes from BAR/Maestro.

## Validation

- Darc read-only queries reconfirmed BAR 324774 and BAR 324578,
including repository, branch, commit, build number, and channels.
- `darc update-dependencies` applied both BAR builds; the generated
intermediate net10 Apple coherency rewrite was rejected so the existing
`26.5.10310` subscriptions remain unchanged.
- All 35 `dotnet/dotnet` dependencies exactly match BAR 324774 assets
and commit `ab4a9a5f...`.
- All four net11 Apple dependencies exactly match BAR 324578 assets and
commit `9f5d6108...`; all four net10 Apple dependencies remain
`26.5.10310` at `e9727264...`.
- Repository workload provisioning installed SDK/runtime `26378.106`,
Android `37.0.0-preview.7.2129`, and Apple `26.5.11991-net11-p7`. The
final iOS manifest requests net10 Apple `26.5.10310`, not unavailable
`26.5.10304`.
- `Controls.Build.Tasks` built with 0 warnings and 0 errors under
SDK/runtime `26378.106`.
- The actual binding project `src/Core/src/Core.csproj` built for
`net11.0-ios26.5` (`iossimulator-arm64`) with 0 warnings and 0 errors,
exercising `bgen.dll` through the project's `ObjcBindingApiDefinition`
items.
- XML and JSON parsing passed; `git diff --check` passed.
- `darc verify` still reports existing repository-wide
duplicate/casing/version issues for `TizenUIExtensions`,
`XUnitAnalyzers`, and `Microsoft.DotNet.XHarness.CLI`; none are changed
by this PR.

---------

Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 923e744a-f52b-46ce-939e-b6d27d4f5287
Copilot-Session: 312d5e3c-96fe-4f7b-ab8f-0b27e8656760
…tnet#36920)

I detected changes in the net11.0 branch which have not been merged yet
to release/11.0.1xx-preview7. I'm a robot and am configured to help you
automatically keep release/11.0.1xx-preview7 up to date, so I've opened
this PR.

This PR merges commits made on net11.0 by the following committers:

* Copilot
* StephaneDelcroix
* PureWeen
* NafeelaNazhir
* github-actions[bot]
* mattleibow
* devanathan-vaithiyanathan
* NirmalKumarYuvaraj
* Vignesh-SF3580

## Instructions for merging from UI

This PR will not be auto-merged. When pull request checks pass, complete
this PR by creating a merge commit, *not* a squash or rebase commit.

<img alt="merge button instructions"
src="https://i.imgur.com/GepcNJV.png" width="300" />

If this repo does not allow creating merge commits from the GitHub UI,
use command line instructions.

## Instructions for merging via command line

Run these commands to merge this pull request from the command line.

``` sh
git fetch
git checkout net11.0
git pull --ff-only
git checkout release/11.0.1xx-preview7
git pull --ff-only
git merge --no-ff net11.0

# If there are merge conflicts, resolve them and then run git merge --continue to complete the merge
# Pushing the changes to the PR branch will re-trigger PR validation.
git push https://github.com/dotnet/maui HEAD:merge/net11.0-to-release/11.0.1xx-preview7
```

<details>
<summary>or if you are using SSH</summary>

```
git push git@github.com:dotnet/maui HEAD:merge/net11.0-to-release/11.0.1xx-preview7
```

</details>


After PR checks are complete push the branch
```
git push
```

## Instructions for resolving conflicts

:warning: If there are merge conflicts, you will need to resolve them
manually before merging. You can do this [using GitHub][resolve-github]
or using the [command line][resolve-cli].

[resolve-github]:
https://help.github.com/articles/resolving-a-merge-conflict-on-github/
[resolve-cli]:
https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/

## Instructions for updating this pull request

Contributors to this repo have permission update this pull request by
pushing to the branch 'merge/net11.0-to-release/11.0.1xx-preview7'. This
can be done to resolve conflicts or make other changes to this pull
request before it is merged.
The provided examples assume that the remote is named 'origin'. If you
have a different remote name, please replace 'origin' with the name of
your remote.

```
git fetch
git checkout -b merge/net11.0-to-release/11.0.1xx-preview7 origin/release/11.0.1xx-preview7
git pull https://github.com/dotnet/maui merge/net11.0-to-release/11.0.1xx-preview7
(make changes)
git commit -m "Updated PR with my changes"
git push https://github.com/dotnet/maui HEAD:merge/net11.0-to-release/11.0.1xx-preview7
```

<details>
    <summary>or if you are using SSH</summary>

```
git fetch
git checkout -b merge/net11.0-to-release/11.0.1xx-preview7 origin/release/11.0.1xx-preview7
git pull git@github.com:dotnet/maui merge/net11.0-to-release/11.0.1xx-preview7
(make changes)
git commit -m "Updated PR with my changes"
git push git@github.com:dotnet/maui HEAD:merge/net11.0-to-release/11.0.1xx-preview7
```

</details>

Contact .NET Core Engineering (dotnet/dnceng) if you have questions or
issues.
Also, if this PR was generated incorrectly, help us fix it. See
https://github.com/dotnet/arcade/blob/main/.github/workflows/scripts/inter-branch-merge.ps1.

---------

Co-authored-by: NafeelaNazhir <nafeela.nazhirhussain@syncfusion.com>
Co-authored-by: Stephane Delcroix <stephane@delcroix.org>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Vignesh-SF3580 <102575140+Vignesh-SF3580@users.noreply.github.com>
Co-authored-by: NirmalKumarYuvaraj <97871636+NirmalKumarYuvaraj@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Shane Neuville <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
Co-authored-by: Sven Boemer <sbomer@gmail.com>
Copilot-Session: 78048f76-1e94-4d6a-b306-7d8c74ddea9f
Copilot-Session: 76c88205-cf28-4deb-bc55-75e9c2363eb8
Copilot-Session: c6ae0385-a806-4d6c-9725-dc102062c5c4
Copilot-Session: 8d49898c-b01b-411c-b02e-b82db45c9fa8
Copilot-Session: 546491d2-db16-496e-97fa-41cfe758db9b
Copilot-Session: 1f8d588b-4add-43c5-9c55-e943bef6ff3f
Copilot-Session: 84e2cc34-f170-423f-bbba-bf23e780e86f
I detected changes in the main branch which have not been merged yet to
net11.0. I'm a robot and am configured to help you automatically keep
net11.0 up to date, so I've opened this PR.

This PR merges commits made on main by the following committers:

* PureWeen

## Instructions for merging from UI

This PR will not be auto-merged. When pull request checks pass, complete
this PR by creating a merge commit, *not* a squash or rebase commit.

<img alt="merge button instructions"
src="https://i.imgur.com/GepcNJV.png" width="300" />

If this repo does not allow creating merge commits from the GitHub UI,
use command line instructions.

## Instructions for merging via command line

Run these commands to merge this pull request from the command line.

``` sh
git fetch
git checkout main
git pull --ff-only
git checkout net11.0
git pull --ff-only
git merge --no-ff main

# If there are merge conflicts, resolve them and then run git merge --continue to complete the merge
# Pushing the changes to the PR branch will re-trigger PR validation.
git push https://github.com/dotnet/maui HEAD:merge/main-to-net11.0
```

<details>
<summary>or if you are using SSH</summary>

```
git push git@github.com:dotnet/maui HEAD:merge/main-to-net11.0
```

</details>


After PR checks are complete push the branch
```
git push
```

## Instructions for resolving conflicts

:warning: If there are merge conflicts, you will need to resolve them
manually before merging. You can do this [using GitHub][resolve-github]
or using the [command line][resolve-cli].

[resolve-github]:
https://help.github.com/articles/resolving-a-merge-conflict-on-github/
[resolve-cli]:
https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/

## Instructions for updating this pull request

Contributors to this repo have permission update this pull request by
pushing to the branch 'merge/main-to-net11.0'. This can be done to
resolve conflicts or make other changes to this pull request before it
is merged.
The provided examples assume that the remote is named 'origin'. If you
have a different remote name, please replace 'origin' with the name of
your remote.

```
git fetch
git checkout -b merge/main-to-net11.0 origin/net11.0
git pull https://github.com/dotnet/maui merge/main-to-net11.0
(make changes)
git commit -m "Updated PR with my changes"
git push https://github.com/dotnet/maui HEAD:merge/main-to-net11.0
```

<details>
    <summary>or if you are using SSH</summary>

```
git fetch
git checkout -b merge/main-to-net11.0 origin/net11.0
git pull git@github.com:dotnet/maui merge/main-to-net11.0
(make changes)
git commit -m "Updated PR with my changes"
git push git@github.com:dotnet/maui HEAD:merge/main-to-net11.0
```

</details>

Contact .NET Core Engineering (dotnet/dnceng) if you have questions or
issues.
Also, if this PR was generated incorrectly, help us fix it. See
https://github.com/dotnet/arcade/blob/main/.github/workflows/scripts/inter-branch-merge.ps1.
Reset patterns:
- global.json
- NuGet.config
- eng/Version.Details.xml
- eng/Versions.props
- eng/common/*
Restore the central package version property required by the WinApp PackageReference retained in the net11.0 merge.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ec09bb21-cea8-420a-bb49-00c5c273a523
Reset patterns:
- global.json
- NuGet.config
- eng/Version.Details.xml
- eng/Versions.props
- eng/common/*
…Source AncestorType bindings (dotnet#36905)

> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Root Cause

The issue occurs because of a change that taught the XAML source
generator to compile RelativeSource AncestorType bindings at build time
instead of always relying on reflection. This introduced a build warning
(MAUIG2045) whenever a bound property could not be found on the declared
AncestorType .

This check is unsound because AncestorType matching in XAML is
polymorphic: at runtime, the framework walks up the visual tree and
accepts any ancestor whose type matches the declared type or a subclass
of it. A property missing on the declared type (e.g., ContentPage ) may
still be legitimately supplied by a derived class used at runtime (e.g.,
BasePage : ContentPage declaring SelectedItem ). Since the generator
checked only the declared type, it produced false positive warnings that
broke builds using TreatWarningsAsErrors=true .

### Description of Change

The fix narrows the diagnostic condition so MAUIG2045 fires only when
the declared AncestorType is sealed . A sealed type has no subclasses,
so a missing property there provably breaks the binding. For non-sealed
types, the compiler cannot rule out a derived ancestor supplying the
property, so the diagnostic is suppressed and the binding falls back to
reflection at runtime, the same safe fallback already used for
x:Reference bindings.

This is a minimal, one-line change to the diagnostic condition. It was
validated with a regression test reproducing the exact scenario (an
unsealed base page whose subclass supplies the bound property),
confirming the test fails without the fix and passes with it, while the
rest of the test suite is unaffected.

### Regression PR

PR dotnet#34408

Tested the behavior in the following platforms.
 
- [x] Android
- [x] Mac
- [x] iOS
- [x] Windows

### Issues Fixed

Fixes dotnet#36818

### Output

|Before Fix|After Fix|
|--|--|
<video
src="https://github.com/user-attachments/assets/b53cfaa0-40ca-46a1-b8e4-9d968ee013d0">
|<video
src="https://github.com/user-attachments/assets/2ac03219-e022-4115-a225-81cb44f487f6">|
…11 (dotnet#36932)

Description:
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

 ### Description of Change

CollectionView UI tests on Windows were failing in CI because the
visual-regression snapshot baselines no longer matched the current
rendered output. This PR updates the snapshot images used by these tests
so they reflect the correct expected UI, resolving the CI failures.

**Changes:**
- Updated baseline snapshot `windows/HeaderAndFooterShouldBeVisible.png`
- Updated baseline snapshot
`windows/CollectionViewSelectionShouldClear.png`

**Issue Fixed**
 Fixes dotnet#36810
…tnet#36923)

I detected changes in the net11.0 branch which have not been merged yet
to release/11.0.1xx-preview7. I'm a robot and am configured to help you
automatically keep release/11.0.1xx-preview7 up to date, so I've opened
this PR.

This PR merges commits made on net11.0 by the following committers:

* kubaflo
* Copilot
* StephaneDelcroix
* PureWeen
* NafeelaNazhir
* github-actions[bot]
* mattleibow
* devanathan-vaithiyanathan
* NirmalKumarYuvaraj
* Vignesh-SF3580

## Instructions for merging from UI

This PR will not be auto-merged. When pull request checks pass, complete
this PR by creating a merge commit, *not* a squash or rebase commit.

<img alt="merge button instructions"
src="https://i.imgur.com/GepcNJV.png" width="300" />

If this repo does not allow creating merge commits from the GitHub UI,
use command line instructions.

## Instructions for merging via command line

Run these commands to merge this pull request from the command line.

``` sh
git fetch
git checkout net11.0
git pull --ff-only
git checkout release/11.0.1xx-preview7
git pull --ff-only
git merge --no-ff net11.0

# If there are merge conflicts, resolve them and then run git merge --continue to complete the merge
# Pushing the changes to the PR branch will re-trigger PR validation.
git push https://github.com/dotnet/maui HEAD:merge/net11.0-to-release/11.0.1xx-preview7
```

<details>
<summary>or if you are using SSH</summary>

```
git push git@github.com:dotnet/maui HEAD:merge/net11.0-to-release/11.0.1xx-preview7
```

</details>


After PR checks are complete push the branch
```
git push
```

## Instructions for resolving conflicts

:warning: If there are merge conflicts, you will need to resolve them
manually before merging. You can do this [using GitHub][resolve-github]
or using the [command line][resolve-cli].

[resolve-github]:
https://help.github.com/articles/resolving-a-merge-conflict-on-github/
[resolve-cli]:
https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/

## Instructions for updating this pull request

Contributors to this repo have permission update this pull request by
pushing to the branch 'merge/net11.0-to-release/11.0.1xx-preview7'. This
can be done to resolve conflicts or make other changes to this pull
request before it is merged.
The provided examples assume that the remote is named 'origin'. If you
have a different remote name, please replace 'origin' with the name of
your remote.

```
git fetch
git checkout -b merge/net11.0-to-release/11.0.1xx-preview7 origin/release/11.0.1xx-preview7
git pull https://github.com/dotnet/maui merge/net11.0-to-release/11.0.1xx-preview7
(make changes)
git commit -m "Updated PR with my changes"
git push https://github.com/dotnet/maui HEAD:merge/net11.0-to-release/11.0.1xx-preview7
```

<details>
    <summary>or if you are using SSH</summary>

```
git fetch
git checkout -b merge/net11.0-to-release/11.0.1xx-preview7 origin/release/11.0.1xx-preview7
git pull git@github.com:dotnet/maui merge/net11.0-to-release/11.0.1xx-preview7
(make changes)
git commit -m "Updated PR with my changes"
git push git@github.com:dotnet/maui HEAD:merge/net11.0-to-release/11.0.1xx-preview7
```

</details>

Contact .NET Core Engineering (dotnet/dnceng) if you have questions or
issues.
Also, if this PR was generated incorrectly, help us fix it. See
https://github.com/dotnet/arcade/blob/main/.github/workflows/scripts/inter-branch-merge.ps1.
…on behavior (dotnet#30875)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Description of Change

Annotates the remaining .NET MAUI Controls type converters for nullable
reference types and updates the seven platform PublicAPI ledgers to
match their actual override contracts.

The review also uncovered and fixes several converter failure paths:

- `StrokeShapeTypeConverter`
  - Honors the culture supplied to direct `TypeConverter` calls.
  - Keeps XAML and XamlC numeric parsing invariant and exponent-aware.
- Makes XamlC emit a `RoundRectangle` for a numeric radius instead of
constructing a `Rectangle` and invoking a `RoundRectangle` setter on it.
- `FontAttributesConverter`
  - Produces comma-separated output that round-trips.
- Continues rejecting malformed comma tokens while treating
whitespace-only input as `FontAttributes.None`.
- `BindablePropertyConverter`
- Returns `null` rather than throwing a `NullReferenceException` for
unresolved direct-converter type names.
- Validates truncated VisualState parent chains and reports
`XamlParseException` with the most specific available diagnostic.
- Simplifies converter implementations without changing valid-input
mappings, including `TextAlignmentConverter`.

### Root Cause

Several converters still used nullable-oblivious override signatures.
While annotating them, tests exposed assumptions that were hidden by the
old implementation: build-time parsing depended on the build host's
culture, the compiled numeric `StrokeShape` fallback emitted the wrong
shape type, `FontAttributes` used a non-round-trippable separator, and
`BindableProperty` resolution indexed parent chains without checking
their length.

### Compatibility Notes

- Runtime XAML, CSS, and the current SourceGen fallback use invariant
conversion.
- Direct `TypeConverter.ConvertFrom(context, culture, value)` calls
honor the supplied culture.
- No public members are added or removed; the PublicAPI updates record
nullability annotations for existing overrides.

### What NOT to Do

- Do not use the build host's current culture when compiling numeric
XAML literals.
- Do not skip empty `FontAttributes` tokens; malformed comma-delimited
values must remain errors.
- Do not enable the optimized SourceGen `StrokeShapeConverter` until its
numeric `RoundRectangle` fallback is implemented.

### Validation

- `dotnet cake --target=dotnet-build --configuration=Release
--verbosity=normal`
- 60 focused Controls Core converter tests
- 24 focused XAML tests covering Runtime, XamlC, SourceGen fallback,
culture isolation, and VisualState parent-chain diagnostics

### Issues Fixed

No linked issue.

---------

Co-authored-by: Tamilarasan Paranthaman <93904422+Tamilarasan-Paranthaman@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a6db2315-d16d-4f19-94ec-2e5a7cbccda6
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
Reset patterns:
- global.json
- NuGet.config
- eng/Version.Details.xml
- eng/Versions.props
- eng/common/*
…tnet#36944)

I detected changes in the net11.0 branch which have not been merged yet
to release/11.0.1xx-preview7. I'm a robot and am configured to help you
automatically keep release/11.0.1xx-preview7 up to date, so I've opened
this PR.

This PR merges commits made on net11.0 by the following committers:

* NirmalKumarYuvaraj
* NafeelaNazhir
* BagavathiPerumal

## Instructions for merging from UI

This PR will not be auto-merged. When pull request checks pass, complete
this PR by creating a merge commit, *not* a squash or rebase commit.

<img alt="merge button instructions"
src="https://i.imgur.com/GepcNJV.png" width="300" />

If this repo does not allow creating merge commits from the GitHub UI,
use command line instructions.

## Instructions for merging via command line

Run these commands to merge this pull request from the command line.

``` sh
git fetch
git checkout net11.0
git pull --ff-only
git checkout release/11.0.1xx-preview7
git pull --ff-only
git merge --no-ff net11.0

# If there are merge conflicts, resolve them and then run git merge --continue to complete the merge
# Pushing the changes to the PR branch will re-trigger PR validation.
git push https://github.com/dotnet/maui HEAD:merge/net11.0-to-release/11.0.1xx-preview7
```

<details>
<summary>or if you are using SSH</summary>

```
git push git@github.com:dotnet/maui HEAD:merge/net11.0-to-release/11.0.1xx-preview7
```

</details>


After PR checks are complete push the branch
```
git push
```

## Instructions for resolving conflicts

:warning: If there are merge conflicts, you will need to resolve them
manually before merging. You can do this [using GitHub][resolve-github]
or using the [command line][resolve-cli].

[resolve-github]:
https://help.github.com/articles/resolving-a-merge-conflict-on-github/
[resolve-cli]:
https://help.github.com/articles/resolving-a-merge-conflict-using-the-command-line/

## Instructions for updating this pull request

Contributors to this repo have permission update this pull request by
pushing to the branch 'merge/net11.0-to-release/11.0.1xx-preview7'. This
can be done to resolve conflicts or make other changes to this pull
request before it is merged.
The provided examples assume that the remote is named 'origin'. If you
have a different remote name, please replace 'origin' with the name of
your remote.

```
git fetch
git checkout -b merge/net11.0-to-release/11.0.1xx-preview7 origin/release/11.0.1xx-preview7
git pull https://github.com/dotnet/maui merge/net11.0-to-release/11.0.1xx-preview7
(make changes)
git commit -m "Updated PR with my changes"
git push https://github.com/dotnet/maui HEAD:merge/net11.0-to-release/11.0.1xx-preview7
```

<details>
    <summary>or if you are using SSH</summary>

```
git fetch
git checkout -b merge/net11.0-to-release/11.0.1xx-preview7 origin/release/11.0.1xx-preview7
git pull git@github.com:dotnet/maui merge/net11.0-to-release/11.0.1xx-preview7
(make changes)
git commit -m "Updated PR with my changes"
git push git@github.com:dotnet/maui HEAD:merge/net11.0-to-release/11.0.1xx-preview7
```

</details>

Contact .NET Core Engineering (dotnet/dnceng) if you have questions or
issues.
Also, if this PR was generated incorrectly, help us fix it. See
https://github.com/dotnet/arcade/blob/main/.github/workflows/scripts/inter-branch-merge.ps1.
… failures on iOS, MacCatalyst, and Windows (dotnet#36938)

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->
### Issue Details
PR dotnet#35852 (revert of dotnet#32491) accidentally rolled back 3 test assertions
that PR dotnet#35626 had correctly updated — resetting "InvokeJavaScriptAsync
threw an exception:" back to "InvokeJavaScript threw an exception:",
while the handler still produced InvokeJavaScriptAsync.

### Description of Change

<!-- Enter description of the fix in this section -->
HybridWebViewTests_InvokeJavaScriptAsync.cs to match the exception
message format set by the handler in HybridWebViewHandler.cs.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes dotnet#36805
@kubaflo
kubaflo merged commit d2edf19 into dotnet:main Sep 1, 2026
137 of 153 checks passed
@github-actions github-actions Bot added this to the .NET 11.0-preview7 milestone Sep 1, 2026
kubaflo added a commit that referenced this pull request Sep 3, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

### Root Cause

PR #37995 was opened from a branch containing the `net11.0` branch
history. Although the PR targeted `main`, GitHub squashed all 100
commits in that branch into the merge commit, introducing changes across
3,272 files.

### Description of Change

- reverts the accidental `net11.0` payload from #37995
- preserves the intended dedicated ListView test cleanup from commit
`86ca3e5655`
- preserves legitimate `main` changes merged after #37995

### Validation

- compared the corrected tree with the parent of #37995; its 242 changed
paths exactly match the intended ListView cleanup plus the two
subsequent legitimate `main` commits
- confirmed no remaining `UITestCategories.ListView` or
`TestCategory.ListView` references
- parsed `eng/pipelines/common/ui-tests.yml` successfully

Copilot-Session: 3391bd85-62d2-4de0-84c7-5952156ea5bb
kubaflo added a commit that referenced this pull request Sep 4, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Sep 6, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Sep 7, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Sep 8, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Sep 9, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Sep 11, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Sep 15, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Sep 18, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Sep 21, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Sep 27, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Sep 27, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Oct 3, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Oct 3, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Oct 6, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Oct 6, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Oct 13, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Oct 13, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Oct 14, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Oct 14, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Oct 18, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Oct 18, 2026
### Description of Change

Reopened against `main` as requested in #38103.

`Element` stored a single `(key, specificity)` pair per
`BindableProperty`, so a
`{DynamicResource}`-valued `Setter` inside a `VisualState` **overwrote**
the registration a style
had installed when the state was entered (`OnSetDynamicResource`
replaces the entry when the
incoming specificity is greater or equal, and a full-VSM setter outranks
a style's), and
`Setter.UnApply` then removed the entry outright when the state was
left.

From that point `Element.OnResourcesChanged` never saw the property
again: the element stopped
following the resource for the rest of its lifetime, back in the default
state, with no way to
recover. A theme switch afterwards leaves it on whatever value happened
to be resolved at the
moment the state was entered.

`BindableObject.RemoveDynamicResource(BindableProperty,
SetterSpecificity)` already accepted a
specificity and discarded it, while its siblings
`RemoveBinding(property, specificity)` and
`ClearValue(property, specificity)` honour theirs.

This stores the registrations in `SetterSpecificityList<string>` — the
same structure `Values` and
`Bindings` already use — so each specificity keeps its own entry:

- entering a state adds the state's registration without disturbing the
style's;
- leaving it removes only that one and republishes the next one down, so
the property keeps
  tracking;
- `BindableContextAttributes.IsDynamicResource` is cleared only once the
last registration for the
  property is gone.

`SetterSpecificityList<T>` also gains `GetValueAt`/`GetSpecificityAt`,
because `Element` has to
enumerate every registered key, not just the effective one —
`GetMergedResources` and both
`OnResourcesChanged` overloads need all of them.

### Issues Fixed

Fixes #38069

### Tests


`DynamicResourceTests.VisualStateDynamicResourceDoesNotDestroyTheStylesRegistration`
walks the full
cycle on a `Button` whose style paints `BackgroundColor` from one
dynamic resource and whose
`Disabled` state paints it from another: enabled colour, disabled
colour, back to the enabled
colour, and then a change to the enabled resource must still reach the
element.

Without the change that last assertion fails — `Expected: Red, Actual:
Blue`, the element frozen on
the value resolved before the state was entered (verified by reverting
only the three product files
to `main` and re-running the test).

`Controls.Core.UnitTests` on this branch: **5645 passed, 30 skipped, 0
failed**.

The same change was verified against `release/10.0.1xx-sr10` in #38103
(5716 passed, 0 failed); the
two branches now carry the identical patch.

### Note on the force-push

This branch was originally written against `main` while it still carried
the accidental `net11.0`
payload from #37995, where `SetterSpecificityList<T>` is a struct.
#38155 reverted that payload, so
the branch has been rebuilt on top of current `main` (`c478f6b4`) with
the class-based version of
the patch — the same one that was validated on `release/10.0.1xx-sr10`.

---------

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.