Skip to content

Carousel element throws STOWED_EXCEPTION during XAML layout pass #9376

Description

@karan68

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions