BotFramework-Composer icon indicating copy to clipboard operation
BotFramework-Composer copied to clipboard

Cannot use an expression as a property value

Open arturl opened this issue 7 years ago • 3 comments

image

This fails with an error:

botruntime_1  | fail: Microsoft.AspNetCore.Server.Kestrel[13]
botruntime_1  |       Connection id "0HLO67AO0LH8F", Request id "0HLO67AO0LH8F:00000001": An unhandled exception was thrown by the application.
botruntime_1  | Newtonsoft.Json.JsonSerializationException: Error setting value to 'Value' on 'Microsoft.Bot.Builder.Dialogs.Adaptive.Steps.SetProperty'. ---> System.ArgumentException: '!' is not a Number expression in (simpleEntity('title') + '!').
botruntime_1  |    at Microsoft.Bot.Builder.Expressions.BuiltInFunctions.ValidateArityAndAnyType(Expression expression, Int32 minArity, Int32 maxArity, ReturnType[] types)
botruntime_1  |    at Microsoft.Bot.Builder.Expressions.Parser.ExpressionEngine.ExpressionTransformer.MakeExpression(String type, Expression[] children)
botruntime_1  |    at Microsoft.Bot.Builder.Dialogs.Adaptive.Steps.SetProperty.set_Value(String value)
botruntime_1  |    at Newtonsoft.Json.Serialization.ExpressionValueProvider.SetValue(Object target, Object value)
botruntime_1  |    --- End of inner exception stack trace ---
botruntime_1  |    at Newtonsoft.Json.Serialization.ExpressionValueProvider.SetValue(Object target, Object value)
botruntime_1  |    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
botruntime_1  |    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
botruntime_1  |    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
botruntime_1  |    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
botruntime_1  |    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
botruntime_1  |    at Newtonsoft.Json.Serialization.JsonSerializerProxy.DeserializeInternal(JsonReader reader, Type objectType)
botruntime_1  |    at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
botruntime_1  |    at Microsoft.Bot.Builder.Dialogs.Declarative.Types.TypeFactory.Build[T](String name, JToken obj, JsonSerializer serializer)
botruntime_1  |    at Microsoft.Bot.Builder.Dialogs.Declarative.Converters.InterfaceConverter`1.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
...

arturl avatar Jul 11 '19 20:07 arturl

@arturl Here is the document that describes prebuilt functions available as part of the common expression language.

You could achieve what you are looking for using the concat function ..

concat(@title, '!')

The core issue here is that we are not validating expressions set in dialog properties as part of validations we do.

vishwacsena avatar Jul 11 '19 21:07 vishwacsena

Introduce validating expressions in dialog filter ?

hibrenda avatar Jul 12 '19 12:07 hibrenda

need form support to expression validation

hibrenda avatar Jul 26 '19 09:07 hibrenda