Skip to content

Declarative title bar height option (WindowSpec.TitleBarHeight / TitleBar(...).Tall()) - #925

Merged
Alexandre Zollinger Chohfi (azchohfi) merged 6 commits into
mainfrom
azchohfi-issue-917-feature-declarative-title-bar-height-op-574633
Jul 28, 2026
Merged

Alexandre Zollinger Chohfi (azchohfi) merged 6 commits into
mainfrom
azchohfi-issue-917-feature-declarative-title-bar-height-op-574633

Conversation

@azchohfi

@azchohfi Alexandre Zollinger Chohfi (azchohfi) commented Jul 28, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #917.

Adds WindowTitleBarHeight { Standard, Tall, Collapsed }, surfaced as WindowSpec.TitleBarHeight and TitleBar(...).Tall() / .HeightOption(...).

TitleBar("My App").WithNavigation(nav).PaneToggleButtonVisible(true).Tall();

new WindowSpec { ExtendsContentIntoTitleBar = true, TitleBarHeight = WindowTitleBarHeight.Tall };

⚠️ Read this before migrating the reactor-navview template

The diagnosis in #917 is wrong, and the fix here is not the fix the issue asked for. If you port the template by mechanically keeping the existing workaround and adding an API call, you will keep a line that never did anything.

#917 says the naive imperative write is clobbered by TitleBar(...)'s ExtendsContentIntoTitleBar inference running after the effect body, and that the dispatcher hop is what makes it stick. I measured this on a live window (100% scale, AppWindowTitleBar.Height in px):

Scenario Caption RightInset WinUI TitleBar control
baseline (TitleBar element, extended) 32 137 32
PreferredHeightOption = Tall 48 143 32
Tall from a plain UseEffect, no dispatcher hop 48 143 32
Tall via the shipping dispatcher hop 48 143 32
.Height(48) only 32 137 48
Tall + .Height(48) 48 143 48

Rows 3 and 4 are identical. Nothing clobbers the value, and the dispatcher hop changes nothing. It is cargo cult — it "worked" because it was paired with the .Height(48) the issue also mentions needing anyway, and that second line is what produced the visible change.

The two real problems are:

  1. The WinUI TitleBar control does not follow the caption. The caption grows to 48, the control stays 32. The property reads back as Tall and the app looks near-identical — which is exactly the "succeeds but has no visual effect" symptom reported. Delaying the write never addressed this; pairing the two heights does, and that is what .Tall() applies.
  2. The native setter throws on a non-content-extended window — COMException 0x8007139F (ERROR_INVALID_STATE). So the write genuinely is order-sensitive, just not in the direction the issue describes: it must come after the extend flip, or it throws. Reactor now owns that ordering.

Template migration

-var window = UseWindow();
-UseEffect(() =>
-{
-    if (window is not { } win) return;
-    win.NativeWindow?.DispatcherQueue.TryEnqueue(() =>
-        win.AppWindow.TitleBar.PreferredHeightOption = TitleBarHeightOption.Tall);
-});
-TitleBar("My App").WithNavigation(nav).PaneToggleButtonVisible(true).Height(48)
+TitleBar("My App").WithNavigation(nav).PaneToggleButtonVisible(true).Tall()

Delete the effect entirely. .Tall() replaces both the hop and the .Height(48) — it sets the caption and the control together.

Note the name differs from the issue's proposal: the enum is WindowTitleBarHeight, not TitleBarHeightOption (that name is already taken by Microsoft.UI.Windowing, and a Reactor-owned enum keeps the DSL from leaking a native type). Member names and ordering mirror the platform enum, pinned by a unit test.

On the issue's secondary ask

Separately, it would help if setting PreferredHeightOption from a UseEffect were not order-dependent — if the mount-time inference cannot clobber a value the app has already set...

Already true today; there was never a clobber to remove. The imperative escape hatch stays valid, with the one caveat that it throws if the window is not yet content-extended.


Behaviour

  • Applied after Reactor's own ExtendsContentIntoTitleBar flip — no ordering hazard for the app, and it can't hit ERROR_INVALID_STATE.
  • Sets both halves: the system caption and the WinUI control's height.
  • Precedence mirrors ExtendsContentIntoTitleBar — explicit WindowSpec.TitleBarHeight wins, the element's declaration is the fallback, neither means Reactor writes nothing (so an app setting PreferredHeightOption imperatively keeps ownership). Removing a previously Reactor-applied value resets to Standard.
  • An explicit .Height(...) still wins over the implied 48, including when it is removed across renders.
  • Declared on a window that never extends: warns and skips rather than throwing, and re-applies automatically if the window later extends.
  • Defaults are unchanged — existing windows stay at Standard.

Drive-by fix

ReactorWindow.Update wrote ExtendsContentIntoTitleBar = false whenever the spec value was null, silently dropping a mounted TitleBar element's inference on any subsequent spec update. Now spec.ExtendsContentIntoTitleBar ?? _titleBarControlPresent. Caught by a new fixture, not by inspection.

Tests

  • tests/Reactor.Tests/TitleBarHeightTests.cs — headless: defaults, round-trips, differential isolation on .Tall(), .Tall(false) == Standard, enum-ordering parity with the platform enum, and reflection pins on the two control-height writers.
  • tests/Reactor.AppTests.Host/SelfTest/Fixtures/TitleBarHeightFixtures.cs — 7 fixtures / 15 checks against real WinUI geometry. Every check is differential against a standard-caption baseline measured in the same run, so it fails if the apply path is removed. The not-extended fixture first proves the raw platform setter really does throw in that state, so it is testing the guard rather than a no-op.

Full unit suite (12,469) and the full selftest suite both pass. WindowLevel_RuntimeFlip_Topmost flaked once mid-run; reproduced with these changes reverted and green on re-run, so it is environmental.

A multi-model cross-check on the first commit found three real gaps (spec-only Update leaving the mounted control stale, removing .Height(...) falling back to auto instead of 48, and one selftest that a no-op implementation could pass). All three are fixed in the second commit with fixtures covering them.

Docs

docs/guide/windows.md (regenerated from docs/_pipeline/templates/windows.md.dt), skills/windowing.md, and plugins/reactor/skills/reactor-windowing/SKILL.md all gained a "Tall title bar" section describing the new API.

The migration note retiring the dispatcher hop lives only in the user guide, deliberately — the skills are per-session context budget, and a one-time migration for a preview API doesn't earn permanent tokens there. The correction is also posted as a comment on #917 itself, which is what a template port is most likely to be working from.

@github-actions

github-actions Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build metrics

Artifact sizes for 540035b vs the base branch (bafeeba).

Packages (compressed .nupkg)

Artifact base PR Δ
Microsoft.UI.Reactor.nupkg 1.95 MB 1.96 MB +5.47 KB (+0.27%) ⚠️
Microsoft.UI.Reactor.Advanced.nupkg 27.1 KB 27.1 KB +6 B (+0.02%) ≈
Microsoft.UI.Reactor.Devtools.nupkg 278.2 KB 278.2 KB -3 B (0.00%) ≈

Assemblies in Microsoft.UI.Reactor

Artifact base PR Δ
Reactor.Analyzers.dll 301.0 KB 301.0 KB +0 B (0.00%) ≈
Reactor.dll 3.24 MB 3.25 MB +5.00 KB (+0.15%) ⚠️
Reactor.Localization.Generator.dll 16.0 KB 16.0 KB +0 B (0.00%) ≈
Reactor.Wrappers.Abstractions.dll 10.5 KB 10.5 KB +0 B (0.00%) ≈
Reactor.Wrappers.Generator.dll 99.5 KB 99.5 KB +0 B (0.00%) ≈

Assemblies in Microsoft.UI.Reactor.Advanced

Artifact base PR Δ
Reactor.Advanced.dll 33.0 KB 33.0 KB +0 B (0.00%) ≈

Assemblies in Microsoft.UI.Reactor.Devtools

Artifact base PR Δ
Microsoft.UI.Reactor.Devtools.dll 777.5 KB 777.5 KB +0 B (0.00%) ≈

✅ smaller / ⚠️ larger / ≈ within noise. Sizes come from a Release dotnet pack on the CI runner: packages are the compressed .nupkg download size, assemblies the uncompressed DLL inside it.
workflow run.

@azchohfi
Alexandre Zollinger Chohfi (azchohfi) force-pushed the azchohfi-issue-917-feature-declarative-title-bar-height-op-574633 branch from 57130a9 to 354e3a9 Compare July 28, 2026 20:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a declarative “tall title bar” option to Reactor’s windowing model, aligning WinUI’s system caption height and the WinUI TitleBar control height so common NavigationView/title-bar chrome layouts don’t require imperative workarounds.

Changes:

  • Introduces WindowTitleBarHeight { Standard, Tall, Collapsed }, exposed via WindowSpec.TitleBarHeight and TitleBar(...).Tall() / .HeightOption(...).
  • Implements ordering/precedence logic in ReactorWindow to apply caption height safely (after content-extension) and to keep the mounted TitleBar control height in sync (including post-modifier fallback when .Height(...) is removed).
  • Adds headless unit tests and WinUI selftest fixtures; updates docs/skills and API reference indices; includes a related ExtendsContentIntoTitleBar inference fix in ReactorWindow.Update.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Reactor/Hosting/WindowSpec.cs Adds WindowTitleBarHeight enum and WindowSpec.TitleBarHeight API with validation/docs.
src/Reactor/Hosting/ReactorWindow.cs Applies caption height option with spec-over-element precedence; syncs TitleBar control height; fixes ExtendsContentIntoTitleBar null-spec inference behavior.
src/Reactor/Core/Element.cs Adds TitleBarElement.HeightOption and wires mount/update imperative hooks to push height state into ReactorWindow.
src/Reactor/Elements/ElementExtensions.cs Adds DSL modifiers .HeightOption(WindowTitleBarHeight) and .Tall(bool).
src/Reactor/Core/Reconciler.Mount.cs / src/Reactor/Core/Reconciler.Update.cs Re-applies caption-derived control height after modifiers to handle removed explicit .Height(...).
tests/Reactor.Tests/TitleBarHeightTests.cs Headless tests covering data shape/precedence and reflection pins for key wiring points.
tests/Reactor.AppTests.Host/SelfTest/Fixtures/TitleBarHeightFixtures.cs Selftest fixtures validating real caption/control geometry and ordering/guard behavior.
tests/Reactor.AppTests.Host/SelfTest/SelfTestFixtureRegistry.cs Registers the new selftest fixtures in both required places.
docs/_pipeline/templates/windows.md.dt / docs/guide/windows.md Documents .Tall() and migration away from the dispatcher-hop workaround.
skills/windowing.md / plugins/reactor/skills/reactor-windowing/SKILL.md Updates windowing skill docs to describe tall title bar usage and rationale.
skills/reactor.api.txt / plugins/reactor/skills/reactor-dsl/references/reactor.api.txt Updates public API snapshots.
CHANGELOG.md Notes the added title-bar height feature and the ExtendsContentIntoTitleBar inference fix.

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

Copilot AI review requested due to automatic review settings July 28, 2026 20:30
Adds a Reactor-owned WindowTitleBarHeight enum surfaced as WindowSpec.TitleBarHeight and TitleBarElement.HeightOption, with .Tall() / .HeightOption(...) fluent modifiers.

A live-WinUI spike refuted the issue's stated cause: nothing in Reactor's mount clobbers AppWindow.TitleBar.PreferredHeightOption, and a naive UseEffect write produces the same geometry as the dispatcher-hop workaround. The real problems are (a) writing the property on a non-content-extended window throws COMException 0x8007139F, and (b) the WinUI TitleBar control does not follow the caption height, so Tall alone looks like a no-op. Reactor therefore applies the value after its own ExtendsContentIntoTitleBar flip and sizes both the caption and the control.

Also fixes ReactorWindow.Update writing ExtendsContentIntoTitleBar = false when the spec value is null, which silently dropped a mounted TitleBar element's inference.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: a36817d0-2008-4d82-a37b-974628bf463b
Cross-model review of the previous commit found three real gaps:

- A WindowSpec.TitleBarHeight change delivered through Update moved only the
  native caption; an already-mounted WinUI TitleBar control kept its old
  height, which is exactly the caption/control mismatch the feature exists to
  prevent. The window now holds a weak reference to the mounted control and
  sizes it whenever it writes the caption.
- Removing an explicit .Height(...) from a still-tall TitleBar fell back to
  auto instead of the implied 48: the reconciler clears a removed Height
  modifier after the element's imperative entry runs. Added a post-modifier
  re-sync hook alongside the existing UpdateDefaultAutomationName one.
- The not-extended selftest was satisfiable by a no-op implementation. It now
  also flips the window into content-extended mode and asserts the retained
  declaration is re-applied, which no gutted implementation can pass.

Also tightened the headless assertions the review flagged as vacuous and added
two selftest fixtures covering the two behaviours above.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: a36817d0-2008-4d82-a37b-974628bf463b
The Windows App SDK reactor-navview template ships the dispatcher-hop
workaround. Whoever migrates it will read issue #917, which states an ordering
theory the spike disproved -- so the docs now retire the workaround explicitly
rather than only describing the new API, with a before/after for the migration.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: a36817d0-2008-4d82-a37b-974628bf463b

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

tests/Reactor.AppTests.Host/SelfTest/Fixtures/TitleBarHeightFixtures.cs:30

  • These fixtures hard-code AppWindow.TitleBar.Height as 32/48, but that API reports physical pixels and will vary with display scaling (the file even calls out “at 100% scale”). This makes the selftests environment/DPI dependent and risks CI flakes if the runner DPI changes. Prefer making the oracle purely differential (compare Tall vs Standard measured in the same run) or deriving expected pixels from a measured baseline/scale factor instead of assuming 100%.
    private const int StandardCaption = 32;
    private const int TallCaption = 48;

src/Reactor/Hosting/ReactorWindow.cs:1543

  • The warning text here can be misleading when ExtendsContentIntoTitleBar is explicitly set to false while a TitleBar(...) element is present: it suggests “render a TitleBar(...) element” as a remedy even though the element may already be rendered and the real fix is to allow/enable content extension. Consider clarifying the message to point at ExtendsContentIntoTitleBar needing to be true (or not forced false) for the write to be legal.
                DiagnosticLog.Warning(
                    LogCategory.Hosting,
                    "ReactorWindow.TitleBarHeight",
                    "TitleBarHeight requires a content-extended window; set WindowSpec.ExtendsContentIntoTitleBar = true "
                    + "or render a TitleBar(...) element. The height option was not applied.");

Copilot AI review requested due to automatic review settings July 28, 2026 21:02
@azchohfi
Alexandre Zollinger Chohfi (azchohfi) force-pushed the azchohfi-issue-917-feature-declarative-title-bar-height-op-574633 branch from 354e3a9 to aef31a0 Compare July 28, 2026 21:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

src/Reactor/Core/Element.cs:4720

  • TitleBarElement's descriptor uses a ControlDescriptor.Imperative update lambda that runs on every render, but the new implementation always calls ApplyTitleBarHeightOption. That path can trigger COM property writes (PreferredHeightOption + control Height) even when neither HeightOption nor the explicit .Height(...) state changed, which is avoidable work and could cause unnecessary native churn on frequent re-renders.

Consider diffing old vs new and only calling ApplyTitleBarHeightOption when (a) HeightOption changed, or (b) the presence of an explicit Height modifier changed (since that affects ownership).

            .Imperative(
                mount: static (c, e) => RegisterWindowTitleBar(c, e),
                update: static (c, _, e) => ApplyTitleBarHeightOption(c, e))
            .HandCodedEvent<global::Microsoft.UI.Reactor.Core.V1Protocol.TitleBarEventPayload,

src/Reactor/Hosting/ReactorWindow.cs:568

  • ApplyChrome now treats _titleBarControlPresent as the inference source when spec.ExtendsContentIntoTitleBar is null. But _titleBarControlPresent is only ever set to true (via MarkTitleBarControlPresent) and is never cleared on TitleBar unmount, so a window that used to render a TitleBar may remain content-extended forever even after the TitleBar is removed and the spec stays null.

If the intended contract is “infer only while a TitleBar control is currently mounted”, you likely need an unmount hook to clear the flag (or a separate current-mounted flag) so inference can be withdrawn when the element disappears.

            // A null spec value means "infer": a mounted TitleBar(...) element
            // sets content-extension at mount. Re-applying chrome on Update must
            // preserve that inference — writing the raw default here would
            // silently drop the window out of content-extended mode behind a
            // still-mounted TitleBar control. (issue #917; inference contract
            // documented on WindowSpec.ExtendsContentIntoTitleBar)
            try { _window.ExtendsContentIntoTitleBar = spec.ExtendsContentIntoTitleBar ?? _titleBarControlPresent; }

@github-actions

github-actions Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

🧪 Merged coverage

Coverage for 540035b vs the base branch (2a3030c) — unit + selftest merged.

Metric base PR Δ
Line 85.49% 85.50% +0.01 pp ≈
Branch 77.12% (893/1158) 77.20% (894/1158) +0.08 pp ≈

No coverage change beyond the noise floor. ✅

✅ higher / ⚠️ lower / ≈ within noise. Δ is in percentage points; coverage is unit + selftest merged (Debug x64) on the CI runner. Cobertura reports attached to the workflow run as artifacts.

…n (issue #917)

Findings from the Copilot reviewer and the code-quality bot on PR #925.

Accepted:
- Selftest caption assertions hard-coded 32/48 as if AppWindowTitleBar.Height
  were DIPs. It reports physical pixels, so above 100% scaling they break --
  and at 150% a Standard caption measures 48px, which would have false-passed
  the Tall check. Caption expectations now convert through the window's
  DipScale; control ActualHeight stays in DIPs, which needs no conversion.
- _titleBarControlPresent is an ever-mounted latch that is never cleared, so
  the new ExtendsContentIntoTitleBar inference could not be withdrawn: a window
  that merely used to host a TitleBar stayed content-extended (and tall) for
  its lifetime. Split out _titleBarControlMounted for current mount state and
  added an unmount hook on both traversals (UnmountRecursive and the pooling
  UnmountAndCollect). The teardown latch is untouched -- issue #537 wants the
  conservative answer there.
- The element's Imperative entry runs on every render, so the caption COM write
  and the control DP write fired even when nothing changed. Both are now
  dirty-checked.
- The not-extended warning suggested rendering a TitleBar element even when one
  was already rendered and the spec was forcing the flag false. Message now
  branches on current mount state.
- Dropped the GC.Collect/WaitForPendingFinalizers from fixture teardown; it was
  not part of the house CloseAndSettle pattern.

Declined: the LINQ .Where() and generic/empty-catch findings target an idiom
copied verbatim from Phase4WindowingFixtures.CloseAndSettle. Diverging in one
file would fragment the pattern for no behavioural gain; added a comment
explaining why the catch is intentionally best-effort.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: a36817d0-2008-4d82-a37b-974628bf463b
Copilot AI review requested due to automatic review settings July 28, 2026 21:34
@azchohfi

Copy link
Copy Markdown
Collaborator Author

Review pass — all findings triaged

Working through the inline threads plus the four suppressed low-confidence comments (those have no thread to reply to, so covering them here). Three of the four were right, and one duplicated a gap my own pre-PR cross-check had flagged and I hadn't fixed. All fixes in 589136d.

# Finding Verdict
1 Fixtures hard-code 32/48 for a physical-pixel API Fixed
2 GC.Collect() in fixture teardown Fixed
3 .Where() instead of foreach + null-continue Declined — house pattern
4 Generic catch clause Declined — house pattern
5 Empty catch block Comment added; no logging
6 (suppressed) DPI dependence Same as #1
7 (suppressed) Misleading not-extended warning Fixed
8 (suppressed) Imperative update writes COM every render Fixed
9 (suppressed) _titleBarControlPresent never cleared Fixed

#9 — the important one

Flagged as low confidence, but correct and the most consequential. _titleBarControlPresent is an ever-mounted latch; keying the new ExtendsContentIntoTitleBar inference on it meant a window that merely used to host a TitleBar stayed content-extended, and tall, for the rest of its life.

Split into two flags rather than clearing the existing one — the latch also drives close-time teardown safety (issue #537), where the conservative "a control was mounted at some point" answer is the correct one and clearing it would risk reintroducing that heap corruption. A new _titleBarControlMounted tracks current state and is cleared from an unmount hook on both traversals: UnmountRecursive and the pooling UnmountAndCollect (a TitleBar nested in a poolable container takes the latter).

Covered by a new fixture, TitleBarHeight_UnmountWithdraws, which observes caption 48 → 32 on unmount and asserts the inference is withdrawn on a later unset-flag spec update.

#1 — worse than reported

The reviewer said the hard-coded caption values would fail under scaling. They can also false-pass: at 150% a Standard caption measures 48px, exactly the hard-coded TallCaption. Caption assertions now convert through the window's DipScale; control ActualHeight assertions keep DIP constants, since those need no conversion.

#8

Confirmed real — the element's Imperative entry runs every render, so a native caption write plus a control DP write fired on renders where nothing relevant changed. Both are dirty-checked now.

On #3 / #4 / #5

These target CloseAndSettle, copied verbatim from Phase4WindowingFixtures.CloseAndSettle. Diverging in one file fragments an idiom that is currently identical across the windowing fixtures, for no behavioural gain. Reasoning is in each thread; happy to revisit as a sweep across all of them.


Full unit suite (12,474) and the full selftest suite are green — the latter mattering more than usual, since the unmount hook now runs on every element teardown.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

Code-quality bot flagged the == comparison on FrameworkElement.Height, which
is a double DP. Compare with a sub-pixel tolerance instead. NaN (the unset
value) still falls through to the write, since every NaN comparison is false.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: a36817d0-2008-4d82-a37b-974628bf463b
Copilot AI review requested due to automatic review settings July 28, 2026 21:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/Reactor/Core/Element.cs:4756

  • RegisterWindowTitleBar returns early when WindowSpec.ExtendsContentIntoTitleBar is explicitly false, which also skips the new ApplyTitleBarHeightOption(titleBar, element) call. That means a TitleBar(...).HeightOption(...)/.Tall() declaration (and even the control reference) never gets registered with ReactorWindow, so if the window later becomes content-extended (e.g., the spec is updated to null/true) the declarative height can’t be applied/resolved as described by the feature’s deferred-apply behavior.

Consider skipping only SetTitleBar(...) when the spec is explicitly false, but still letting the method continue so height option wiring and deferred application can work.

            var explicitValue = owningWindow?.Spec.ExtendsContentIntoTitleBar;
            if (explicitValue == false) return;
            if (explicitValue is null)
                host.Window.ExtendsContentIntoTitleBar = true;
            host.Window.SetTitleBar(titleBar);
        }

Two of the three findings I previously declined were declined on bad
reasoning, so applying them:

- .Where(): I claimed it would pull in a using System.Linq that no sibling
  fixture carries. Wrong on both counts -- ImplicitUsings is enabled for
  Reactor.AppTests.Host, so no directive is needed, and ten fixture files
  already use LINQ.
- Empty catch: I argued logging would interleave with the TAP stream. True of
  Console.WriteLine, but DiagnosticLog.SwallowedError routes to the ETW
  EventSource (plus Debug.WriteLine in DEBUG), never Console -- and it is the
  product's own idiom for this exact swallowed-exception pattern, used by
  ReactorWindow throughout.

The breadth of the catch itself is kept deliberately: this runs in a finally
after the fixture's assertions, closing a window that may be mid-native
teardown, and the WinUI TitleBar control throws teardown-reentry COMExceptions
(issue #537). Enumerating specific types risks turning a passing fixture red
for a reason unrelated to what it tests.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: a36817d0-2008-4d82-a37b-974628bf463b
Copilot AI review requested due to automatic review settings July 28, 2026 22:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

@azchohfi
Alexandre Zollinger Chohfi (azchohfi) merged commit 2115035 into main Jul 28, 2026
21 checks passed
@azchohfi
Alexandre Zollinger Chohfi (azchohfi) deleted the azchohfi-issue-917-feature-declarative-title-bar-height-op-574633 branch July 28, 2026 22:24
Martin Zikmund (MartinZikmund) added a commit to MartinZikmund/microsoft-ui-reactor that referenced this pull request Jul 29, 2026
…IP sizing

Picks up two upstream window features and fixes two genuine bugs the empirical
pass uncovered.

Upstream parity:
- WindowTitleBarHeight (microsoft#917/microsoft#925) lives in the Windows-only Hosting/WindowSpec.cs
  that this port replaces, but shared Element.cs/ElementExtensions.cs reference
  it, so the rebase broke the build. Declare the enum here and honour it for
  real: Uno implements AppWindowTitleBar.PreferredHeightOption (Standard 32 /
  Tall 48 / Collapsed 0). ReactorWindow gains the three members the shared
  TitleBar element and reconciler call -- SetElementTitleBarHeight,
  SyncTitleBarControlHeight, ClearTitleBarControl.
- WindowSpec.Width/Height and the Run/RunAsync overloads become double? (microsoft#924),
  so a null axis defers to the OS instead of forcing 1024x768.

Bug fixes:
- AppWindow.Resize takes PHYSICAL PIXELS -- Uno's Win32 head hands the SizeInt32
  straight to SetWindowPos -- but WindowSpec sizes are DIPs. Every window was
  undersized above 100% scale; a 480x360 request measured 320x240 DIP at 150%.
  Multiply by RasterizationScale, as Uno's own startup path does. Now measures
  480x360.
- OnContentAttached early-returned whenever the XamlRoot was null, and it always
  is on first call: Reactor assigns Window.Content from the dispatcher-queued
  render loop, while XamlRoot only appears once the element enters the live tree
  after Activate. `ReferenceEquals(null, null)` is true, so the window
  permanently skipped BOTH the initial resize and the XamlRoot.Changed
  subscription -- meaning live DPI tracking was silently dead. Re-arm on Loaded
  and apply once the root really exists.

Also adds ReactorApp.CreateApplication<TRoot>() for native heads (Android
Activity / iOS AppDelegate), which have no console Main and so cannot use Run.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017rs9N4ZH4ss5tDtBwBN1Go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Declarative title bar height option (TitleBarHeightOption.Tall)

2 participants