superjos
superjos

Reputation: 12705

Conversation.SendAsync not returning in Bot Framework default application

Working with a brand new Bot Framework project, as generated from the template (and with updated dependencies), so a MessagesController and a RootDialog. When I debug-start the project in VS and then send a text message from emulator, the end result is the infamous couldn't send retry.

No error is shown in emulator log: all is fine, grok connected (although by-passed for localhost), conversation is added, etc. I can post that if needed.

No exception is caught in VS (all CLR exceptions checked). No error message is shown in VS output window: there are only messages from IIS Express loading modules, and then later on thread exit message.

I decided to go for breakpoint debugging and here's the outcome: it turns out that in default MessagesController.Post method:

public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
    if (activity.Type == ActivityTypes.Message)
    {
        await Conversation.SendAsync(activity, () => new Dialogs.RootDialog());
    }
    else
    {
        HandleSystemMessage(activity);
    }
    var response = Request.CreateResponse(HttpStatusCode.OK);
    return response;
}

execution reaches await Conversation.SendAsync(... but then it never returns from that call. var response = ... is not hit, and Dialogs.RootDialog is never instantiated (I added a dummy constructor with a breakpoint on it), so it looks like not even the makeRoot delegate is ran. I guess at some point the 15 second timeout is reached and execution is abandoned altogether.

I'm at loss on how to further debug that. Has anyone gone through this problem too? TA

Dependencies and environment:

Edit:
I tried starting with a new project from template, this time NOT updating any dependency. That means Microsoft.Bot.Builder 3.8.0.0 and no Microsoft.Bot.Connector. This time, bot answer is correctly shown. Emulator logs complain about not using the latest SDK version. But at least it works. So, is this a regression?

Tried with 3.12.2.4 and it works too

Upvotes: 0

Views: 629

Answers (1)

superjos
superjos

Reputation: 12705

So, apparently there was something funny with SDK 3.15.2 and emulator: mantainers just released 3.15.2.1 which says:

Fix deadlock regression when talking to emulator

Upgraded now and it works fine!

Upvotes: 2

Related Questions