BasicQnAMakerDialog throw an error when I call from RootDialog
I am using “Microsoft.Bot.Builder.CognitiveServices.QnAMaker” to invoke the QNA service. I calling the BasicQnAMakerDialog inside the Rootdialog and when hit the line “var message = await argument;” throwing a error, the error msg has given below. Please let me know what is the correct implementation I have to follow to fix the issue
“invalid type: expected Microsoft.Bot.Connector.IMessageActivity, have Boolean”
public class RootDialog : IDialog<object>
{
public Task StartAsync(IDialogContext context)
{
context.Wait(MessageReceivedAsync);
return Task.CompletedTask;
}
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<object> result)
{
var activity = await result;
await context.Forward(
new BasicQnAMakerDialog(),
ConvEndAsync,
activity,
System.Threading.CancellationToken.None);
context.Wait(MessageReceivedAsync);
}
public async Task ConvEndAsync(IDialogContext context, IAwaitable<object> argument)
{
try
{
var message = await argument;
}
catch (Exception ex)
{
}
context.Wait(MessageReceivedAsync);
}
}
Remove the context.Wait(MessageReceivedAsync); from the MessageReceivedAsync. You are forwarding messages to another dialog so you don't need to wait on this one.
Still have the same error for me
I am facing the same issue. There isn't a cont.wait in my code. Can you help?
Still have the same error for me. Is the correct implementation for ConvEndAsync simply ?
private async Task ConvEndAsync(IDialogContext context, IAwaitable<IMessageActivity> result)
{
context.Wait(MessageReceived);
}