Skip to content

XAML/UWP: incomplete (Win32-only) tree returned silently while app is still loading #27

Description

@asklar

Summary

When targeting a UWP/XAML (and likely WinUI3) app that is still initializing, lvt silently returns a Win32-only tree (no XAML content), with no warning and exit code 0. An AI agent targeting a just-launched app therefore gets an incomplete tree and cannot tell it's incomplete.

Repro (Calculator, cold start)

Kill Calculator, relaunch, and dump repeatedly right after the window appears:
\
dump1-5: 4 elements calcXaml=False (~100ms each) <- Windows.UI.Xaml not loaded yet
dump6-8: 617 elements calcXaml=True (~7700ms each) <- full stitched tree
\
The ApplicationFrameHost window appears within ~250ms, but the hosted app process hasn't loaded its XAML tree yet, so framework detection finds no XAML and lvt returns the Win32 skeleton only.

Impact

  • Partial output with no error signal; bad for agents and for cross-invocation element identity (the tree content itself is nondeterministic during startup).

Proposed

  • When XAML/WinUI is expected (host has the runtime) but the collected tree is empty/degenerate, retry with a short backoff.
  • Add an opt-in --wait /--retry\ and/or emit a clear stderr warning when the tree looks incomplete.
  • Found during PR Durable element identity (stable keys) + --query #26 validation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions