AdaptiveCards: [Rendering] Discrepancy (in js and C# libraries) while rendering an AC template containing an invalid "$when" condition

Target Platforms

NodeJS

SDK Version

latest

Application Name

Microsoft Search

Problem Description

We observe that, when the Adaptive card contains an invalid $when condition (an example of which is given below)

Example: “$when”: “https://searchuxcdn.azureedge.net/designerapp/images/servicenow-icon.png!=\“\”

The C# Templating library throws an exception, when we try to bind the template with data -> adaptiveTemplate.Expand(source), with the following exception message: “String was not recognized as a valid Boolean.”

However, the JS library treats it as a valid string and displays the result evaluating the condition to true. Can this discrepancy be fixed ?

Screenshots

No response

Card JSON

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "size": "Medium",
            "weight": "Bolder",
            "text": "${title}",
            "$when": "https://searchuxcdn.azureedge.net/designerapp/images/servicenow-icon.png!=\"\""
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5"
}

Sample Code Language

C#

Sample Code

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (14 by maintainers)

Most upvoted comments

@anna-dingler

Can you elaborate on what constitutes invalid? for example, does invalid include syntax error in template language and run time error at AEL?

When you say returning false, do you implying dropping adaptive element that has when?