Skip to content

[Cmdpal] Nested comments ContentPage (Action.ShowCard with data-bound required Input) crashes/hangs the host #49359

Description

Microsoft PowerToys version

Dev build (main, ARM64 Debug) as of the current Command Palette JS/TS extensions work.

Installation method

Dev build in Visual Studio

Area(s) with issue?

Command Palette

Steps to reproduce

  1. Build and run Command Palette (Microsoft.CmdPal.UI), Debug.
  2. Open the built-in C# Sample Pages extension (SamplePagesExtension).
  3. Navigate to the "View Posts" page (SampleCommentsPage) - the nested-comments sample that renders a TreeContent whose nodes are FormContent AdaptiveCards.

This reproduces with the shipping C# SamplePagesExtension alone. It also reproduces with the equivalent JavaScript sample from the in-progress JS/TS extensions work, because that sample hands the host a byte-identical AdaptiveCard/tree. Both trigger the same underlying failure, which confirms the defect is in the host render path, not in the extension transport.

✔️ Expected Behavior

The nested comments page renders: a markdown root plus a tree of posts, each post being an AdaptiveCard form with an Action.ShowCard reply card.

❌ Actual Behavior

The host crashes or hangs while rendering the page.

  • On x64 the process fails with a native second-chance exception surfaced in the debugger as System.ExecutionEngineException (dialog: "An unhandled win32 exception occurred in [PID] Microsoft.CmdPal.UI.exe"). It is pinned to Program.Main -> Application.Start (the top managed frame on the UI thread), which is just the message pump, indicating a native fault with no managed frames above it.
  • On ARM64 the same page hangs (UI thread parked in the native WinUI pump inside IApplicationStaticsMethods.Start, all managed threads idle/waiting, no thrown managed exception with a captured stack on the heap).

The failure is native and uncatchable, so the managed try/catch in ContentFormViewModel.TryBuildCard cannot intercept it (that guard only covers the managed template expansion and object-model parse, not the WinUI AdaptiveCardRenderer.RenderAdaptiveCard call in ContentFormControl).

Additional Information

Root-cause analysis (from crash-dump inspection plus static comparison):

  • The AdaptiveCard the host builds is identical whether the content comes from the C# sample or the JS sample: same TemplateJson, same expanded DataJson, same tree shape (root markdown -> 3 posts -> replies, depth 3), same StateJson default (empty string in both). So the host produces and renders the same card object either way.
  • The card that triggers it is the PostForm template in SampleCommentsPage.cs: an Action.ShowCard whose nested card contains a data-bound Input.Text using "$data": "${replyCard.fields}" with "isRequired": "${required}" (required = true) and the same input id ("ReplyBody") repeated across every rendered form. Several of these forms render simultaneously inside the tree.
  • Managed heap shows only the CLR-preallocated ExecutionEngineException/StackOverflowException/OutOfMemoryException singletons (always present; not proof of a managed throw). No custom exception object with a captured stack. This is consistent with a native fault in the AdaptiveCards WinUI3 renderer / XAML layout rather than a managed exception.

Suggested next steps for the owner:

  • Reproduce with the C# SamplePagesExtension "View Posts" page only (no JS involved).
  • Narrow the minimal trigger: nested Action.ShowCard + templated/data-bound Input.Text with isRequired, rendered inside TreeContent, and/or repeated input ids across sibling cards.
  • Consider hardening the host so a native render failure in one form cannot fail-fast the whole process (for example, isolating/guarding AdaptiveCardRenderer.RenderAdaptiveCard per form), and/or a fix in the AdaptiveCards renderer version in use.

Other Software

AdaptiveCards (AdaptiveCards.ObjectModel.WinUI3 / AdaptiveCards.Templating) as referenced by Microsoft.CmdPal.UI.

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions