microsoft / microsoft/AdaptiveCards

Carousel element throws STOWED_EXCEPTION during XAML layout pass

Open
#9,376 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
2k
Forks
595
Avg merge
1d 19h
Merged PRs (30d)
1

Description

The Carousel renderer in AdaptiveCarouselRenderer.cpp has multiple unguarded code paths that cause crashes:

  1. SelectionChanged handlerFlipView.SelectionChanged fires with SelectedIndex = -1 during Items().Append(). Handler calls pipsPager.SelectedPageIndex(-1)InvalidOperationException.

  2. SetFlipViewMaxHeight — Called from LayoutUpdated event (outside the Render try-catch). GetAt(SelectedIndex()) called without bounds check (SelectedIndex can be -1). try_as<FrameworkElement>() result used without null check before .Measure().

  3. Render looptry_as<FrameworkElement>() result chained directly into .LayoutUpdated() without null check.

  4. InitialPage — Index not validated against Items().Size().

Watson callstack (crash point)
  • Frame 0: CLayoutManager::UpdateLayout (layoutmanager.cpp:469)
  • Frame 1: CCoreServices::NWDrawTree
  • Frame 2: CCoreServices::NWDrawMainTree
  • Frame 3: CWindowRenderTarget::Draw
Repro steps
  1. Build and run source/uwp/winui3/SimpleVisualizer/SimpleVisualizer.sln
  2. Click "Show Adaptive Card" (loads Clipchamp-style Carousel template)
  3. App crashes with InvalidOperationException

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in AdaptiveCarouselRenderer.cpp and trace the SelectionChanged handler, SetFlipViewMaxHeight from LayoutUpdated, the Render loop, and InitialPage validation. Build source/uwp/winui3/SimpleVisualizer/SimpleVisualizer.sln and reproduce the carousel flow; done means the listed invalid selections, null elements, and out-of-range initial index no longer crash layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.