Hello!
The following test code compiles and runs as expected:
Are you doing something differently? What framework version are you using?
Cheers!
The following test code compiles and runs as expected:
using (var engine = new V8ScriptEngine()) { engine.Execute("function foo(x) { return x; }"); Console.WriteLine(engine.Script.foo(123)); // writes "123" Console.WriteLine(engine.Script["foo"](456)); // writes "456" Console.WriteLine(engine.Invoke("foo", 789)); // writes "789"var host = new HostFunctions(); ((IScriptableObject)host).OnExposedToScriptCode(engine); var del = (Delegate)host.func(1, engine.Script["foo"]); Console.WriteLine(del.DynamicInvoke(987)); // writes "987" }
Cheers!