Sorry, my bot code is having an issue.
I am currently getting this as a reply when testing my bot in the Emulator. Ive checked the bot app logs and there arent any errors. What kind of issue would this be?
Here is the part code that is causing this:
private async Task LogIn(IDialogContext context)
{
string token;
if (!context.PrivateConversationData.TryGetValue(AuthTokenKey, out token))
{
context.PrivateConversationData.SetValue("persistedCookie", ResumptionCookie);
Activity loginActivity = new Activity();
loginActivity= loginActivity.CreateReply("Logging In");
Trace.TraceInformation($"loginActivity Type : {loginActivity.Type}");
Trace.TraceInformation($"loginActivity Action : {loginActivity.Action}");
Trace.TraceInformation($"loginActivity Text : {loginActivity.Text}");
await context.PostAsync(loginActivity);
context.Wait(MessageReceivedAsync);
}
else
{
context.Done(token);
}
}
While this works :
private async Task LogIn(IDialogContext context)
{
string token;
if (!context.PrivateConversationData.TryGetValue(AuthTokenKey, out token))
{
context.PrivateConversationData.SetValue("persistedCookie", ResumptionCookie);
string fbLogin = $"Go to: {FacebookHelpers.GetFacebookLoginURL(ResumptionCookie, FacebookOauthCallback.ToString())}";
await context.PostAsync(fbLogin);
context.Wait(MessageReceivedAsync);
}
else
{
context.Done(token);
}
}
cant i pass an Activity type to PostAsync, isnt Activity type an IActivityMessage ? im trying to use cards in dialog.
We added that error message so that it was obvious that the http request to post a user's message to the bot was failing with an unhandled exception:
https://github.com/Microsoft/BotBuilder/blob/master/CSharp/Library/Dialogs/DialogTask.cs#L443
even if all of the previous messages were successfully sent. Do you see your reply message?
thanks got to see it with the debugger attached , I have yet to solve my problem, but i guess this solves the "Sorry, my bot code is having an issue" issue, thanks :)
" at Microsoft.Bot.Connector.ConversationsExtensions.ReplyToActivityAsync(IConversations operations, Activity activity, CancellationToken cancellationToken)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.AlwaysSendDirect_BotToUser.