TurnContext.UpdateActivity does not apply a conversation reference
See original GitHub issueVersion
Latest
Describe the bug
TurnContext.SendActivitiesAsync
uses Activity.GetConversationReference
and Activity.ApplyConversationReference
to ensure that outgoing activities have all the information the adapter and the connector client need in order to send the activities. This allows TurnContext.SendActivityAsync
to work with activities that were generated using MessageFactory
rather than just activities that were generated using Activity.CreateReply
(which I have been advised to not use anymore). However, TurnContext.UpdateActivityAsync
does not apply a conversation reference to its activity, so in order to update an activity using MessageFactory
you have to set the new activity’s Conversation
property manually. This is unintuitive.
To Reproduce
Steps to reproduce the behavior:
- Generate a new activity using a static method from the
MessageFactory
class - Set the new activity’s
Id
property using a saved resource response ID - Use the new activity as the argument in
TurnContext.UpdateActivityAsync
- See null reference exception
Expected behavior
TurnContext.UpdateActivityAsync
should use the available conversation information just like TurnContext.SendActivityAsync
.
Screenshots
Additional context
I am happy to submit a PR for this myself if I am assigned to it.
[bug]
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (7 by maintainers)
Top GitHub Comments
I have noticed that in the Node.js SDK, you must not only set the updated activity’s
conversation
property but also itsserviceUrl
propertyThis has worked for me on Teams C# code:
Send card first time:
Update card:
Let me know if you need further assistance