Botframework-sdk: "invalid need: expected Call, have Poll"

Created on 3 Jun 2016  路  3Comments  路  Source: microsoft/botframework-sdk

When I try to use PromptDialog.Confirm, I get this error. The code:

`
[LuisIntent("Define")]
public async Task Define(IDialogContext context, LuisResult result)

{
PromptDialog.Confirm(context, AfterConfirming_TurnOffAlarm, "Are you sure?");
context.Wait(MessageReceived);
}

public async Task AfterConfirming_TurnOffAlarm(IDialogContext context, IAwaitable confirmation)

{

 if (await confirmation)

    {
            await context.PostAsync($"Ok, alarm disabled.");

    }

   else

   {

       await context.PostAsync("Ok! We haven't modified your alarms!");

    }

   context.Wait(MessageReceived);

  }

}
`

Most helpful comment

You only need to use PromptDialog.Confirm or context.Wait(MessageReceived) not both - the prompt dialog itself will call context.Wait(MessageReceived) internally.

All 3 comments

You only need to use PromptDialog.Confirm or context.Wait(MessageReceived) not both - the prompt dialog itself will call context.Wait(MessageReceived) internally.

I'm going to close this issue - feel free to re-open to discuss.

I am getting invalid need exception when I iterated a for each loop over a JSON object(two-dimensional). I want to display the keys in JSON object one after another and also had to wait for response from user after every question. I getting this exception first and after that the first question is displayed. I am using choice selection and confirmation dialogs for every question. Can anyone suggest me a solution.

Was this page helpful?
0 / 5 - 0 ratings