Forum Discussion
Adaptive Card not sending data on iOS Teams app
I'm on iOS 15.3.1
protected override async Task<InvokeResponse> OnInvokeActivityAsync(ITurnContext<IInvokeActivity> turnContext, CancellationToken cancellationToken)
{
if (turnContext.Activity.Name == "adaptiveCard/action")
{
await turnContext.SendActivityAsync(new Activity { Type = ActivityTypes.Typing }, cancellationToken);
ChatActivities chat = new ChatActivities(this._appId, this._appPassword);
KeyVaultHelper keyVault = new KeyVaultHelper();
TableStorageHelper table = new TableStorageHelper(keyVault, turnContext.Activity.Conversation.TenantId);
dynamic request = turnContext.Activity.Value;
string comment = (request.action.data.InputComment == null) ? "" : request.action.data.InputComment;The last line (12) is the one where it crashes because request.action.data is null. (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference). It is always null when sent from the iOS app, if I type in a comment or leave the field empty. It's also independent of the action button I'm using.
ok I found the difference between your example and my code:
In the example there's always a "data" node in the action which I didn't have. Therefore I added a dummy value to the action:
{
"type": "Action.Execute",
"title": "Genehmigen",
"verb": "approve",
"data": {
"Dummy": "Dummy"
}
}And now the iOS app sends the comment from the input back to the bot. For now I'm going to add that dummy value to all actions as a workaround as it doesn't seem to interfere with the overall operation of the bot.
If you remove the "data" part from the action in "firstCard.json" in your example app, you should run into the same problem that I had.
- Sayali-MSFTMar 16, 2022
Microsoft
Christian Walling -As per mention above. I can add the dummy data in data section.We are not able to reproduce the issue. It works fine.
Is there need to change anything else?
{ "type": "ActionSet", "actions": [ { "type": "Action.Execute", "verb": "firstCard", "title": "Submit", "data": { "Dummy": "Dummy" } } ] } ],- Christian WallingMar 16, 2022Copper Contributor
Sayali-MSFT Yes, as I've written it works if you add the dummy data. You need to fully remove the "data": {} node from the action to see the error.
- Sayali-MSFTMar 17, 2022
Microsoft
Christian Walling - We are able to repro that issue, we have raised bug for the same and concerned team is looking into it. We will inform you once we get any update.
- Sayali-MSFTMar 16, 2022
Microsoft
Christian Walling-We are checking on it and let you know.