NullReferenceException when passing dialog name as variable to Microsoft.BeginDialog
See original GitHub issueVersion
4.14.1
Describe the bug
When trying to start a dialog passing its name as a variable to Microsoft.BeginDialog
, SDK throws a NullReferenceException
.
This is because the name is resolved at runtime and, when DialogContext.FindDialog
tries to resolve dialog by name, it doesn’t find it in its property Dialogs
To Reproduce
Steps to reproduce the behavior:
- Create a new bot using Composer
- Create a dialog named
A
- In a trigger of your choice, do the following:
- assign to a variable (e.g.:
turn.dialogToStart
) the stringA
(the name of the dialog to be started) - insert
BeginDialog
passing as dialog name=turn.dialogToStart
- assign to a variable (e.g.:
- Start the bot and activate the trigger as per point 3. You should have a
NullReferenceException
Expected behavior
Dialog should be added dynamically to DialogContext.Dialogs
list when its name is resolved
Additional context
- Using BotFramework Composer version
2.1.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
NullReferenceException Class (System)
Initializes a new instance of the NullReferenceException class with a specified error message and a reference to the inner exception that is the...
Read more >System.NullReferenceException When passing a variable ...
I'm busy with a project in C# that involves 2 Windows Form. The program asks to user to enter a topic in a...
Read more >Variable '<variablename>' is passed by reference before it ...
Variable '<variablename>' is passed by reference before it has been assigned a value. A null reference exception could result at run time.
Read more >How come visual studio can't display the name of ...
I just want to know which variable was NULL or which function returned ... The idea is simple: I know that my code...
Read more >Botbuilder Dotnet Versions
ContinueActionAsync with native dialog SDK by @sw-joelmut in ... [#6265] NullReferenceException when passing dialog name as variable to Microsoft.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the comment @MatteoMilanese, @sw-joelmut, can you please see if you can repro the issue described above in your environment. If you do, please create a new issue so we can track it as a different PR (please add a reference to this issue in the new issue so we can track it in github too).
Thanks
@gabog @sw-joelmut With respect to the PR #6338 that closed this issue, we encountered some problems with scalability as described in this comment above that doesn’t seem to be taken into account. To reproduce it, you can start dynamically a multi-turn dialog and, in the middle of the dialog, restart the bot. Of course you will need something like a CosmosDB emulator.
This, should simulate a scenario in which the conversation is continued on a different Azure Web App instance that has never dynamically started that dialog.