Microsoft Bot Emulator "Sorry, my bot code is having an issue",我该如何调试它?

Microsoft Bot Emulator "Sorry, my bot code is having an issue", how do I debug this?

我的 MS.Bot.Framework + Luis + Azure

有问题
 await Conversation.SendAsync(activity, () => { return Chain.From(() => 
 new LUISDialog() as IDialog<object>); });

我有有效的 Azure 订阅,使用订阅密钥设置端点。

当 运行 MS Bot 模拟器出现错误消息时 "Sorry, my bot code is having trouble." 在调试模式下使用断点,我发现 "new LUISDialog" 没有被触发,似乎跳过了超过它。

using System;
using System.Threading.Tasks;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Builder.Luis;
using Microsoft.Bot.Builder.Luis.Models;
using System.Threading;
using George;
using Microsoft.Bot.Connector;

namespace Geoge.Dialog
{
    [LuisModel("*****", "*****")]
    [Serializable]
    public class LUISDialog : LuisDialog<object>
    {

        [LuisIntent("Greeting")]
        public async Task GreetingIntent(IDialogContext context, 
            IAwaitable<IMessageActivity> activity, LuisResult result)
        {
            string message = $"Hello there";
            await context.PostAsync(message);
            context.Wait(this.MessageReceived);
        }

谁能帮我解决这个问题?我花了很多时间尝试调试,我想我一定是遗漏了一些简单的东西。

奇怪的是你的初始代码行:

await Conversation.SendAsync(activity, () => { return Chain.From(() => new LUISDialog() as IDialog<object>); });

如果你想使用你的 LuisDialog,你不应该在这里 Chain 而应该像下面这样:

await Conversation.SendAsync(activity, () => new LUISDialog());

虽然特定的代码片段是正确的,但我遇到了同样的问题。 在我 将我的 LUIS 应用程序发布到 Production 后,它得到了修复。模拟器上的错误也说 - Bad Request

我认为这可能对将来的某个人有所帮助。