Repository navigation
fix(aot): make legacy text-node TreeView render under NativeAOT - #1108
Alexandre Zollinger Chohfi (azchohfi) merged 2 commits into
Conversation
📦 Build metricsArtifact sizes for Packages (compressed .nupkg)
Assemblies in Microsoft.UI.Reactor
Assemblies in Microsoft.UI.Reactor.Advanced
Assemblies in Microsoft.UI.Reactor.Devtools
No size change beyond the noise floor. ✅ ✅ smaller / |
🧪 Merged coverageCoverage for
No coverage change beyond the noise floor. ✅ ✅ higher / |
There was a problem hiding this comment.
Pull request overview
Fixes a NativeAOT trimming issue where the legacy node-mode TreeView item template ({Binding Content.Content}) could not resolve TreeViewNodeData.Content, causing node text to render as empty at runtime. The fix makes the binding metadata generation trimming-safe and adds a dedicated selftest fixture so the scenario is exercised under both JIT and NativeAOT.
Changes:
- Annotates
TreeViewNodeDatawithWinRT.GeneratedBindableCustomProperty(scoped to"Content") and makes the recordpartialso CsWinRT can generate trimming-safe binding metadata. - Adds a new selftest fixture that mounts and updates a legacy text-node
TreeViewand asserts exact text rendering via visual-tree queries. - Removes the now-unnecessary NativeAOT skip for the previously failing control-collection assertion, and updates the skip-list documentation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/Reactor.AppTests.Host/SelfTest/SelfTestRunner.cs | Updates NativeAOT skip-list commentary and removes the obsolete skip for ControlUpdate_Collections. |
| tests/Reactor.AppTests.Host/SelfTest/SelfTestFixtureRegistry.cs | Registers the new TreeView binding AOT regression fixture. |
| tests/Reactor.AppTests.Host/SelfTest/Fixtures/TextTreeBindingAotFixtures.cs | Adds a focused fixture that validates legacy TreeView {Binding} text rendering on mount and update with exact-match checks. |
| src/Reactor/Core/Element.cs | Adds a CsWinRT binding-metadata generation attribute to TreeViewNodeData (scoped to Content) to keep legacy TreeView bindings working under NativeAOT. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The legacy node-mode TreeView renders node text through a classic {Binding}:
Reconciler.TreeViewTextItemTemplate resolves "Content.Content", hopping
TreeViewNode.Content (native WinRT) to TreeViewNodeData.Content (a managed
record property). That managed hop goes through CsWinRT's
ICustomPropertyProvider, which is reflection-based, so NativeAOT trims it and
the TextBlock silently renders empty - with no build-time warning, because the
reflection happens across the WinRT ABI where the IL trim analyzers cannot see
it.
Annotating TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] makes
the CsWinRT source generator emit strongly-typed binding metadata (explicit
interface implementation, static lambdas - no public API surface added), so the
hop survives trimming. The attribute is scoped to "Content": it is the only
member the template binds, and the unscoped overload also emits an accessor for
the [Obsolete] ContentElement, which fails the warnings-as-errors Release build
with CS0618.
This was not a theoretical gap. ControlUpdate_Collections mounts a text-mode
TreeView and asserts its node text renders; it has been sitting in
DefaultAotSkipPatterns as an unexplained "control-collection assertion still
under investigation". It was this bug all along, so the skip is removed and the
fixture now guards the fix.
Also adds a dedicated fixture for the path. Every existing TTV_* fixture passes
a viewBuilder, which routes to the SharedContentControlTemplate shell and never
exercises the binding template, so the path had no direct coverage. The new
assertions search the live visual tree for the bound strings and fail if the
resolution regresses.
Verified on an AOT-published Host: fails before the change, passes after, with
the full selftest suite green under both JIT and NativeAOT.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
…omments
Review follow-ups on the legacy text-node TreeView AOT fix.
Assertions now use exact text matching (H.FindText) instead of a
substring probe. TreeViewNodeData is a positional record, so its
synthesized ToString() embeds "Content = BindingRootZulu". If the
template selection ever regressed to SharedContentControlTemplate, that
bare ContentControl would render the record's ToString() into an
implicit TextBlock, which *contains* the expected substring -- a
Contains probe would go green while the text-template binding path was
dead. This also matches the convention already used by the neighbouring
ControlUpdate_Collections fixture (H.FindText("TV_Root")).
Adds update-arm coverage: TreeChildren.Bind(isMount: false) clears
RootNodes and rebuilds every TreeViewNode, so the binding must resolve
again on freshly-created nodes -- a distinct path from mount that the
mount-only assertions did not reach.
Corrects two stale comments in the AOT skip list. Removing
ControlUpdate_Collections left the header claiming "two
control-collection assertions" and labelled the sole remaining entry,
CoreCov2_UseObservableTreeHook, a "control-collection assertion". It is
neither: it exercises ctx.UseObservableTree, which subscribes to nested
INotifyPropertyChanged by walking the model graph with
Type.GetProperties (ObservableTreeTracker.CreateInpcCandidateProperties),
so it fails under AOT for the same reflection-over-user-types reason as
Devtools and PropertyGrid.
Also drops three spurious end-of-file blank lines from the diff.
Validation: mutation-tested by removing the attribute and re-publishing
NativeAOT -- 5 of 6 TXB_ checks and CollUpdate_TVPresent fail without it
and all pass with it, so the assertions are non-vacuous. Full selftest
suite 1446 planned / 0 failures under JIT; TXB_ and
ControlUpdate_Collections green on the AOT-published host; Release build
of src/Reactor 0 warnings 0 errors.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
10d3a67 to
f862053
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/Reactor/Core/Element.cs:2563
- Attribute arguments in this file consistently use explicit array creation (e.g.
WrapControlled(... Events = new[] { ... })at src/Reactor/Core/Element.cs:3638). Using a collection expression (["Content"], []) inside an attribute is inconsistent with that pattern and may not be accepted by all compiler/lang-version combinations used by the repo.
Consider switching to explicit array creation for the attribute parameters.
[WinRT.GeneratedBindableCustomProperty(["Content"], [])]
425ab1c
into
main
…very scope The rebase onto #1108 changed the arithmetic: it dropped ControlUpdate_Collections, so DefaultAotSkipPatterns is 16 entries with this change's addition, not 17. TESTING.md, docs/aot-support.md and the CI workflow comment are all updated from measurement rather than inference — the AOT run emits exactly 16 \# SKIP crashes/hangs under NativeAOT\ lines, out of 19 skipped fixtures in a 1447-fixture run. (main's own docs said 16 before this change while the array held 15: the probe script's regex scrapes quoted strings out of that block and was counting a quoted term in a *comment* as a pattern. That quote is unquoted here, so the scraped count and the real count now agree.) Also narrows an overclaim in the AOT note. Forcing the fixture to run under --no-aot-skip shows the C#-authored DP *field* is undiscoverable too, so the limitation is reflection metadata in general, not something specific to CsWinRT-projected properties. Refs #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
…just fields (#1111) * fix(devtools): resolve DependencyProperty statics as properties, not just fields The `properties`, `setProperty` and attached-property MCP tools discovered DPs exclusively through `Type.GetField`/`GetFields`. CsWinRT projects WinUI `DependencyProperty` statics as static *properties*, so on WinUI 3 every lookup found nothing: `properties` returned {"count":0,"properties":[]} for every element and by-name lookups always answered "No DependencyProperty '<name>' found". `typeof(Button)` exposes 0 DP-typed static fields and 112 DP-typed static properties; `Grid.RowProperty` exists only as a property. JIT and NativeAOT were affected alike. Both member kinds are now resolved, fields first so C#-authored DPs (Reactor's own, third-party controls) keep working unchanged, and the enumeration dedupes on the trimmed property name so a DP surfacing as both is reported once. A failing static initializer / WinRT activation maps to "not found" instead of escaping as a raw TargetInvocationException, and the FlattenHierarchy lookups tolerate AmbiguousMatchException because the base-chain walk finds the declaring type on a later step anyway. Trim annotations were re-derived rather than copied: with every suppression removed, the analyzer reports IL2070 only inside TryReadDependencyPropertyStatic and CollectDependencyProperties, and IL2026 only in FindTypeByName. The old IL2026+IL2075 pair on FindDependencyProperty and IL2026+IL2075 on EnumerateDependencyProperties suppressed nothing once the reflection moved into those helpers, so they are gone rather than carried forward; the remaining justifications describe property-based discovery instead of talking only about fields. Fixes #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3 * test(devtools): prove DP discovery, and isolate the part trimming breaks The old assertions could not fail. `count >= 0` is true for an empty result, and the attached read/write accepted *either* success *or* any error, so both branches of the oracle coincided and the fixture passed whether or not the tool worked. `Devtools_PropReflect_FindDpHandled` and `Devtools_PropReflect_EnumeratesNoThrow` had the same shape. Replaced with oracles that redden when discovery breaks: count == length > 0, enumeration contains `Content` (ContentControl) and `Padding` (Control) so the base-chain walk is exercised, no duplicate names, a by-name read that pins value + declaringType + isLocal, and `setProperty` round-trips asserted off the live control (`Grid.GetRow(button) == 2`, `button.Width == 321`) rather than off the tool's own ok echo. Responses are matched with `is { }` instead of `?? throw` so one regression fails one check instead of aborting the fixture and hiding the rest. Mutation-checked: with only the property arms of the two lookups removed, all seven DP assertions fail and every unrelated check stays green. AOT: DP discovery does NOT survive trimming. WinUI's DP statics are CsWinRT-projected static properties and ILCompiler emits no reflection metadata for them unless something roots PublicProperties on those types, so under AOT the lookups find nothing. This was nearly mis-measured: a diagnostic calling typeof(Button).GetProperties() rooted that metadata itself — PublicProperties covers inherited members, so one probe revived all 112 DP statics and turned the fixture green. Deleting the probe reproduced the failures exactly. Rather than skip two whole fixtures and lose the 15 checks that do pass under AOT, the DP assertions move to their own Devtools_PropertyToolsDpDiscovery fixture and only that goes on DefaultAotSkipPatterns; resources, styles, ancestors and value formatting/parsing stay live AOT coverage. Verified with --no-aot-skip that the entry is not stale, and the full AOT suite is otherwise unchanged. Also unquoted "unknown-event" in the skip-list comment: probe-aot-skips.ps1 scrapes quoted strings out of that block, so a quoted term in a comment became a phantom 18th pattern. Refs #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3 * fix(devtools): cover the fields arm, and drop an unreachable guard Review follow-ups. Test coverage: every DP assertion so far ran against CsWinRT-projected static properties, so the *fields* arm — the pre-existing behaviour this change must not regress — was untested, and the mutation check could not have caught a regression there. No WinUI type can exercise it (typeof(Button) has zero DP-typed static fields), so DevtoolsFieldDpControl declares a real `public static readonly DependencyProperty`; by-name lookup and enumeration are both asserted against it, including its live value and declaring type. Also covered, with deterministic oracles rather than defensive hand-waving: a throwing static getter reads back as not-found (ReadStatic), and a write-only DP-typed static is skipped before GetValue(null) — which throws ArgumentException, deliberately not in ReadStatic's catch list, so that check reddens if the CanRead guard is dropped. Removed the two `catch (AmbiguousMatchException)` blocks. They were speculative: a precondition assertion written to justify them failed, showing that for a name-only lookup the binder applies hide-by-name and resolves to the most-derived declaration instead of throwing. That behaviour is now pinned for both member kinds, so the guards are gone rather than left as untestable branches. Error messages and schemas: `properties`/`setProperty` now document the `Owner.Property` syntax for attached DPs, which previously worked but was undiscoverable. A failed lookup on a type reporting zero DP statics now says so — under trimming a valid name reads back as "not found", and "Check the owner type name" sends the caller hunting for a typo that isn't there. Docs: TESTING.md and the CI workflow comment both stated the old AOT skip count and "two Devtools fixtures"; both are now 17 entries / three fixtures. Refs #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3 * docs(aot): correct the skip-list counts after #1108, and the DP-discovery scope The rebase onto #1108 changed the arithmetic: it dropped ControlUpdate_Collections, so DefaultAotSkipPatterns is 16 entries with this change's addition, not 17. TESTING.md, docs/aot-support.md and the CI workflow comment are all updated from measurement rather than inference — the AOT run emits exactly 16 \# SKIP crashes/hangs under NativeAOT\ lines, out of 19 skipped fixtures in a 1447-fixture run. (main's own docs said 16 before this change while the array held 15: the probe script's regex scrapes quoted strings out of that block and was counting a quoted term in a *comment* as a pattern. That quote is unquoted here, so the scraped count and the real count now agree.) Also narrows an overclaim in the AOT note. Forcing the fixture to run under --no-aot-skip shows the C#-authored DP *field* is undiscoverable too, so the limitation is reflection metadata in general, not something specific to CsWinRT-projected properties. Refs #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3 * fix(devtools): don't let an unreadable DP static hide a readable one Review catch. AddDependencyProperty claimed the name in \seen\ *before* confirming the static could be read, so a member that exists but throws on read consumed the name and a readable same-named member of the other kind further up the base chain was skipped — the DP vanished from the listing entirely. The name is now claimed only after a DependencyProperty has actually been read. Pinned by Devtools_Dp_UnreadableMemberDoesNotHideReadableOne: a control that hides a readable base DP *field* with a derived static property whose getter throws. Enumeration walks the derived type first, so the check reddens under the old ordering and passes under the new one — verified by restoring the old \!seen.Add(...)\ line and watching that single check, and only that check, fail. Also from review: the two \catch { }\ blocks around GetValue/ReadLocalValue now say why they are broad (they run arbitrary WinUI property-system code once per DP, and one bad row must not take down the listing), the fixture's two intentionally-empty catches say what the following H.Check does with the null, and one \== false\ is now \!\. Refs #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3 * style(devtools): satisfy the code-scanning rules on the new code Two CodeQL findings on code this PR introduced, both taken: DeclaresAnyDependencyProperty is an existence check on the error path only, so \.Any(...)\ says what it means and the allocation is irrelevant there. (The same suggestion on CollectDependencyProperties is declined on that thread — it is the hot path, its two loops are asymmetric, and the CanRead guard carries a comment that belongs next to the condition.) The two broad catches around GetValue / ReadLocalValue are now \catch (Exception)\ rather than bare \catch\. They stay broad on purpose — both run arbitrary WinUI property-system code once per DP across the WinRT ABI, and one bad row must degrade that row rather than the whole listing — but the intent is now explicit to both readers and analyzers. Refs #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3 * fix(devtools): report which exception made a DP unreadable Follow-up on the two remaining code-scanning threads, which ask for the broad catches around GetValue / ReadLocalValue to be narrowed to a fixed list of exception types. Declining the narrowing, for a reason specific to this call site: these run arbitrary WinUI property-system code — including third-party property getters and changed-callbacks — once per DP across the WinRT ABI, so the set of types that can come back is open-ended. Narrowing means the first control that throws something outside the list turns the whole \properties\ listing into a JSON-RPC error via McpDispatcher's own catch, instead of degrading one row. That is the failure mode the catch exists to prevent, and the behaviour is pre-existing — it moved here from EnumerateDependencyProperties. Taking the substance of the rule instead. The objection to a broad catch is that it hides the defect, so it no longer does: a failed read now reports \<error: COMException>\ rather than a bare \<error>\, which is strictly more useful in a diagnostic tool — the caller learns what went wrong instead of only that something did. The comment now states the trade and its consequence rather than just asserting the catch is deliberate. Refs #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3 * feat(devtools): make DependencyProperty discovery work under NativeAOT The previous commits fixed DP discovery under JIT and documented that it could not work under NativeAOT. Measuring the cost showed that conclusion was too pessimistic: it was based on the blunt way of rooting the metadata. Measured on samples/apps/hello-world-aot-devtools-on (win-x64, TrimMode=full, OptimizationPreference=Size): none (the #1109 bug) 11.655 MB -- preserve-all over Microsoft.WinUI 28.318 MB +16.663 MB (+143%) preserve-all on 11 common base types 12.609 MB +0.955 MB (partial) DP getters only (shipped) 13.196 MB +1.542 MB (+13.2%) Roughly 873 bytes per DependencyProperty. Rooting whole types costs eleven times as much for the same capability, because it keeps every member rather than the ~6 getters that matter. So Microsoft.UI.Reactor.Devtools now ships a generated ILLink descriptor rooting the 1851 DP static getters across 311 WinUI types, and Devtools_PropertyToolsDpDiscovery comes off DefaultAotSkipPatterns: all 18 of its checks pass on the AOT binary with no override flag. A descriptor rather than [DynamicallyAccessedMembers] because the Type reaching the lookups comes from el.GetType() / Type.BaseType, neither of which carries an annotation the trimmer can propagate from -- DAM has nothing to attach to. Apps with devtools off pay nothing. The descriptor is gated on the existing Reactor.DevtoolsSupport feature switch, and an app that references the package with the switch off builds byte-identically to one with no descriptor at all (6.733 MB either way, verified against its own control). Two liabilities handled rather than left implicit: Staleness. The descriptor is pinned to a Windows App SDK version, and a bump that adds DP statics would silently stop rooting them. The generator has a --check mode that regenerates and byte-compares, wired into the CI devtools job; validated with a positive control by tampering with the committed file and confirming it exits 1. Scope. The descriptor roots Microsoft.WinUI, so a DP declared on a control in the consumer's own assembly is still invisible under AOT. That is stated plainly in docs/aot-support.md rather than glossed, and tests/Reactor.AppTests.Host/ILLink.Descriptors.xml is the worked example -- it exists because the fixture's own test controls needed exactly that treatment. Refs #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3 * fix(devtools): don't let CRLF checkout fake a stale descriptor The generator emits LF; git hands a Windows clone CRLF. A byte-exact comparison therefore failed on every fresh clone, reporting the descriptor as stale when nothing had drifted -- a red CI job that means nothing, which is worse than no check at all because it trains people to ignore it. The comparison now normalises line endings. Verified across all four cases: LF passes, CRLF passes, real content drift still fails, and the restored file passes again. The CRLF case was reproduced as a genuine failure before the fix, so this is not a speculative guard. Refs #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3 * test(devtools): cover the failing-static-initializer path, without faking it Copilot flagged that ReadStatic's comment promises it maps a failing static initializer to not-found while catching neither TypeInitializationException nor anything it derives from. The premise is half right, and the half that is wrong matters: TypeInitializationException really does derive from SystemException, not MemberAccessException, but reflection never surfaces it bare. Measured on .NET 10, field read and property getter, first and subsequent access alike: TargetInvocationException -> TypeInitializationException -> InvalidOperationException So the existing first arm already covers it, and the extra arm I initially added was dead code. Removed, and the remark now records why the wrapping, rather than the type hierarchy, is what makes it unnecessary. Kept the coverage, because the behaviour was genuinely untested: a DP field on a type whose cctor throws now has its own check. Proving it is not vacuous required restructuring the fixture's TryRead helper first. It invoked the target reflectively, so an escaping exception crashed the fixture, and the obvious fix of swallowing that would have made every not-found assertion pass on a broken product. TryRead now reports whether the helper threw separately from what it returned, and the assertions require both. Mutation-checked: deleting ReadStatic's TargetInvocationException arm reddens Devtools_Dp_ThrowingGetterIsNotFound and Devtools_Dp_FailingInitializerIsNotFound independently, while Devtools_Dp_WriteOnlyPropertyIsNotFound correctly stays green, since that one is guarded by CanRead rather than by the catch. Refs #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3 * fix(devtools): catch TypeInitializationException, which NativeAOT throws bare Restores the arm removed in the previous commit. My measurement there was JIT only, and the two runtimes genuinely differ. On CoreCLR/JIT, reflection wraps a failing type initializer: TargetInvocationException -> TypeInitializationException -> InvalidOperationException so the first arm already covered it and the second looked like dead code. On NativeAOT the same read surfaces TypeInitializationException bare, and since it derives from SystemException rather than MemberAccessException, nothing else in ReadStatic catches it. One control with a failing static constructor would take down the entire properties call on an AOT build. Caught only because Devtools_PropertyToolsDpDiscovery now runs under AOT rather than being skipped: the check passed on JIT and failed on the AOT binary, which is exactly the class of divergence the un-skip was meant to expose. Had the fixture stayed on DefaultAotSkipPatterns this would have shipped. The remark on ReadStatic now records both runtimes rather than generalising from the one I happened to measure. Refs #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3 * feat(devtools): tell the caller when DP discovery is empty because of NativeAOT Reverts the ILLink descriptor and its generator, and replaces them with a message. Rooting WinUI's DependencyProperty statics did make discovery work under NativeAOT for +1.5 MB, but inspecting an AOT-published app with devtools is not the scenario the tool is for: an AOT publish takes 10-15 minutes, so the inner loop is Debug/JIT. Shipping it meant carrying a generated ~2500-line descriptor pinned to a Windows App SDK version plus a CI staleness gate that fires on every SDK bump -- 80% of this PR's diff, and recurring friction for everyone, to serve a path few will take. The measurements are kept in docs/aot-support.md and in the skip-list comment so the decision can be revisited without redoing the spike. What an AOT user gets instead is an honest answer. Previously an empty listing was indistinguishable from an element that genuinely has no DPs, and a by-name lookup failed with the same "not found" it gives for a typo -- sending the caller hunting for a mistake they did not make. Now the tool detects that the inspected app is a NativeAOT build and says so: `properties` attaches a `notice` to an empty listing, and a failed lookup appends the same explanation, both naming the trimming root as the fix. Detection is RuntimeFeature.IsDynamicCodeSupported -- the documented signal, substituted by ILCompiler and folded by the trimmer, so it costs nothing. This replaces the earlier per-type heuristic, which inferred trimming from a type reporting zero DPs; asking the runtime directly is both cheaper and correct for the case the user actually hits. Both messages are conditioned on the app really being NativeAOT, so a JIT build never sees them, and an AOT build that does root its DP statics stays silent. EnumerationNotice takes isNativeAot as a parameter rather than reading the ambient value, because the interesting branch only happens on AOT and the fixture covering it is AOT-skipped -- reading it directly would have left the notice logic untestable exactly where it matters. Mutation-checked both ways: forcing the notice on always reddens two checks, forcing it off reddens the AOT arm, and Devtools_Dp_NoticeMatchesListing couples the live result to the notice so it is meaningful on either runtime. Verified end-to-end on a real AOT binary with --no-aot-skip: count 0 and the notice on the wire. Suite is green both ways: JIT 1447 fixtures, 0 failed, 1 skipped; AOT 1447, 0 failed, 17 skipped (16 from DefaultAotSkipPatterns plus the by-design positive control). Refs #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3 * fix(devtools): only blame trimming when the metadata really is gone Review catch. The NativeAOT notice was appended to every by-name lookup failure whenever the app was an AOT build, including an AOT build that roots its DP statics -- where discovery works and a failed lookup really is a typo. That turns an ordinary mistake into a wild-goose chase, and contradicted the remark right above it claiming a working AOT build stays silent. Now both conditions are required: the app is NativeAOT *and* the type being searched reports no DP statics at all. Every live WinUI element has dozens, so zero is the tell that the metadata was trimmed rather than that the name was wrong. The AOT check is evaluated first, so a JIT build never pays for the reflection probe. Testing this needed the same treatment the enumeration notice already had. The combination that must stay silent -- AOT plus present metadata -- cannot be reproduced on a JIT run at all, so gating on the ambient value would have left it uncovered exactly where it matters. ShouldWarnAboutTrimming is pure and takes both inputs, and Devtools_Dp_TrimmingBlamedOnlyWhenMetadataIsGone drives all four combinations. Mutation-checked by reverting the gate to the reported bug: that check, and only that check, reddens. Devtools_Dp_UnknownNameErrors now also asserts the coupling on the live wire -- no notice where enumeration found DPs, notice where it found none -- so it is meaningful on either runtime rather than only the one the fixture runs on. Suite green both ways: JIT 1447/0 failed/1 skipped, AOT 1447/0 failed/17 skipped. Refs #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3 * docs(devtools): document the optional 'Property' suffix on setProperty, and pin it Review catches on the final head. The setProperty schema mentioned the attached-DP syntax but not that the 'Property' suffix is optional, while the properties schema said both. Same implementation behind them -- FindDependencyProperty via ToMemberName -- so the docs disagreed about one contract, in the very tool this PR repairs. Rather than just copy the sentence across, the claim is now enforced: Devtools_Dp_PropertySuffixIsOptional writes through 'WidthProperty' and 'Grid.RowProperty', asserts both off the live control, and reads one back. Values differ from the earlier writes so a no-op cannot pass. Mutation-checked by making ToMemberName append unconditionally: that check, and only that check, reddens. Also reworded the skip-list comment at two sites. 'fixtures whose reflection targets the trimmer removes' parses 'targets' as a verb on first read; it is now 'fixtures that reflect over members the trimmer removes'. The two instances in TESTING.md and docs/aot-support.md say 'whose reflection targets get trimmed', which is already unambiguous, so they are left alone. Refs #1109 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3 --------- Co-authored-by: z <z@z.z> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
Reactor builds two DataTemplates at runtime by handing XamlReader.Load a
markup string: the ContentControl shell every items control mounts
(ListView/GridView/FlipView), and the legacy text-node TreeView template.
Both exist only because DataTemplate could not be constructed from code.
microsoft-ui-xaml adds `new DataTemplate(DataTemplateElementFactory)`, which
takes a callback returning the subtree. This ports both templates onto it.
Beyond removing a runtime XAML parse, the TreeView template loses its
`{Binding Content.Content}`. A classic Binding resolves that path by string
through CsWinRT's ICustomPropertyProvider — reflection, which NativeAOT trims
unless the source type is annotated (that annotation is what #1108 added), and
which costs a reflective lookup per realized row even when it works. Reading
the same chain in a DataContextChanged handler is strongly typed: no
annotation needed, no lookup, and the event re-fires on recycling so reused
rows retext correctly.
The `[WinRT.GeneratedBindableCustomProperty]` attribute on TreeViewNodeData is
deliberately left in place. Reactor no longer needs it, but it is public API
surface that consumers binding to TreeViewNodeData themselves still rely on.
DO NOT MERGE YET. The constructor is gated behind
`[feature(Feature_ExperimentalApi)]` in microsoft-ui-xaml and has not shipped
in a public Windows App SDK, so CI cannot restore this branch: the versions in
Directory.Build.props are an internal experimental build and do not resolve
from public feeds. When the API ships, update those two versions and drop the
metapackage opt-out in the selftest host; no other change should be needed.
Validated against Microsoft.WindowsAppSDK.WinUI 3.0.0-experimental.260818.21
(the PR-built native core, Microsoft.ui.xaml.dll 3.3.0.2608): full selftest
suite 1447 planned / 0 failures, with the text-node TreeView fixture green on
both the mount and update arms.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. This branch replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: v0.1.0-preview.13 and every earlier tag predate #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes nothing away that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is now written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template via an escape hatch should do the same or annotate their own type. Also disambiguates the IElementFactory cref in IItemsRepeaterFactorySource. The Windows App SDK this branch targets adds Microsoft.UI.Xaml.IElementFactory alongside the existing Microsoft.UI.Xaml.Controls.IElementFactory, so the bare cref became ambiguous (CS0419) and failed the warnings-as-errors Release build. Points at the Controls one, which is what the member returns. Validated: src/Reactor Release build 0 warnings / 0 errors; selftest suite 1447 planned with only the known WindowLevel_RuntimeFlip_Topmost Z-order flake failing under full-suite load (passes 3/3 in isolation, unrelated to these files). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
Reactor builds two DataTemplates at runtime by handing XamlReader.Load a
markup string: the ContentControl shell every items control mounts
(ListView/GridView/FlipView), and the legacy text-node TreeView template.
Both exist only because DataTemplate could not be constructed from code.
microsoft-ui-xaml adds `new DataTemplate(DataTemplateElementFactory)`, which
takes a callback returning the subtree. This ports both templates onto it.
Beyond removing a runtime XAML parse, the TreeView template loses its
`{Binding Content.Content}`. A classic Binding resolves that path by string
through CsWinRT's ICustomPropertyProvider — reflection, which NativeAOT trims
unless the source type is annotated (that annotation is what #1108 added), and
which costs a reflective lookup per realized row even when it works. Reading
the same chain in a DataContextChanged handler is strongly typed: no
annotation needed, no lookup, and the event re-fires on recycling so reused
rows retext correctly.
The `[WinRT.GeneratedBindableCustomProperty]` attribute on TreeViewNodeData is
deliberately left in place. Reactor no longer needs it, but it is public API
surface that consumers binding to TreeViewNodeData themselves still rely on.
DO NOT MERGE YET. The constructor is gated behind
`[feature(Feature_ExperimentalApi)]` in microsoft-ui-xaml and has not shipped
in a public Windows App SDK, so CI cannot restore this branch: the versions in
Directory.Build.props are an internal experimental build and do not resolve
from public feeds. When the API ships, update those two versions and drop the
metapackage opt-out in the selftest host; no other change should be needed.
Validated against Microsoft.WindowsAppSDK.WinUI 3.0.0-experimental.260818.21
(the PR-built native core, Microsoft.ui.xaml.dll 3.3.0.2608): full selftest
suite 1447 planned / 0 failures, with the text-node TreeView fixture green on
both the mount and update arms.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. This branch replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: v0.1.0-preview.13 and every earlier tag predate #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes nothing away that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is now written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template via an escape hatch should do the same or annotate their own type. Also disambiguates the IElementFactory cref in IItemsRepeaterFactorySource. The Windows App SDK this branch targets adds Microsoft.UI.Xaml.IElementFactory alongside the existing Microsoft.UI.Xaml.Controls.IElementFactory, so the bare cref became ambiguous (CS0419) and failed the warnings-as-errors Release build. Points at the Controls one, which is what the member returns. Validated: src/Reactor Release build 0 warnings / 0 errors; selftest suite 1447 planned with only the known WindowLevel_RuntimeFlip_Topmost Z-order flake failing under full-suite load (passes 3/3 in isolation, unrelated to these files). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
Audits every PR merged since v0.1.0-preview.13 (56 commits) for changelog
coverage, then cuts the release section per docs/contributing/release-runbook.md.
Only 9 of those PRs updated CHANGELOG.md. Nine user-facing changes were missing
an entry and are added here:
Added - declarative window icon: icon: on ReactorApp.Run plus
Run(WindowSpec, ...) overloads (#1145, issue #1143)
Changed - dotnet new reactorapp resolves the latest Windows App SDK (#1096)
Fixed - connected animations never played across a replaced subtree (#1124)
- a controlled SelectedIndex WinUI cannot honor stranded an echo
token and ate the next real selection (issue #1090, #1091, #1097)
- legacy text-node TreeView rendered empty under NativeAOT (#1108)
- devtools DP lookups found nothing, since CsWinRT projects
DependencyProperty statics as properties (issue #1109)
- the exe-icon fallback was dead code, and WindowIcon.FromResource
silently applied a default icon in packaged apps (issue #1143)
- an installed mur was frozen at first bootstrap, and mur check
shipped without Roslyn (#1130)
- mur loc/docs help printed the non-existent "duct" command (#1129)
- a scaffolded project would not launch in Visual Studio 26 (#1084)
The three behaviour fixes were checked against v0.1.0-preview.13 rather than
assumed: the AOT skip for ControlUpdate_Collections, the
_pendingConnectedAnimationStarts list, and the drift-only SelectedIndex gates
all exist at the tag, so each shipped broken and none qualifies for the
introduced-and-fixed-in-window exemption.
Deliberately omitted: dependency bumps, docs-only and CI/test-infra work, and
#1099/#1102, whose product code was already correct (the defect was in a test
classifier and a text matcher respectively).
Bumps ReactorPublicVersion to 0.1.0-preview.14 and recompiles the guide, which
substitutes {{reactorVersion}} across 8 pages, satisfying the docs freshness gate.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
#1108 annotated TreeViewNodeData with [WinRT.GeneratedBindableCustomProperty] for exactly one reason: Reactor's own text-node TreeView template bound "Content.Content", and that string path is resolved by reflection, which NativeAOT trims. The preceding commit replaces that binding with a DataContextChanged handler, so the reason is gone -- there is now no {Binding} anywhere in src/ and no SetBinding call site. The attribute never shipped: every tag to date predates #1108, so no released build has it, and binding to TreeViewNodeData from a consumer-supplied template was already broken under NativeAOT in all of them. Removing it therefore takes away nothing that ever worked in a release; it declines to keep a side effect of an internal fix. Keeping it would carry a workaround, plus `partial` on a public record, for a scenario Reactor does not use and does not document. The limitation is written down instead: docs/aot-support.md gains a row explaining that a classic {Binding} in a hand-supplied DataTemplate is not trim-safe, that Reactor's own templates avoid it by populating content in a DataContextChanged handler, and that a consumer installing their own template through an escape hatch should do the same or annotate their own type. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 17bce8bb-d57a-4f76-a55d-27c9029fc9a3
The bug
The legacy node-mode TreeView renders node text through a classic
{Binding}—Reconciler.TreeViewTextItemTemplateresolvesContent.Content, hoppingTreeViewNode.Content(native WinRT) →TreeViewNodeData.Content(a managed record property).That managed hop goes through CsWinRT's
ICustomPropertyProvider, which is reflection-based. NativeAOT trims it and the TextBlock silently renders empty — with no build-time warning, because the reflection happens across the WinRT ABI where the IL trim analyzers can't see it. The publish reports zero IL2xxx/IL3xxx.The fix
Annotate
TreeViewNodeDatawith[WinRT.GeneratedBindableCustomProperty]so the CsWinRT generator emits strongly-typed binding metadata (explicit interface implementation + static lambdas — no public API surface added,api.txtunchanged).Scoped to
"Content"deliberately: it's the only member the template binds, and the unscoped overload also emits an accessor for the[Obsolete]ContentElement, which fails the warnings-as-errors Release build withCS0618.This was not theoretical
ControlUpdate_Collectionsmounts a text-mode TreeView and asserts its node text renders. It has been sitting inDefaultAotSkipPatternsas an unexplained "control-collection assertion still under investigation".It was this bug all along. The skip is removed, so that fixture now guards the fix.
New coverage
Every existing
TTV_*fixture passes aviewBuilder, which routes to theSharedContentControlTemplateshell and never exercises the binding template — so this path had no direct coverage. The new fixture isolates it, and its assertions search the live visual tree for the bound strings, so they fail if the resolution regresses.Verification
CollUpdate_TVPresent, 3/3 reproducible)Full selftest suite: 1446 planned, 0 failures under both JIT and NativeAOT. Release build of
src/Reactor: 0 warnings, 0 errors.Note
There is a follow-up direction where the template uses a strongly-typed
DataContextChangedhandler instead of a{Binding}— reflection-free outright rather than reflection-made-trimmable. That needs WinUI's code-basedDataTemplateAPI (microsoft-ui-xaml#11260) to construct the template from code, so it can't land until that ships. This PR fixes the scenario on today's WinAppSDK.