Skip to content

[iOS][Rendering] Crash occurs when ColumnSet has height: stretch #4105

@JohnnyKehr

Description

@JohnnyKehr

Platform

iOS

Author or host

Host on Webex Teams

Version of SDK

We have our own fork of AdaptiveCards@v1.2.6

Details

A crash occurs when a card is rendered that has a ColumnSet component with items that have the property height set to stretch (see json card example below. The offending code is linked here. Commenting out this block of code results in no crash happening.

Here's the actual crash with a few of the top frames: 



2020-06-03 11:02:18.812072-0700 Teams[68732:8015353] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to activate constraint with anchors <NSLayoutDimension:0x600002426800 "ACRContentHoldingUIScrollView:0x7fd4969f1a00.height"> and <NSLayoutDimension:0x600002426840 "ACRContentHoldingUIView:0x7fd445e981f0.height"> because they have no common ancestor.  Does the constraint or its anchors reference items in different view hierarchies?  That's illegal.'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff23e39f0e __exceptionPreprocess + 350
	1   libobjc.A.dylib                     0x00007fff50ad79b2 objc_exception_throw + 48
	2   Foundation                          0x00007fff25aa87d2 -[NSLayoutConstraint setActive:] + 0
	3   AdaptiveCards                       0x000000010e43e47b +[ACRRenderer render:rootView:inputs:withCardElems:andHostConfig:] + 1899
	4   AdaptiveCards                       0x000000010e40ac71 -[ACRColumnRenderer render:rootView:inputs:baseCardElement:hostConfig:] + 1649
	5   AdaptiveCards                       0x000000010e438fe4 -[ACRColumnSetRenderer render:rootView:inputs:baseCardElement:hostConfig:] + 3204
	6   AdaptiveCards                       0x000000010e43e357 +[ACRRenderer render:rootView:inputs:withCardElems:andHostConfig:] + 1607
	7   AdaptiveCards                       0x000000010e43d03d +[ACRRenderer renderWithAdaptiveCards:inputs:context:containingView:hostconfig:] + 2109
	8   AdaptiveCards                       0x000000010e3a7990 -[ACRView render] + 560
	9   AdaptiveCards                       0x000000010e3a74c1 -[ACRView init:hostconfig:widthConstraint:delegate:] + 1473
	10  AdaptiveCards                       0x000000010e43c18d +[ACRRenderer render:config:widthConstraint:delegate:] + 237

An example of a card that causes the crash:


{
   "type":"AdaptiveCard",
   "$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
   "version":"1.1",
   "body":[
      {
         "text":"Text Block",
         "type":"TextBlock"
      },
      {
         "type":"TextBlock",
         "text":"Available videos",
         "size":"Medium",
         "weight":"Bolder"
      },
      {
         "type":"TextBlock",
         "text":"Please choose the video to play",
         "wrap":true
      },
      {
         "type":"ColumnSet",
         "columns":[
            {
               "type":"Column",
               "items":[
                  {
                     "type":"TextBlock",
                     "text":"Video1",
                     "weight":"lighter",
                     "size":"small",
                     "isSubtle":true
                  },
                  {
                     "type":"Image",
                     "height":"stretch",
                     "altText":"Video1",
                     "url":"0"
                  },
                  {
                     "type":"ActionSet",
                     "height":"stretch",
                     "actions":[
                        {
                           "title":"Play",
                           "type":"Action.OpenUrl",
                           "url":"https://www.google.com"
                        }
                     ]
                  }
               ],
               "width":"stretch"
            },
            {
               "type":"Column",
               "items":[
                  {
                     "type":"TextBlock",
                     "text":"Video2",
                     "weight":"lighter",
                     "size":"small",
                     "isSubtle":true
                  },
                  {
                     "type":"Image",
                     "altText":"Borocillina",
                     "height":"stretch",
                     "url":"1"
                  },
                  {
                     "type":"ActionSet",
                     "height":"stretch",
                     "actions":[
                        {
                           "type":"Action.OpenUrl",
                           "title":"Play",
                           "url":"https://www.google.com"
                        }
                     ]
                  }
               ],
               "width":"stretch"
            },
            {
               "type":"Column",
               "items":[
                  {
                     "type":"TextBlock",
                     "text":"Video3",
                     "weight":"lighter",
                     "size":"small",
                     "isSubtle":true
                  },
                  {
                     "type":"Image",
                     "title":"Video3",
                     "height":"stretch",
                     "url":"2"
                  },
                  {
                     "type":"ActionSet",
                     "height":"stretch",
                     "actions":[
                        {
                           "type":"Action.OpenUrl",
                           "title":"Play",
                           "url":"https://www.google.com"
                        }
                     ]
                  }
               ],
               "width":"stretch"
            }
         ]
      }
   ]
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions