question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullReferenceException when passing dialog name as variable to Microsoft.BeginDialog

See original GitHub issue

Version

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:

  1. Create a new bot using Composer
  2. Create a dialog named A
  3. In a trigger of your choice, do the following:
    • assign to a variable (e.g.: turn.dialogToStart) the string A (the name of the dialog to be started)
    • insert BeginDialog passing as dialog name =turn.dialogToStart
  4. 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:closed
  • Created 2 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
gabogcommented, Jun 9, 2022

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

0reactions
MatteoMilanesecommented, Jun 9, 2022

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found