で使用しようとすると例外が発生GetCompletionValue
しInvoker
ます。IIFE字句スコープで関数を
実行するにはどうすればよいですか?run
Javascript:
(function(){
function run() {
logger('teste logger');
var file = new System.IO.StreamWriter('log.txt');
file.WriteLine('Write file test');
file.Dispose();
}
return {
'run': run
}
})();
私の呼び出し元:
public void Execute(string code, string functionName)
{
_engine.Execute(code).GetCompletionValue();
_engine.Invoke(functionName); // -- run function
}
エラー:
Exception has occurred: CLR/System.ArgumentException
An exception of type 'System.ArgumentException' occurred in Jint.dll but was not handled in user code: 'Can only invoke functions'
at Jint.Engine.Invoke(JsValue value, Object thisObj, Object[] arguments)
at Jint.Engine.Invoke(String propertyName, Object thisObj, Object[] arguments)
at Jint.Engine.Invoke(String propertyName, Object[] arguments)