Botframework-emulator: Can't render adaptive cards

Created on 14 Aug 2018  路  4Comments  路  Source: microsoft/BotFramework-Emulator

I'm having this issue with the latest version (4.0.15 alpha). The adaptive cards work on final channels (Slack, Teams, etc) but the emulator can't render the cards itself.

Emulator | Teams

```c#
AdaptiveCard card = new AdaptiveCard();
card.Body = new List()
{
new AdaptiveTextBlock()
{
Text = "Lorem ipsun"
},
new AdaptiveDateInput()
{
Value = DateTime.Now.ToShortDateString()
},
new AdaptiveTimeInput()
{
Value = DateTime.Now.ToShortTimeString()
}
};

var msg = context.MakeMessage();
msg.Attachments.Add(
new Attachment()
{
Content = card,
ContentType = "application/vnd.microsoft.card.adaptive",
Name = "Lorem Ipsun"
}
);

await context.PostAsync(msg);
context.Wait(this.MessageReceived);
```

Issues read: #244 and #286

Bug WebChat

Most helpful comment

I installed Bot Emulator 4 and still go the same error. However, I was able to open Developer mode and saw the error in console "All inputs must have a unique Id". I fixed it via code below


card.Body = new List()
{
new TextBlock()
{
Text = "Lorem ipsun"

},
new DateInput()
{
Value = DateTime.Now.ToShortDateString(),
Id = "diFromDate"
},
new TimeInput()
{
Value = DateTime.Now.ToShortTimeString(),
Id = "tiFromTime"
}
};

All 4 comments

Thank you for the submission. There were a number of issues related to adaptive cards that were closed recently in the Botframework-WebChat repo. We have incorporated most of these changes into the v4 branch which should go out with the next build.

Leaving this open until the fix is confirmed.

I installed Bot Emulator 4 and still go the same error. However, I was able to open Developer mode and saw the error in console "All inputs must have a unique Id". I fixed it via code below


card.Body = new List()
{
new TextBlock()
{
Text = "Lorem ipsun"

},
new DateInput()
{
Value = DateTime.Now.ToShortDateString(),
Id = "diFromDate"
},
new TimeInput()
{
Value = DateTime.Now.ToShortTimeString(),
Id = "tiFromTime"
}
};

Thanks @dkonyayev! Now it works.
I also didn't knew about this "Developer Mode" (pretty much the chrome F12 overlay), so thanks again!

Now related to the issue: is this _"All inputs must have a unique Id"_ restriction valid only for the Emulator? I mean, the cards were rendering on Teams and Slack without this change.
Should they keep displaying the cards with the missing Ids? Or is the Emulator's _"can't render card"_ message the right approach?

Was this page helpful?
0 / 5 - 0 ratings