bots - ValidationResult throws : "Object reference not set to an instance of an object". when passing back choices -


please find below exception.

stack trace: exception: exception caught: 'microsoft.bot.builder.formflow.formcanceledexception1' in mscorlib.dll ("object reference not set instance of object."). exception caught: 'microsoft.bot.builder.formflow.formcanceledexception1' in mscorlib.dll ("object reference not set instance of object.")

hi, trying generate form flow , during validation, if user enters wrong text passing choices select bot throws above exception , emulator hangs.

below example

.field(nameof(registrationform.modelnumber), validate: async (state, value) => { var modelssuggestion = pimsserviceclient.getmodelsuggestion(); validateresult validateresult = new validateresult() { isvalid = modelssuggestion.any(m => m.tolower().equals(value?.tostring().tolower())), value = value, choices = new list(modelssuggestion.select(s => new choice { value = s } })) };   /* database stuff */   return validateresult;  }) 

i tried again , figred out had provide property values choices below

 var choices = new list<choice>();  choices.add(new choice { description = new describeattribute("tes1", null, "tes1", null, null), value ="tes1", terms = new termsattribute("tes1", "t1")});  choices.add(new choice { description = new describeattribute("test2", null, "test2", null, null), value = "test2", terms = new termsattribute("test2", "t2") });      validateresult validateresult = new validateresult()                 {                 /*if modelsuggestion != null && modelssuggestion.any()*/                 isvalid = false,                 value = value,                 choices = choices             }; 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -