I'm trying to do something that seems very simple, yet I cannot get it to work. I've installed Edge.js via nuget and I want to execute a piece of Javascript from inside a C# console application. The code from my public static void main
is below:
Task.Run(async () => {
Console.WriteLine(
await Edge.Func("return function() { return 'hello world'; }")(null).Result
);
}).Wait();
I run the application and all it does is hangs.
I've tried this:
Console.WriteLine(Edge.Func("return function() { return 'hello'; }")(null).Result);
Same result. And this too...
var task = Edge.Func("return function() { return 'hello'; }")(null);
await task;
Console.WriteLine(task.Result);
Same result. Hanging...
I also tried RunSynchronously()
rather than awaiting, which gave me an InvalidOperationException
.
I followed the documentation here.
Any ideas?