Hey guys!
This code gives me the error: "ArgumentException: Invalid property assignment"
What happens??
`using (var engine = new V8ScriptEngine())
{
engine.AddHostObject("texto", txtFormula);
Dictionary<string, string> parametros = new Dictionary<string, string>();
parametros.Add("cantidad", "1");
parametros.Add("anchoLona", "1.60");
engine.AddHostObject("param", parametros);
engine.Execute("texto.Text = param['cantidad'];");
}`
Hello @sebastianbrunobautes,
The JavaScript expression param['cantidad'] is equivalent to param.cantidad, and since .NET dictionaries have no property named "cantidad", the expression evaluates to undefined, which apparently isn't a suitable value for texto.Text.
Instead of a dictionary, consider using something like ClearScript's PropertyBag. This class behaves like a dictionary on the .NET side, but projects its contents as properties for script code.
Good luck!
Thanks for the reply, I'll give it a try.