Bots PromptDialog.Choice-无效类型异常

Bots PromptDialog.Choice-无效类型异常,bots,botframework,Bots,Botframework,尝试使用PromptDialog.Choice时,我遇到无效类型异常。 以下是我的对话框中的代码: public async Task StartAsync(IDialogContext context) { await context.PostAsync(ConversationHelper.CreateReschedulePromptMessage()); context.Wait(MessageReceivedAsync); } public virtual async Tas

尝试使用PromptDialog.Choice时,我遇到无效类型异常。 以下是我的对话框中的代码:

 public async Task StartAsync(IDialogContext context) {
  await context.PostAsync(ConversationHelper.CreateReschedulePromptMessage());
  context.Wait(MessageReceivedAsync);
}

public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> result) {
  var message = await result;
  var Options = new[] { "Location", "Date and Time", "Both" };

  if (message.Text.ToUpper().CompareTo("PICKUP") == 0) {
    _rescheduleType = "pickup";
    string prompt = string.Format("Is the {0} location incorrect, is the date and time incorrect, or both?", _rescheduleType);
    PromptDialog.Choice(context, OnResumeFromRescheduleChoice, Options, prompt, promptStyle: PromptStyle.Auto, descriptions: Options);
  }
  else if (message.Text.ToUpper().CompareTo("DROP") == 0) {
    _rescheduleType = "drop-off";
    string prompt = string.Format("Is the {0} location incorrect, is the date and time incorrect, or both?", _rescheduleType);
    PromptDialog.Choice(context, OnResumeFromRescheduleChoice, Options, prompt, promptStyle: PromptStyle.Auto, descriptions: Options);
  }
  else {
    await context.PostAsync(ConversationHelper.CreateGenericRescheduleMessage(SUPPORTNUMBER));
  }

  context.Done<object>(null);
}

private async Task OnResumeFromRescheduleChoice(IDialogContext context, IAwaitable<string> result) {
  var choice = await result;
}
公共异步任务StartAsync(IDialogContext上下文){
wait context.PostAsync(ConversationHelper.createRescheduleComptMessage());
Wait(MessageReceivedAsync);
}
公共虚拟异步任务消息ReceivedAsync(IDialogContext上下文,IAwaitable结果){
var消息=等待结果;
var Options=new[]{“位置”、“日期和时间”、“两者”};
if(message.Text.ToUpper().CompareTo(“拾取”)==0){
_重新安排etype=“分拣”;
string prompt=string.Format(“是{0}位置不正确,日期和时间不正确,还是两者都不正确?”,\u rescheduleType);
PromptDialog.Choice(上下文,OnResumeFromRescheduleChoice,选项,提示,提示样式:promptStyle.Auto,描述:选项);
}
else if(message.Text.ToUpper().CompareTo(“DROP”)==0){
_重新安排etype=“下车”;
string prompt=string.Format(“是{0}位置不正确,日期和时间不正确,还是两者都不正确?”,\u rescheduleType);
PromptDialog.Choice(上下文,OnResumeFromRescheduleChoice,选项,提示,提示样式:promptStyle.Auto,描述:选项);
}
否则{
wait context.PostAsync(ConversationHelper.CreateGenericRescheduleMessage(SUPPORTNUMBER));
}
context.Done(null);
}
ResumeFromRescheduleChoice上的专用异步任务(IDialogContext上下文,IAwaitable结果){
var选择=等待结果;
}

OnResumeFromRescheduleChoice方法正在激发,但结果显示失败,因为ResumeAfter委托需要字符串类型,但正在接收对象。这是PromptDialog的错误用法吗?此外,不会提示用户选择。我使用的是Bot.Builder版本3.5.5

移动
上下文.Done(null)
else
子句内调用。您无法调用
上下文。在触发
提示符后,完成了

是否为上下文。完成(空)调用发生得太早?这是我的问题。谢谢