microsoft / AdaptiveCards

A new way for developers to exchange card content in a common and consistent way.
https://adaptivecards.io
MIT License
1.75k stars 550 forks source link

[Rendering] Android App crash with cards using specified (px) image height (ACL 2.8.0) #6748

Closed manujai closed 2 years ago

manujai commented 2 years ago

Target Platforms

Android

SDK Version

2.8.0

Application Name

Cisco Webex

Problem Description

Android App consuming the latest ACL 2.8.0 is crashing for cards that use images with specified height in px.

Images with height auto and stretch work fine. It's the Image height given in pixels that causes issues.

Note: Previous versions before 2.8.0 work fine and are able to render such cards.

Upon further investigation through Android Studio, the app sends a A/libc: SIGABRT Signal when trying to parse the height in the object model method - AdaptiveCards::HeightTypeFromString(param) [Screenshot attached of the stack trace]

Please comment if further info is required.

Screenshots

The below gif shows a rendering of a card in Android ACL 2.7.0 (which works) and the same card in Android ACL 2.8.0 which crashes the app ezgif-7-020dfc94b0c6

Screenshot 2021-11-17 at  04 29 7PM

Card JSON

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.2",
    "body": [
        {
            "type": "ColumnSet",
            "columns": [
                {
                    "type": "Column",
                    "items": [
                        {
                            "type": "Container",
                            "backgroundImage": "http://messagecardplayground.azurewebsites.net/assets/TxP_Background.png",
                            "items": [
                                {
                                    "type": "Image",
                                    "horizontalAlignment": "Center",
                                    "url": "https://messagecardplayground.azurewebsites.net/assets/TxP_Flight.png"
                                }
                            ],
                            "bleed": true
                        },
                        {
                            "type": "Container",
                            "spacing": "None",
                            "style": "emphasis",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "size": "ExtraLarge",
                                    "weight": "Lighter",
                                    "color": "Accent",
                                    "text": "Flight to Kansas",
                                    "wrap": true
                                },
                                {
                                    "type": "TextBlock",
                                    "spacing": "Small",
                                    "text": "American Airlines Flight 24",
                                    "wrap": true
                                },
                                {
                                    "type": "TextBlock",
                                    "spacing": "None",
                                    "text": "Confirmation code: 57DY2",
                                    "wrap": true
                                },
                                {
                                    "type": "TextBlock",
                                    "spacing": "None",
                                    "text": "5 hours, 2 minutes",
                                    "wrap": true
                                }
                            ],
                            "bleed": true,
                            "height": "stretch"
                        }
                    ],
                    "width": 45,
                    "height": "stretch"
                },
                {
                    "type": "Column",
                    "items": [
                        {
                            "type": "Container",
                            "height": "stretch",
                            "items": [
                                {
                                    "type": "ColumnSet",
                                    "columns": [
                                        {
                                            "type": "Column",
                                            "items": [
                                                {
                                                    "type": "TextBlock",
                                                    "size": "ExtraLarge",
                                                    "weight": "Lighter",
                                                    "text": "SJC"
                                                }
                                            ],
                                            "width": "auto"
                                        },
                                        {
                                            "type": "Column",
                                            "verticalContentAlignment": "Center",
                                            "items": [
                                                {
                                                    "type": "Image",
                                                    "url": "https://messagecardplayground.azurewebsites.net/assets/graydot2x2.png",
                                                    "width": "10000px",
                                                    "height": "2px"
                                                }
                                            ],
                                            "width": "stretch"
                                        },
                                        {
                                            "type": "Column",
                                            "spacing": "Small",
                                            "verticalContentAlignment": "Center",
                                            "items": [
                                                {
                                                    "type": "Image",
                                                    "url": "https://messagecardplayground.azurewebsites.net/assets/smallairplane.png",
                                                    "height": "16px"
                                                }
                                            ],
                                            "width": "auto"
                                        },
                                        {
                                            "type": "Column",
                                            "items": [
                                                {
                                                    "type": "TextBlock",
                                                    "horizontalAlignment": "Right",
                                                    "size": "ExtraLarge",
                                                    "weight": "Lighter",
                                                    "text": "MCI"
                                                }
                                            ],
                                            "width": "auto"
                                        }
                                    ]
                                },
                                {
                                    "type": "ColumnSet",
                                    "columns": [
                                        {
                                            "type": "Column",
                                            "items": [
                                                {
                                                    "type": "TextBlock",
                                                    "size": "Medium",
                                                    "text": "11:30 AM"
                                                }
                                            ],
                                            "width": 1
                                        },
                                        {
                                            "type": "Column",
                                            "items": [
                                                {
                                                    "type": "TextBlock",
                                                    "horizontalAlignment": "Right",
                                                    "size": "Medium",
                                                    "text": "4:35 PM"
                                                }
                                            ],
                                            "width": 1
                                        }
                                    ]
                                },
                                {
                                    "type": "ColumnSet",
                                    "spacing": "None",
                                    "columns": [
                                        {
                                            "type": "Column",
                                            "items": [
                                                {
                                                    "type": "TextBlock",
                                                    "text": "December 14, 2021",
                                                    "isSubtle": true,
                                                    "wrap": true
                                                }
                                            ],
                                            "width": 1
                                        },
                                        {
                                            "type": "Column",
                                            "items": [
                                                {
                                                    "type": "TextBlock",
                                                    "horizontalAlignment": "Right",
                                                    "text": "December 14, 2021",
                                                    "isSubtle": true,
                                                    "wrap": true
                                                }
                                            ],
                                            "width": 1
                                        }
                                    ]
                                },
                                {
                                    "type": "ColumnSet",
                                    "spacing": "None",
                                    "columns": [
                                        {
                                            "type": "Column",
                                            "items": [
                                                {
                                                    "type": "TextBlock",
                                                    "text": "San Jose",
                                                    "isSubtle": true
                                                }
                                            ],
                                            "width": 1
                                        },
                                        {
                                            "type": "Column",
                                            "items": [
                                                {
                                                    "type": "TextBlock",
                                                    "horizontalAlignment": "Right",
                                                    "text": "Kansas",
                                                    "isSubtle": true
                                                }
                                            ],
                                            "width": 1
                                        }
                                    ],
                                    "height": "stretch"
                                },
                                {
                                    "type": "ActionSet",
                                    "separator": true,
                                    "actions": [
                                        {
                                            "type": "Action.Submit",
                                            "title": "Check In",
                                            "style": "Positive",
                                            "data": {
                                                "action": "checkIn"
                                            }
                                        },
                                        {
                                            "type": "Action.Submit",
                                            "title": "View in Calendar",
                                            "data": {
                                                "action": "viewInCalendar"
                                            }
                                        }
                                    ],
                                    "spacing": "Medium"
                                }
                            ]
                        }
                    ],
                    "width": 55
                }
            ]
        }
    ]
}

Sample Code Language

Java

Sample Code

AdaptiveCardObjectModel.java

public static HeightType HeightTypeFromString(String t) { return HeightType.swigToEnum(AdaptiveCardObjectModelJNI.HeightTypeFromString(t)); }

jonmill commented 2 years ago

@JeanRoca - another WebEx item to follow-up on

rankush commented 2 years ago

This issue was observerd on 2.8.0. In newer versions 2.8.2 , this is issue is not seen for the same card which was crashing on 2.8.0.

Please close this issue