I'm trying to create a child dialog from a Luis intent to gather additional information from the user. However I'm receiving a Cannot convert from 'method group' to 'ResumeAfter<object>' error message on the second argument of context.Call
[LuisIntent("Login")]
public async Task LoginIntent(IDialogContext context, LuisResult result)
{
var serverdialog = new ServerDialog();
await context.Call(serverdialog, ResumeAfterServerDialog); //error here
}
private async Task ResumeAfterServerDialog(IDialogContext context, IAwaitable<string> serverName)
{
this.serverAddress = await serverName;
await context.PostAsync($"you've entered {this.serverAddress}");
context.Wait(MessageReceived);
}
The server dialog class is
[Serializable]
public class ServerDialog : IDialog<object>
{
public async Task StartAsync(IDialogContext context)
{
await context.PostAsync("Enter your server's name (example: 10.10.10.52)");
context.Wait(ReceiveServerDialog);
}
public async Task ReceiveServerDialog(IDialogContext context, IAwaitable<IMessageActivity> result)
{
IMessageActivity message = await result;
context.Done(message.Text);
}
}
I found an explanation saying :
the type of the second parameter for MessageReceived is likely IAwaitable, but you need a method with a second parameter of IAwaitable, for example, if you're passing null as the result value and the type of your child dialog is IDialog.
however I couldn't make sense of this.
Your dialog implements IDialog<object>
but your ResumeAfter<T>
method ReceiveServerDialog
is a expecting a string (in IAwaitable<string> serverName
parameter)
Change your dialog to implement IDialog<string>
or change your ReceiveServerDialog
method to be
private async Task ResumeAfterServerDialog(IDialogContext context, IAwaitable<object> serverName)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With