microsoft / microsoft/AdaptiveCards

[Rendering] `merge` built-in function has different behavior between platforms

Open
#8,977 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Target Platforms

Other

SDK Version

24.05

Application Name

None in particular

Problem Description

The result of merge function varies too much between WinUI3 and Designer:
If merge is done between the following JSONs:

  • json_2
    {
        "test":{
            "val_1": 1
            "unique_1": true
        },
        "val_2": 1
    }
    
  • json_2
    {
        "test":{
            "val_1": 2,
            "unique_2": true
        },
        "val_2": 2
    }
    
merge use Designer WinUI3 Expected
merge(json_1, json_2) {"test":{"val_1":2,"unique_2":true},"val_2":2} {"test":{"val_1":1,"unique_2":true,"unique_1":true},"val_2":2} {"test":{"val_1":2,"unique_2":true,"unique_1":true},"val_2":2}
merge(json_2, json_1) {"test":{"val_1":1,"unique_1":true},"val_2":1} {"test":{"val_1":2,"unique_1":true,"unique_2":true},"val_2":1} {"test":{"val_1":1,"unique_1":true,"unique_2":true},"val_2":1}

Issues found:

  • Designer replaces all the nested JSONs (You can observe unique_1 and unique_2 are never present in the same merge result)
  • WinUI3 does not replace values in nested JSONs (i.e. val_1 is always equal to the value of the first JSON)
Screenshots

No response

Card JSON
{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.6",
    "$data": {
        "json_1":{
            "test":{
                "val_1": 1,
                "const_1": true
            },
            "val_2": 1
        },
        "json_2":{
            "test":{
                "val_1": 2,
                "const_2": true
            },
            "val_2": 2
        }
    },
    "body": [
        {
            "type": "TextBlock",
            "$data": "${merge(json_1, json_2)}",
            "text": "${jsonStringify($data)}",
            "wrap": true
        },
        {
            "type": "TextBlock",
            "$data": "${merge(json_2, json_1)}",
            "text": "${jsonStringify($data)}",
            "wrap": true
        }
    ]
}
Sample Code Language

No response

Sample Code

No response

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 with the merge built-in on Designer and WinUI3, then trace the separate rendering paths that evaluate merge. Compare both outputs with the expected nested-object merge behavior shown in the issue. Done means both platforms preserve unique keys and apply the later value for duplicate keys consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.