[Rendering] Discrepancy (in js and C# libraries) while rendering an AC template containing an invalid "$when" condition
See original GitHub issueTarget 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
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (14 by maintainers)
Top Results From Across the Web
Vue template or render function not defined yet I am using ...
In my case, I was getting the error because I upgraded from Laravel Mix Version 2 to 5. In Laravel Mix Version 2,...
Read more >Conditional Rendering | Vue.js
The directive v-if is used to conditionally render a block. The block will only be rendered if the directive's expression returns a truthy...
Read more >Render Functions & JSX
Declaring Render Functions . When using templates with Composition API, the return value of the setup() hook is used to expose data to...
Read more >v-if vs. v-show - Vue Conditional Rendering
Conditional rendering is the ability to control whether or not template code is rendered. We can do this using the current state of...
Read more >A list of open source C++ libraries
The objective of this page is to build a comprehensive list of open source C++ libraries, so that when one needs an implementation...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub 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
?I agree with the proposed resolution: if
$when
is specified, it cannot be ignored (as opposed to what JS currently does). If it’s not an expression, if it’s an expression that doesn’t return a Boolean, or if it’s an invalid expression, it should always returnfalse
. Throwing (as .NET currently does in one case) isn’t desirable IMO.