Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
20e44ca
Fix ElementPool.CleanElement never releasing Control/Panel modifiers …
azchohfi Jul 31, 2026
fca7354
Merge origin/main into azchohfi-fix-elementpool-control-panel-resets
azchohfi Aug 1, 2026
bc1fdb4
Correct post-union receiver lists in three explanatory comments
azchohfi Aug 1, 2026
60fc43e
Assert the pool round-trip premise for both carriers in the Control+P…
azchohfi Aug 1, 2026
288aa24
Cover the three Panel clears that only the source scan could see
azchohfi Aug 1, 2026
ddb8b4b
Classify Grid's instance DPs as instance, not suppressed-attached
azchohfi Aug 1, 2026
5d78f70
Guard the StackPanel absence assertion this PR disarms
azchohfi Aug 1, 2026
afba278
Correct a false claim in the poolReset rationale comment
adqwdqw Aug 1, 2026
76e1daf
Derive the pool-clear obligation from the gate and the poolable set (…
adqwdqw Aug 1, 2026
4b8fadf
Select the pool-reset rule by receiver, not by property (#1051)
adqwdqw Aug 1, 2026
5795497
Address code-quality: filter the gate names explicitly
adqwdqw Aug 1, 2026
2ed8879
fix(analyzers): make REACTOR_POOL_001 receiver-aware via an exact-typ…
adqwdqw Aug 1, 2026
9a7e48d
docs(pool): document PoolableTypes as an exact-type set and name its …
adqwdqw Aug 1, 2026
0650a0f
docs(analyzers): correct two POOL_001 statements the receiver-aware f…
adqwdqw Aug 1, 2026
d26dcbd
docs(pool): name the analyzer mirror's real namespace, not its assemb…
adqwdqw Aug 1, 2026
1512176
test(pool): record which detector the poolable-receiver mutation isol…
adqwdqw Aug 1, 2026
48ec0b1
docs(analyzers): stop describing MOD_002 as the opposite of what it does
adqwdqw Aug 1, 2026
b2cd1bf
test(pool): correct three claims that the reflective guard is the vac…
adqwdqw Aug 1, 2026
8a818a1
test: derive the pool-reset obligation for ungated modifiers too
adqwdqw Aug 1, 2026
fe3ca67
Merge origin/main into azchohfi-fix-elementpool-control-panel-resets
adqwdqw Aug 1, 2026
a04d13f
Merge origin/main into azchohfi-fix-elementpool-control-panel-resets
adqwdqw Aug 1, 2026
40d81a6
Merge origin/main (#1004, #1011) into azchohfi-fix-elementpool-contro…
adqwdqw Aug 1, 2026
fd54089
Correct ElementPool comment claiming gate widening is unguarded (S13)
adqwdqw Aug 1, 2026
32d4b5d
Correct three claims about what the CleanElement region scanners guar…
adqwdqw Aug 1, 2026
89f2bdd
Refute the contravariant .Set-lambda misclassification by measurement
adqwdqw Aug 1, 2026
5e9f6c4
test: pin control identity before the two remaining fail-open absence…
Copilot Aug 2, 2026
ba8a2a9
docs: correct the MOD_002 fallback wording and name the attached shap…
Copilot Aug 2, 2026
804b1ae
Resolve the gate closure once instead of ContainsKey plus indexer
adqwdqw Aug 2, 2026
eeb8a78
Close the LIFO hole in the Issue950 StackPanel pool guard
adqwdqw Aug 2, 2026
4667fac
Merge origin/main (#1005, #1010) into azchohfi-fix-elementpool-contro…
adqwdqw Aug 3, 2026
983b5b7
Merge origin/main (#1018 and five others) into azchohfi-fix-elementpo…
adqwdqw Aug 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,59 @@ Conventions for contributors:

### Fixed

- **A pooled control no longer hands its previous renter's padding, background,
border or enabled state to the next one (issue #985).**
`Reconciler.ApplyModifiers` writes `Padding`, `CornerRadius`,
`BorderThickness`, `BorderBrush`, `Background` and `IsEnabled` onto `Control`,
`Border`, `Panel` and `StackPanel` receivers, but `ElementPool.CleanElement`
only ever reset the `Border` arm. On mount there is no previous element, so no
unset arm runs — a recycled `Button`, `ScrollViewer`, `Grid` or `VStack`
therefore started life carrying the *local* values the last renter had set, and
a local value outranks every `Style` setter in WinUI's dependency-property
precedence order. `Panel.Background` was the widest hole, since `VStack` /
`HStack` / `Grid` are all poolable. `CleanElement` now clears all six, in the
`FrameworkElement`-common region so the pool ⇄ analyzer consistency invariants
can see them. This is the pooling half of #952, whose fix corrected the *shape*
of the reset (`ClearValue` instead of assigning a default) but not its absence.
`TextBlock.Padding` — reset since #950, but from a case arm past the point the
scanners stop reading — moved into the same region, so all four of the
receivers `ApplyModifiers` writes `Padding` to are now covered by one chain and
verified by the same invariants.

User-visible fallout: those six properties are now marked `poolReset` in the
analyzer's modifier table, so `.Set(c => c.Padding = …)` and friends report
**`REACTOR_POOL_001` (Warning)** where they previously reported
`REACTOR_MOD_002` (Info) — but only on a receiver `ElementPool` actually
recycles (see the receiver-aware selection entry below); a `CheckBox` or
`RelativePanel` keeps reporting `REACTOR_MOD_002`. The suggested fix is
unchanged — use the fluent modifier (`.Padding(…)`) — and the provided code fix
still applies it automatically. Projects building with `TreatWarningsAsErrors`
may need to convert those call sites (or suppress the id) when upgrading.

- **`REACTOR_POOL_001` is no longer reported for receivers the pool does not
recycle (issue #1051).** Rule selection was `poolReset ? POOL_001 : MOD_002`,
decided per *property* and blind to the receiver, while the control gates it
reports through name inheritance roots — `Control` admits every WinUI control,
`Panel` admits every panel. `ElementPool` matches on the *exact* runtime type
(`PoolableTypes.Contains(element.GetType())`), so the two sets never agreed:
`.Set(cb => cb.IsEnabled = false)` on a `CheckBox`, or
`.Set(rp => rp.Background = brush)` on a `RelativePanel`, claimed *"is reset on
pool return"* for a control that is never pooled. `PoolResetSetAnalyzer` now
mirrors `ElementPool.PoolableTypes` exactly and falls back to
`REACTOR_MOD_002` (Info) outside it — the hazard those receivers really do
have, with the same advice and the same code fix. A parity test fails the build
if the mirror and `PoolableTypes` ever diverge in either direction. The change
is strictly de-escalating, and it also covers the twelve properties
(`Margin`, `Width`, `Height`, `Min`/`Max` sizes, alignments, `Opacity`,
`AccessKey`, `IsTabStop`) that had the same over-breadth before this release,
and the attached-property half of the rule
(`.Set(cb => AutomationProperties.SetName(cb, "Save"))`), which reported
`REACTOR_POOL_001` unconditionally. Both halves now resolve poolability once
from the `.Set` lambda parameter, so a body mixing an instance write with an
attached one cannot report two different ids for the same receiver.
Custom subclasses (`class MyButton : Button`) report `REACTOR_MOD_002` too,
matching the pool, which does not recycle them either.

- **Accessibility environment hooks now report the real system value on the
first render (issue #983).** `UseReducedMotion()`, `UseHighContrast()` and
`UseHighContrastScheme()` seeded their state inside `UseEffect`, which does
Expand Down Expand Up @@ -166,6 +219,7 @@ Conventions for contributors:
`AnimationsEnabledChanged`, gated behind an `ApiInformation` probe because that
event needs Windows 10 2004 (19041) and Reactor's minimum is 17763; on older
builds the existing `ColorValuesChanged` re-read remains as the fallback.

- **`DataGrid<T>`'s <kbd>Shift</kbd>+<kbd>Tab</kbd> now moves focus backward
(issue #987).** The grid's routed `KeyDown` handler captured only the raw
`VirtualKey` and then deferred dispatch through
Expand Down
11 changes: 7 additions & 4 deletions docs/_pipeline/templates/analyzer-architecture.md.dt
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,14 @@ was structurally invisible to the whole family:
.Set(fe => AutomationProperties.SetName(fe, "Save"))
```

`ElementPool.CleanElement` clears far more attached properties than
instance ones, so this was the larger half of `REACTOR_POOL_001`'s
`ElementPool.CleanElement` used to clear far more attached properties
than instance ones, so this was the larger half of `REACTOR_POOL_001`'s
subject matter — all of it in the "your write is silently discarded"
class. The failure is identical either way, so both shapes report the
*same* diagnostic id rather than a new one; only the matching differs.
class. Issue #985 has since closed the gap from the other side (the
receiver-gated `Padding` / `CornerRadius` / `Border*` / `Background` /
`IsEnabled` chain), so the two halves are now comparable in size. The
failure is identical either way, so both shapes report the *same*
diagnostic id rather than a new one; only the matching differs.

**Keyed by owner, not by property name.** The instance table,
`ModifierTable.Properties`, is keyed by the bare property name, and
Expand Down
11 changes: 7 additions & 4 deletions docs/guide/analyzer-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,14 @@ was structurally invisible to the whole family:
.Set(fe => AutomationProperties.SetName(fe, "Save"))
```

`ElementPool.CleanElement` clears far more attached properties than
instance ones, so this was the larger half of `REACTOR_POOL_001`'s
`ElementPool.CleanElement` used to clear far more attached properties
than instance ones, so this was the larger half of `REACTOR_POOL_001`'s
subject matter — all of it in the "your write is silently discarded"
class. The failure is identical either way, so both shapes report the
*same* diagnostic id rather than a new one; only the matching differs.
class. Issue #985 has since closed the gap from the other side (the
receiver-gated `Padding` / `CornerRadius` / `Border*` / `Background` /
`IsEnabled` chain), so the two halves are now comparable in size. The
failure is identical either way, so both shapes report the *same*
diagnostic id rather than a new one; only the matching differs.

**Keyed by owner, not by property name.** The instance table,
`ModifierTable.Properties`, is keyed by the bare property name, and
Expand Down
4 changes: 2 additions & 2 deletions plugins/reactor/skills/reactor-build-and-check/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ Additional flags:
| `REACTOR_CTRL_001` | warning | `.Set(x => x.SelectedItem/SelectedValue = ...)` on a selector that also sets `SelectedIndex` | Delete the `.Set(...)` — controlled `SelectedIndex` is the authority. Don't drive selection from two places. |
| `REACTOR_VIS_001` | warning | Imperative `.Set(c => c.Visibility = Visibility.Collapsed)` | Use `.IsVisible(false)` / `.IsVisible(true)` (or conditional inclusion `cond ? el : null`). `.Set` writes aren't reconciled. |
| `REACTOR_EVENT_001` | warning | Event subscription via `.Set(c => c.Event += h)` (re-subscribes every render) | Use the declarative `.On<Event>(h)` modifier where one exists, else `.OnMountAdd(c => ((TControl)c).Event += h).OnUnmountAdd(c => ((TControl)c).Event -= h)` with a stable `h` (static method or field). |
| `REACTOR_MOD_002` | info | `.Set(c => c.Prop = v)` where a first-class `.Prop(v)` modifier exists | Use the modifier. `.Set` setters re-run every render, are never unwound when a later render drops them, and `Element.SettersEqual` pins the element to the reconciler's update path. The fix rewrites the whole `.Set` — including multi-statement bodies — into a modifier chain. |
| `REACTOR_MOD_002` | info | `.Set(c => c.Prop = v)` where a first-class `.Prop(v)` modifier exists — **or** an attached setter `.Set(c => Owner.SetProp(c, v))` whose receiver is a type `ElementPool` never holds, which reports `MOD_002` rather than `POOL_001` | Use the modifier. `.Set` setters re-run every render, are never unwound when a later render drops them, and `Element.SettersEqual` pins the element to the reconciler's update path. The fix rewrites the whole `.Set` — including multi-statement bodies — into a modifier chain. |
| `REACTOR_MOD_003` | warning | A common modifier that `ApplyModifiers` never writes to this element's control (`.Background(...)` on a `Rectangle`, `.Padding(...)` on a `Canvas`, `.CornerRadius(...)` on an `Image`) | The call compiles and is silently discarded. On a shape use the paint modifier (`.Fill(...)` / `.Stroke(...)` / `.StrokeThickness(...)` — the fix does the rewrite); otherwise host the element in a control that supports it. Gates: `Background` → Panel/Control/Border; `Foreground` and fonts → Control/TextBlock; `Padding` → Control/Border/Grid/StackPanel/RelativePanel/TextBlock; `CornerRadius` → Control/Border/Grid/StackPanel/RelativePanel; `BorderBrush`/`BorderThickness` → Control/Border. |
| `REACTOR_POOL_001` | warning | `.Set` writes a property `ElementPool.CleanElement` clears on pool return — either `c.Prop = v` or an attached setter `Owner.SetProp(c, v)` (`AutomationProperties.*`, `ToolTipService.*`, `TitleBar.IsDragRegion`, `FlexPanel.*`) | Use the surviving modifier — the value is stored on `Element.Modifiers` and re-applied every render, whereas the `.Set` write is silently discarded when the control is reused. Most map 1:1 and ship a fix (`AutomationProperties.SetName` → `.AutomationName(...)`, `ToolTipService.SetToolTip` → `.ToolTip(...)`); the rest are diagnostic-only because the modifier's shape differs — `.PositionInSet(position, size)`, `.Required()`, `.Flex(grow: ...)`. |
| `REACTOR_POOL_001` | warning | `.Set` writes a property `ElementPool.CleanElement` clears on pool return — either an instance write `c.Prop = v` (layout/appearance: `Margin`, `Width`/`Height`, `Min`/`Max` sizes, `HorizontalAlignment`/`VerticalAlignment`, `Opacity`, `AccessKey`, `IsTabStop`, plus `Padding`, `CornerRadius`, `BorderThickness`, `BorderBrush`, `Background` and `IsEnabled` on their supported receivers) or an attached setter `Owner.SetProp(c, v)` (`AutomationProperties.*`, `ToolTipService.*`, `TitleBar.IsDragRegion`, `FlexPanel.*`). **Receiver-aware:** fires only when the `.Set` lambda parameter's *exact* type is one `ElementPool` recycles — `TextBlock`, `RichTextBlock`, `StackPanel`, `Grid`, `Border`, `ScrollViewer`, `Canvas`, `Viewbox`, `ProgressBar`, `ProgressRing`, `Image`, `InfoBadge`, `Button`, `TextBox`, `ToggleSwitch`. The identical write on a receiver the pool never holds (`CheckBox`, `RelativePanel`, a user subclass of a pooled type) reports `REACTOR_MOD_002` instead — same modifier advice, minus the pool-return claim: the write lands and is never unwound, so what it costs is the element's structural skip (`Element.SettersEqual`), not the value. | Use the surviving modifier — the value is stored on `Element.Modifiers` and re-applied every render, whereas the `.Set` write is silently discarded when the control is reused. Most map 1:1 and ship a fix (`.Padding(...)`, `.Background(...)`, `AutomationProperties.SetName` → `.AutomationName(...)`, `ToolTipService.SetToolTip` → `.ToolTip(...)`); the rest are diagnostic-only because the modifier's shape differs — `.PositionInSet(position, size)`, `.Required()`, `.Flex(grow: ...)`. |
| `REACTOR_A11Y_004` | warning | Clickable container (`Border`/`Grid`/`Canvas`/`Rectangle`/`Ellipse`/`VStack`/`HStack`) has `.OnTapped` but is not keyboard-reachable | Add `.IsTabStop(true)` and pair with `.OnKeyDown` for Enter/Space activation. |
| `REACTOR_INPUT_001` | warning | Ctrl/Alt chord tested inside a `.OnKeyDown` lambda (focus-scoped, fires only while the element has focus) | Register it app-wide as a `Command` accelerator: `new Command { …, Accelerator = Accelerator(VirtualKey.S, VirtualKeyModifiers.Control) }`, then drop the `.OnKeyDown` chord. |
| `REACTOR_ANIM_002` | info | `.Keyframes(name, trigger, …)` trigger changes every render (`DateTime.Now`, `Guid.NewGuid()`, a fresh allocation) | Pass a stable trigger — a `UseState`/`UseReducer` counter you increment only when you mean to retrigger. Recomputed values restart the animation each reconcile (flicker). |
Expand Down
Loading