PromptDialog.Choice has duplicate replies
I'm working with the Bot framework in C# and I encountered a problem.
The problem is: I have a Dialog and use PromptDialog.Choice let users select a question they interested. But in my test, I got duplicate replies see the following picture

` public async Task StartAsync(IDialogContext context) {
this.ShowOptions(context);
}`
` private void ShowOptions(IDialogContext context)
{
PromptDialog.Choice(context, this.OnOptionSelected, new List
}`
` private async Task OnOptionSelected(IDialogContext context, IAwaitable
string optionSelected = await result;
switch (optionSelected)
{
case ImageOption:
context.Call(new ImgRelated(), this.ResumeAfterOptionDialog);
break;
case ToolOption:
context.Call(new ToolPBmDailog(), this.ResumeAfterOptionDialog);
break;
}
}`
Anyone has idea?
Implementation questions like this are better suited to the Bot framework tag at Stack Overflow, and we're trying to redirect people there. I have asked and answered your question there. You can see it at this link.
Basically, you're not waiting for a response from the user in the ShowOptions method. You need to make it an async method, have it take IAwaitable<IMessageActivity> result as an argument, and change this.ShowOptions(context); in StartAsync to context.Wait(this.ShowOptions).
public async Task StartAsync(IDialogContext context)
{
context.Wait(this.MessageReceivedAsync);
}
public async virtual Task ShowOptions(IDialogContext context, IAwaitable<IMessageActivity> result)
{
var message = await result;
PromptDialog.Choice<string>(
context,
this.OnOptionSelected,
new List() { ImageOption, ToolOption },
"Please select one of the following category.",
"Not a valid option",
3);
}
...