microsoft / BotBuilder-V3

Microsoft Bot Builder V3 SDK for Microsoft Bot Framework
MIT License
50 stars 61 forks source link

IDialog method execution finished with multiple resume handlers specified through IDialogStack. invalid need: expected Call, have Wait (Microsoft.Bot.Builder.Internals.Fibers.InvalidNeedExceptio) #200

Closed tsvovan closed 4 years ago

tsvovan commented 4 years ago

Sometimes RootDialog code returns an error from the topic. RootDialog.txt Please help me to resolve this issue. Thank you.

v-kydela commented 4 years ago

@tsvovan - Issues about bots throwing exceptions should not be posted in the botframework-sdk repo. When you opened this issue, you should have seen this page: https://github.com/microsoft/botframework-sdk/issues/new/choose

Create new Bot Builder DCR

Create a new Bot Builder design change request to track changes to the Bot Builder architecture.

A DCR is a design change request. That means these issues should only be about the overall design of the SDK and not specific bugs or how-to questions.

It looks like you're building a v3 bot. The repo you should be using for v3 questions is here: https://github.com/microsoft/BotBuilder-V3

You will notice in the README that v3 is deprecated. I may be able to help you but I have a few questions first.

  1. Can you explain why you're building a v3 bot rather than a v4 bot?
  2. Have you considered migrating to v4?
tsvovan commented 4 years ago

Sorry, that I created issue incorrectly.

  1. It was created in a v3 before I started working with it.
  2. Will it resolve my issue? As I know there are several differences between bot's entities and it will not be easy to do it quickly. So I guess it will be much better to resolve my bug first. Thank you.
v-kydela commented 4 years ago

@tsvovan - Yes, migrating to v4 will certainly resolve your issue because dialogs are handled totally differently in v4 and the exception you're encountering no longer exists. If you really want to try to fix this problem in your v3 bot then you're doing work that will have to be undone later when you migrate to v4, thus increasing your technical debt. If you want to get help with that then you'll need to give us more information about the exception, like the line that's throwing it.

tsvovan commented 4 years ago
await ChatMessageReceivedAsync(context, (IAwaitable<IMessageActivity>)result);
->
context.Wait(MessageReceivedAsync);

this line exactly.

v-kydela commented 4 years ago

@tsvovan - Thank for you the code snippet. I received an email that made it look like you made another comment about wanting articles to help you migrate so I'm unsure why that's not showing up here. You should be able to find good information in the readme of the repo I linked to earlier: https://github.com/microsoft/BotBuilder-V3

Here is the official migration documentation that you should find helpful: https://aka.ms/bf-migration-overview

Are you wanting to migrate or do you just want help making v3 work?

tsvovan commented 4 years ago

I don't have time to migrate it to v4 now. So I want just making it work now. Thank you.

EricDahlvang commented 4 years ago

Hi @tsvovan

The exception:

IDialog method execution finished with no resume handler specified through IDialogStack. (Microsoft.Bot.Builder.Internals.Fibers.InvalidNeedExceptio)

means there is probably a missing context.Wait(MessageReceivedAsync); on one of the code paths. If .Forward, .Call or a .Prompt are not executed, then message processing needs to end with context.Wait(methodnamehere); so the next message knows where to begin execution.

I've tried to look at the .txt file you've shared, but honestly it is just too difficult to follow the code flow since there is a lot happening in there and we do not have the dependencies. Please try debugging this locally, and step through the code making sure context.Wait is called if there is no .Forward or .Call in the flow.

v-kydela commented 4 years ago

@tsvovan - Have you seen these issues? They might help you

I've had a good look through the source code and I don't see any way for context.Wait to throw a NoResumeHandlerException. It would make much more sense for it to throw a MultipleResumeHandlerException because it adds a resume handler, so why would it complain that there's no resume handler?

Like Eric said, please try debugging locally and stepping through the code. It might help if you provided the details of the inner InvalidNeedException exception. Have could either be None or Done.

tsvovan commented 4 years ago

@EricDahlvang This bot has thousands of messages each day and only around 10 of them have such a problem. So I don't know the way how to recreate it. So I can't debug it.

@v-kydela You are right it throws a MultipleResumeHandlerException. Inner exception is InvalidNeedException. Microsoft.Bot.Builder.Dialogs.MultipleResumeHandlerException: at Microsoft.Bot.Builder.Dialogs.Internals.ExceptionTranslationDialogTask+<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__2.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.SerializeByConversation+<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__4.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser+<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__5.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser+<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__5.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.LogPostToBot+<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__3.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Conversation+<SendAsync>d__11.MoveNext (Microsoft.Bot.Builder.Autofac, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Conversation+<SendAsync>d__6.MoveNext (Microsoft.Bot.Builder.Autofac, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at BotApplication.MessagesController+<Post>d__0.MoveNext (Bot Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullBot Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: E:\Repository\AlfaBank\Alfa-Bot\Bot Application\Controllers\MessagesController.csBot Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 27) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Threading.Tasks.TaskHelpersExtensions+<CastToObject>d__11.MoveNext (System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Web.Http.Controllers.ApiControllerActionInvoker+d1.MoveNext (System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Web.Http.Filters.ActionFilterAttribute+d6.MoveNext (System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Web.Http.Filters.ActionFilterAttribute+d6.MoveNext (System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Web.Http.Filters.ActionFilterAttribute+d5.MoveNext (System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Web.Http.Controllers.ActionFilterResult+d5.MoveNext (System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Web.Http.Controllers.ExceptionFilterResult+d6.MoveNext (System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) Inner exception Microsoft.Bot.Builder.Internals.Fibers.InvalidNeedException handled at Microsoft.Bot.Builder.Dialogs.Internals.ExceptionTranslationDialogTask+d__2.MoveNext: at Microsoft.Bot.Builder.Internals.Fibers.Extensions.ValidateNeed (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at Microsoft.Bot.Builder.Internals.Fibers.Frame1.Microsoft.Bot.Builder.Internals.Fibers.IWaiter<C>.set_Wait (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at Microsoft.Bot.Builder.Internals.Fibers.Extensions.Wait (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.Microsoft.Bot.Builder.Dialogs.Internals.IDialogStack.Wait (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at BotApplication.Dialogs.RootDialog+<ChatMessageReceivedAsync>d__19.MoveNext (Bot Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullBot Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: E:\Repository\AlfaBank\Alfa-Bot\Bot Application\Dialogs\RootDialog.csBot Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 687) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.GetResult (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at BotApplication.Dialogs.RootDialog+<MessageReceivedAsync>d__12.MoveNext (Bot Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullBot Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: E:\Repository\AlfaBank\Alfa-Bot\Bot Application\Dialogs\RootDialog.csBot Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 325) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask+ThunkResume1+d5.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Internals.Fibers.Wait`2+<Microsoft-Bot-Builder-Internals-Fibers-IWait-PollAsync>d19.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Internals.Fibers.Frame1+<Microsoft-Bot-Builder-Internals-Fibers-IFrameLoop<C>-PollAsync>d__9.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Internals.Fibers.Fiber1+<Microsoft-Bot-Builder-Internals-Fibers-IFiberLoop-PollAsync>d16.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Internals.Fibers.Wait2.Microsoft.Bot.Builder.Internals.Fibers.IAwaiter<T>.GetResult (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at Microsoft.Bot.Builder.Dialogs.Chain+LoopDialog1+d3.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask+ThunkResume1+<Rest>d__5.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Internals.Fibers.Wait2+<Microsoft-Bot-Builder-Internals-Fibers-IWait-PollAsync>d19.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Internals.Fibers.Frame`1+<Microsoft-Bot-Builder-Internals-Fibers-IFrameLoop-PollAsync>d9.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Internals.Fibers.Fiber1+<Microsoft-Bot-Builder-Internals-Fibers-IFiberLoop<C>-PollAsync>d__16.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask+<Microsoft-Bot-Builder-Base-IEventLoop-PollAsync>d__23.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.ReactiveDialogTask+<Microsoft-Bot-Builder-Base-IEventLoop-PollAsync>d__3.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.ScoringEventLoop1+d5.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.EventLoopDialogTask+d3.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.SetAmbientThreadCulture+d3.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.QueueDrainingDialogTask+d4.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask+d3.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask+d3.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Bot.Builder.Dialogs.Internals.ExceptionTranslationDialogTask+d__2.MoveNext (Microsoft.Bot.Builder, Version=3.20.1.42, Culture=neutral, PublicKeyToken=31bf3856ad364e35) `

Inner - Microsoft.Bot.Builder.Internals.Fibers.InvalidNeedException handled at Microsoft.Bot.Builder.Dialogs.Internals.ExceptionTranslationDialogTask+<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__2.MoveNext

EricDahlvang commented 4 years ago

The inverse of the rule I mentioned above sounds like the problem. If a .Prompt, .Forward or .Call occurs, then a context.Wait should NOT occur afterwards. (These methods setup an internal .Wait method)

v-kydela commented 4 years ago

@tsvovan - Why did you say the message was "IDialog method execution finished with no resume handler specified through IDialogStack."?

tsvovan commented 4 years ago

@v-kydela It is exactly what is in an app insights logs. image

v-kydela commented 4 years ago

@tsvovan - That screenshot says "multiple resume handlers" and not "no resume handler."

tsvovan commented 4 years ago

@v-kydela and how can I fix it?

v-kydela commented 4 years ago

@tsvovan - Why did you say the message was "IDialog method execution finished with no resume handler specified through IDialogStack."? Where did you get that message? Did you copy and paste from another post that you thought was about your issue? It will be very difficult to help you troubleshoot your issue if we're dealing with inaccurate information

tsvovan commented 4 years ago

@v-kydela Sorry, my fault. I don't have such messages. Corrected. Sorry again.

tsvovan commented 4 years ago

Also, I have one more problem Autofac not always resolves IRedisCacheManager. Do you know why it happens?

EricDahlvang commented 4 years ago

Hi @tsvovan

I'm sorry you've run into these issues. It seems the project you are working on is somewhat complex, and these issues require debugging to track down. We cannot debug the project here, but only provide guidance and direction. The initial error you've reported with this issue is in the bot, not the sdk. The bot is either making a call to context.Wait after calling .Forward, .Call or Prompt... OR the bot is missing a call to context.Wait.

We recommendation to debug the code and determine where this occurring.

The v3 dotnet sdk binarily serializes fields on dialogs into state. Fields are then de-serialized in order to process the next message when it is received. If IRedisCacheManager is a field on a dialog, it is probably being serialized into storage, and then incorrectly de-serialized upon processing the next message. The sdk provides FiberModule.Key_DoNotSerialize, which can be used to exclude certain fields from this process.