0

Hello dear programmers,

I am trying to turn my LuisBot into a MultiDialog application. But I get the error message "Exception: IDialog method execution finished with multiple resume handlers specified through IDialogStack." from the botframework Emulator, when I type "Help". bot Framework Emulator errormessages What does it mean? I have included some of my BotCode below, if you see the Problem somewhere, please point it out to me. MessagesController starts a new LuisDialog that has the following two functions (admidst others):

    [LuisIntent("Utilities.Help")]
        public async Task HelpIntent(IDialogContext context, LuisResult result)
    {
                    await context.PostAsync($"You have reached the help intent. You said: {result.Query}"); 

        IMessageActivity message = Activity.CreateMessageActivity();
        message.Text = result.TopScoringIntent.Intent+ "Willkommmen";
        message.TextFormat = "plain";
        message.Locale = "de";

        context.Wait(MessageReceived);
        //reference: https://github.com/Microsoft/BotBuilder-Samples/blob/master/CSharp/core-MultiDialogs/Dialogs/RootDialog.cs
        await context.Forward(new HelpDialog(),AfterDialog, message, CancellationToken.None);
    }

    private async Task AfterDialog(IDialogContext context, IAwaitable<object> result)
    {

        var ticketNumber = await result;
        await context.PostAsync($"Thanks for contacting our support team. Your ticket number is {ticketNumber}.");

        context.Wait(MessageReceived);
    }

The HelpIntent-Function is supposed to call the HelpDialog, but startAsyc() in HelpDialog is not reached or executed properly, I think. HelpDialog looks like this:

[Serializable]
    public class HelpDialog : IDialog<object>
    {
        public async Task StartAsync(IDialogContext context)
        {
            context.Wait(this.MessageReceivedAsync); 
        }


        public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> result)
        {
            var message = await result;

            var ticketNumber = new Random().Next(0, 20000);

            await context.PostAsync($"Your message '{message.Text}' was registered. Once we resolve it; we will get back to you.");

            context.Done(ticketNumber);
        } 

I have tried debugging the whole thing in VS, But the line the exception is thrown is in MessagesController, when creating the LuisDialog. And somehow I'm unable to step into, so I'm not any wiser. I think, one of my ResumeHandlers is the AfterDialog(), but what might the other one be? In LuisDialog, there's only the intent-functions and that one resume function. [Serializable] is set in LuisDialog as well. What else could I check?

7gegenTheben
  • 81
  • 1
  • 10
  • Not exactly the same code, but the problem is the same. You are Waiting in the LUISDialog and also Forwarding to Help Dialog. You need to remove the `context.Wait` from the `HelpIntent` method – Ezequiel Jadib Dec 06 '17 at 12:24
  • Thank you for answering this, nevertheless. It solved the problem. – 7gegenTheben Dec 14 '17 at 09:00

0 Answers0