InfectedMushroom
InfectedMushroom

Reputation: 51

ReplyToId' cannot be null

This exception is continuously throwing. This started since i updated botframework to 3.5.3.

Code :

MessagesController :

 await Conversation.SendAsync(activity, () => new DefaultDialog());

Than in my DefaultDialog :

 private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> argument)
        {
            var msg = await argument;


await Helper.CallMenu(context, msg);

In CallMenu function :

internal static async Task CallMenu(IDialogContext context, IMessageActivity msg)
{
    await MenuFirstPart(context, msg);

In MenuFirstPart function :

 internal static async Task MenuFirstPart(IDialogContext context, IMessageActivity msg)
        {
            await context.PostAsync("I can assist you with : ");


            msg.AttachmentLayout = AttachmentLayoutTypes.Carousel;
            msg.Attachments = new List<Attachment>();


            ThumbnailCard thumbnailCard = new ThumbnailCard()
            {
                Buttons = new List<CardAction>
                        {
                         new CardAction ()
                            {
                                Value = "Method_News",
                                Type = "postBack",
                                Title = "News"
                            },
                            new CardAction()
                            {
                                Value = "Method_About",
                                Type = "postBack",
                                Title = "About"
                            },
                            new CardAction ()
                            {
                                Value = "Method_Help",
                                Type = "postBack",
                                Title = "Help"
                            },
                        },

            };
            msg.Attachments.Add(thumbnailCard.ToAttachment());
            await context.PostAsync(msg);
        }

Exception is thrown when context is trying to post msg.

Any help ? Or how to downgrade my bot to 3.5.0. This worked fine there ...

Upvotes: 2

Views: 956

Answers (1)

Ezequiel Jadib
Ezequiel Jadib

Reputation: 14787

You are using the incoming message (msg) and sending that back.

You need to create a new message instead. Use the following:

var reply = context.MakeMessage();

Upvotes: 5

Related Questions