RickStrahl/Westwind.Scripting

Detecting/Aborting long running scripts

jasonswearingen opened this issue · 2 comments

it seems that scripts run via script.ExecuteCodeAsync() do not yield unless the script itself includes await. So if there is an infinite loop in a poorly written script the entire application blocks.

Is there a workaround for this? Ideally running a script via ExecuteCodeAsync() did not block the caller, and a CancellationToken could be specified.

nevermind, I worked around this by passing the cancel token to the script.

Sure you can work around this, but what happens in the code that is called is not under the control of the calling execution engine.

That's what async is for in which case you can pass in a Cancellation token to your method as you point out.