2
votes

I am trying to find out an activity text into a LUIS dialog. I am using the LUIS intent handler:

[LuisIntent("")]
public async Task None(IDialogContext context, IAwaitable<IMessageActivity> result)
{       
    await context.PostAsync("I have no idea what you are talking about.");
    context.Wait(MessageReceived);
}

but this throws an Exception:

File of type 'text/plain'

Can anyone suggest me why this happens? I also put a breakpoint but it isn't hit.

1
I was unable to reproduce, are you able to post more of your code or put your project in a repo?D4RKCIDE
Which version of the SDK are you using?Steven G.

1 Answers

2
votes

You're seeing that problem because of the intent handler signature. Notice the IAwaitable<IMessageActivity> result. Re-writing like this will work:

    [LuisIntent("")]
    public async Task None(IDialogContext context, LuisResult result)
    {
        await context.PostAsync("I have no idea what you are talking about.");
        context.Wait(MessageReceived);
    }

Instead of an IAwaitable<IMessageActivity>, you should use LuisResult. Alternatively, LuisDialog does target an intent handler overload with three parameters and this will work too:

    [LuisIntent("")]
    public async Task None(IDialogContext context, IAwaitable<IMessageActivity> activity, LuisResult result)
    {
        await context.PostAsync("I have no idea what you are talking about.");
        context.Wait(MessageReceived);
    }