C# 从dialog.Slot()响应时出错

C# 从dialog.Slot()响应时出错,c#,alexa,alexa-skills-kit,alexa-skill,alexa-slot,C#,Alexa,Alexa Skills Kit,Alexa Skill,Alexa Slot,我正在尝试为Alexa制作一个简单的问答游戏,其中向用户展示两个事件,并尝试猜测第一个事件是在第二个事件之前还是之后发生的 游戏需要一个名为“答案”的位置来填充。 我的问题是我的DialogElicitSlot()方法导致错误,Alexa无法读取响应 任何帮助都是非常感谢的,如果有人有一个类似的工作示例(使用C#),那也将非常好:) } 另外,如果有人能告诉我如何使插槽成为代码中所需的值,我将不胜感激。您在skill tester beta版上测试时得到了这个输入?alexa不能讲课文吗?这是实

我正在尝试为Alexa制作一个简单的问答游戏,其中向用户展示两个事件,并尝试猜测第一个事件是在第二个事件之前还是之后发生的

游戏需要一个名为“答案”的位置来填充。 我的问题是我的DialogElicitSlot()方法导致错误,Alexa无法读取响应

任何帮助都是非常感谢的,如果有人有一个类似的工作示例(使用C#),那也将非常好:)

}


另外,如果有人能告诉我如何使插槽成为代码中所需的值,我将不胜感激。

您在skill tester beta版上测试时得到了这个输入?alexa不能讲课文吗?这是实际问题吗?确切地说:-)。。如果不清楚的话,很抱歉。当我觉得我的技能出现了神奇的错误时,我会在Alexa builder的测试部分看到
设备日志。您需要查看最后4-5个日志,在某个地方会隐藏错误的确切原因,用引号写。您可能会在
指令:SkillDebugger.capturedbugging
中找到一些内容,请查找它。
[assembly: 
LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]

namespace Timeline
{
 public class Function
 {

    /// <summary>       
    /// </summary>
    /// <param name="input"></param>
    /// <param name="context"></param>
    /// <returns></returns>
    private SkillResponse MakeResponse(string outputSpeech, bool shouldEndSession, string repromptSpeech)
    {
        var response = new ResponseBody
        {
            ShouldEndSession = shouldEndSession,
            OutputSpeech = new PlainTextOutputSpeech { Text = outputSpeech }
        };

        var skillResponse = new SkillResponse
        {
            Response = response,
            Version = "1.0"
        };

        return skillResponse;
    }

    public IOutputSpeech GetOutputSpeech(string response)
    {
        return new PlainTextOutputSpeech()
        {
            Text = response
        };
    }



    public SkillResponse FunctionHandler(SkillRequest input, ILambdaContext context)
    {
        var requestType = input.GetRequestType();
        if (requestType == typeof(IntentRequest))
        {

            var intentRequest = input.Request as IntentRequest;

            if (intentRequest != null)
            {

                switch (intentRequest.Intent.Name)
                {
                    case "nextEvent":
                        {
                            string lastEventName = QuestionController.getPreviousEventName();
                            DateTime lastEventDate = QuestionController.getPreviousEventDate();

                            string nextEventName = QuestionController.getNextEventName();
                            DateTime nextEventDate = QuestionController.getNextEventDate();

                            if (intentRequest.DialogState == DialogState.Started)
                            {
                                return ResponseBuilder.DialogElicitSlot(GetOutputSpeech($"did the {lastEventName} happen before, or after {nextEventName} ?"), intentRequest.Intent.Slots["answer"].Name, intentRequest.Intent);

                            }
                            else if (intentRequest.DialogState != DialogState.Completed)
                            {
                                return ResponseBuilder.DialogElicitSlot(GetOutputSpeech($"did the {lastEventName} happen before, or after {nextEventName} ?"), intentRequest.Intent.Slots["answer"].Name, intentRequest.Intent);
                            }
                            else
                            {
                                var questionEvaluation = intentRequest.Intent.Slots["answer"].Value;

                                if (QuestionController.evaluateAnswer() == true)
                                {
                                    return MakeResponse($"That is correct! The {nextEventName} was {questionEvaluation} the {lastEventName}. The {nextEventName} was in {nextEventDate} while the {lastEventName} was in {lastEventDate}", true, "");
                                }
                                else
                                {
                                    return MakeResponse($"That is wrong! The {nextEventName} was not {questionEvaluation} the {lastEventName}. The {nextEventName} was in {nextEventDate} while the {lastEventName} was in {lastEventDate}", true, "");
                                }

                            }
                        }
                    default:
                        return MakeResponse("hmm. i dont think i understand what you are asking of me", false, "");
                }
            }
            return MakeResponse("",false,"");

        }
        else
        {
            return MakeResponse("Welcome", false, "");

        }
    }
}
}
{
"body": {
    "version": "1.0",
    "response": {
        "outputSpeech": {
            "type": "PlainText",
            "text": "did the previous event happen before, or after next event ?"
        },
        "directives": [
            {
                "type": "Dialog.ElicitSlot",
                "updatedIntent": {
                    "name": "nextEvent",
                    "confirmationStatus": "NONE",
                    "slots": {
                        "answer": {
                            "name": "answer",
                            "confirmationStatus": "NONE"
                        }
                    }
                },
                "slotToElicit": "answer"
            }
        ],
        "shouldEndSession": false
    }
}