microsoft / microsoft/AdaptiveCards

[Bug] [Templating] [dot net] stringOrValue pre-built function throws exception when encountering \"

Open
#6,691 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Inconsistency Area-Templating Platform-.NET
Dominant language
C#
Stars
2k
Forks
595
Avg merge
1d 19h
Merged PRs (30d)
1

Description

Problem Description

For an adaptive card with the text as
"text": "Title: ${title == \"\"}"
When I do a stringOrValue("Title: ${title == \"\"}") -> The dot net library throws an Invalid expression format exception,

whereas the same text works when tried through the designer (Attached the screenshot below).

Dot net SDK version: 1.2.1

Card JSON
Sample json:
{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "size": "Medium",
            "weight": "Bolder",
            "text": "Title: ${title == \"\"}",
            "$when": "${title!=\"\"}"
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.5"
}
Screenshot

Input in designer:
image

Output:
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied Adaptive Card expression with the .NET SDK version 1.2.1, focusing on the stringOrValue pre-built function. Done means the expression containing an escaped quote no longer throws Invalid expression format and behaves like it does in the designer.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.