I get an exception when trying to assign a value on an expando object:
ParseException = Expression must be writable (at index 9)
var target = new Interpreter();
target.EnableAssignment(AssignmentOperators.AssignmentEqual);
dynamic parent = new ExpandoObject();
parent.X = 3; // Same exception whether this property exists or not
var parameters = new[] {
new Parameter("parent", parent)
};
var expression = "parent.X = 10";
// ParseException = Expression must be writable (at index 9)
target.Parse(expression, parameters);
I tried using a non-dynamic object and that works fine:
var target = new Interpreter();
target.EnableAssignment(AssignmentOperators.AssignmentEqual);
var parent = new SimpleNumericAssignment(); // has a get/set integer property "X"
var parameters = new[] {
new Parameter("parent", parent)
};
var expression = "parent.X = 10";
var myFunc = target.Parse(expression, parameters);
myFunc.Invoke(parameters);
Am I doing something wrong? Is this a known limitation and/or is there a way to work around this?
I get an exception when trying to assign a value on an expando object:
ParseException = Expression must be writable (at index 9)I tried using a non-dynamic object and that works fine:
Am I doing something wrong? Is this a known limitation and/or is there a way to work around this?