microsoft / microsoft/AdaptiveCards

[Designer] `CodeBlock` element not recognized for Teams

Open
#9,105 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
2k
Forks
595
Avg merge
1d 19h
Merged PRs (30d)
1

Description

The Adaptive Card Designer does not seem to recognize CodeBlock elements.

You can replicate by copying the example from MS Teams Adaptive Card docs into the Designer.

Error from Designer:

Image

Code snippet:

{
  "$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "1.5",
  "body": [
    {
      "type": "TextBlock",
      "text": "editor.js",
      "style": "heading"
    },
    {
      "type": "TextBlock",
      "text": "Lines 61 - 76"
    },
    {
      "type": "CodeBlock",
      "codeSnippet": "/**\n* @author John Smith <john.smith@example.com>\n*/\npackage l2f.gameserver.model;\n\npublic abstract strictfp class L2Char extends L2Object {\n  public static final Short ERROR = 0x0001;\n\n  public void moveTo(int x, int y, int z) {\n    _ai = null;\n    log(\"Shouldn't be called\");\n    if (1 > 5) { // what!?\n      return;\n    }\n  }\n}",
      "language": "java",
      "startLineNumber": 61
    }
  ],
  "actions": [
    {
      "type": "Action.OpenUrl",
      "title": "View in Azure Repos",
      "url": "https://azure.microsoft.com/en-us/products/devops/repos/"
    },
    {
      "type": "Action.OpenUrl",
      "title": "Edit in vscode.dev",
      "url": "https://vscode.dev/"
    }
  ]
}

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 in the Adaptive Card Designer and reproduce the issue with the CodeBlock example from the linked Microsoft Teams Adaptive Card documentation. Trace how the Designer handles the CodeBlock element, then verify that the example is recognized without the reported error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.