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.

ChoicePrompt not working on 4.6.X but 4.5.X works

See original GitHub issue

Version

4.6.2 4.6.1

Describe the bug

When the PromptAsync is executed on the waterfall conversation i get and error, this is my code:

private async Task<DialogTurnResult> ConsultarTecnologiaAsync (WaterfallStepContext step, CancellationToken cancellationToken) {
    PromptOptions options = new PromptOptions () {
        Prompt = step.Context.Activity.CreateReply ($"¿Con cuál servicio tienes duda?"),
        Choices = new List<Choice> (),
        Style = ListStyle.HeroCard
    };
    options.Choices.Add (new Choice () { Value = "PowerApps" });
    options.Choices.Add (new Choice () { Value = "Teams" });
    options.Choices.Add (new Choice () { Value = "OneDrive" });
    options.Choices.Add (new Choice () { Value = "Flow" });
    options.Choices.Add (new Choice () { Value = "Outlook" });

    //in this line is where i get the error
    return await step.PromptAsync ("consultar", options, cancellationToken);
}

I get this error after the PromptAsync is executed:

$exception {System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Recognizers.Text.Culture.MapToNearestLanguage(String cultureCode) at Microsoft.Bot.Builder.Dialogs.ChoicePrompt.OnPromptAsync(ITurnContext turnContext, IDictionary2 state, PromptOptions options, Boolean isRetry, CancellationToken cancellationToken) in D:\a\1\s\libraries\Microsoft.Bot.Builder.Dialogs\Prompts\ChoicePrompt.cs:line 126 at Microsoft.Bot.Builder.Dialogs.Prompt1.BeginDialogAsync(DialogContext dc, Object options, CancellationToken cancellationToken) in D:\a\1\s\libraries\Microsoft.Bot.Builder.Dialogs\Prompts\Prompt.cs:line 105 at Microsoft.Bot.Builder.Dialogs.DialogContext.BeginDialogAsync(String dialogId, Object options, CancellationToken cancellationToken) in D:\a\1\s\libraries\Microsoft.Bot.Builder.Dialogs\DialogContext.cs:line 170 at Microsoft.Bot.Builder.Dialogs.DialogContext.PromptAsync(String dialogId, PromptOptions options, CancellationToken cancellationToken) in D:\a\1\s\libraries\Microsoft.Bot.Builder.Dialogs\DialogContext.cs:line 198 at DoctorOffice365.Dialogs.Office365Dialog.ConsultarTecnologiaAsync(WaterfallStepContext step, CancellationToken cancellationToken) in C:\Users\bpalma\source\repos\DrOffice365\DrOffice365\Dialogs\Office365Dialog.cs:line 78} System.NullReferenceException`

Expected behavior

Show the prompt in the conversation, when the code is executed with 4.5.3 version it runs correctly

[bug]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mdrichardsoncommented, Nov 14, 2019

@brunoslam The fix for this has been pushed to our 4.6.3 release, which should come out by Monday. I’m going to close this, but feel free to re-open if you see the same error in 4.6.3

Edit: Actually the C# 4.6.3 package just got pushed to Nuget.

2reactions
dknittlcommented, Nov 11, 2019

Actually, there’s also a workaround if you want to stay with 4.6.2: You just need to specify a DefaultLocale when instantiating the ChoicePrompt:

new ChoicePrompt(nameof(ChoicePrompt)) { Style = ListStyle.SuggestedAction, DefaultLocale = "de-DE", }

Apparently that wasn’t necessary before. But if you add the DefaultLocale, it works also with the current version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WaterfallDialog choiceprompt working in emulator but not ...
But it is not working properly means the flow is not working fine in Webchannel Please provide the solution to this problem. Here...
Read more >
Runtime changes for migration to .NET Framework 4.6.x
NET Framework 4.5 causes values set via a null coalescing operation to not be visible in the debugger immediately after the assignment operation ......
Read more >
Developing solvers with Red Hat Business Optimizer in ...
Using Business Optimizer, you can switch the optimization algorithm by changing the solver configuration in a few lines of XML or code. 1.4....
Read more >
kernel/msm
How to use? -NOTE: This driver was developed using Linux 2.6.6., -it is working with 2.6.7 and above. - -Linux 2.4.x support is...
Read more >
Time Navigator Administration
Important: For the connections to work between all the Tina 4.6.3 agents and the server, it is mandatory that at least one common...
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