Repository navigation
Commit 72438b9
committed
fix(extractor): restrict XAML DataContext-ownership to the ROOT element (Codex P2)
XamlDeclaresOwnedDataContext matched ANY `*.DataContext` property-element in the
sibling XAML. But the code-behind's `this.DataContext` is the ROOT element's, so a
nested `<Grid.DataContext><ChildVm/>` (a different element's DataContext) would wrongly
mark the whole `.xaml.cs` as owning — silently dropping a real OWN001 on the root's
injected/bound VM. Now: strip comments / processing-instructions, find the root element
tag, and match only `<Root.DataContext>` with a constructed (type-instantiation) child.
The InjectedDcView control XAML gains exactly this shape — a BOUND root DataContext
plus a nested `<Grid.DataContext><local:NestedChildVm/>` — so the existing "must warn"
assertion now also guards the root-restriction (without it the nested construction
would make the view look owned and the subscription would be wrongly suppressed).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg8kSk1YT14x7A1vo5zgED1 parent cb2bcc3 commit 72438b9
2 files changed
Lines changed: 36 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
253 | 257 | | |
254 | 258 | | |
255 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
256 | 271 | | |
257 | 272 | | |
258 | 273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
8 | 18 | | |
0 commit comments