You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Jint version Beta 2039 during a recursive call of incorrect code, the following unexpected exception is thrown:
System.InvalidOperationException: stack is empty
at Jint.Runtime.ExceptionHelper.ThrowInvalidOperationException(String message, Exception exception)
at Jint.Runtime.CallStack.JintCallStack.Pop()
at Jint.Engine.Call(FunctionInstance functionInstance, JsValue thisObject, JsValue[] arguments, JintExpression expression)
at Jint.Engine.Call(ICallable callable, JsValue thisObject, JsValue[] arguments, JintExpression expression)
at Jint.Runtime.Interpreter.Expressions.JintCallExpression.EvaluateCall(EvaluationContext context, JsValue func, Object reference, NodeList`1& arguments, Boolean tailPosition)
at Jint.Runtime.Interpreter.Expressions.JintCallExpression.Call(EvaluationContext context)
at Jint.Runtime.Interpreter.Expressions.JintCallExpression.EvaluateInternal(EvaluationContext context)
at Jint.Runtime.Interpreter.Statements.JintExpressionStatement.ExecuteInternal(EvaluationContext context)
at Jint.Runtime.Interpreter.JintStatementList.Execute(EvaluationContext context)
at Jint.Engine.ScriptEvaluation(ScriptRecord scriptRecord)
at Jint.Engine.<>c__DisplayClass64_0.<Execute>b__0()
at Jint.Engine.ExecuteWithConstraints[T](Boolean strict, Func`1 callback)
at Jint.Engine.Execute(Script script)
at Jint.Engine.Execute(String source, ParserOptions parserOptions)
at TestJint.Program.Main(String[] args) in D:\Temp\TestJint\TestJint\Program.cs:line 17
There were no such errors in version Beta 2038. To reproduce this error, I created a example:
using System;using Esprima;using Jint;using Jint.Native;using Jint.Runtime;namespaceTestJint{classProgram{staticvoidMain(string[]args){try{varengine=new Engine();Action<string>executeFile=(path)=>{stringcontent= GetFileContent(path); engine.Execute(content, CreateParserOptions(path));};JsValueexecuteFileValue= JsValue.FromObject(engine, executeFile);
engine.SetValue("executeFile", executeFileValue);
engine.Execute(@"var num = 5;executeFile(""first-file.js"");",
CreateParserOptions("main-file.js"));}catch(JavaScriptExceptione){
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Success!");
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("Expected error: {0}", e.ToString());}catch(InvalidOperationExceptione){
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Failed!");
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("Unexpected error: {0}", e.ToString());}}privatestatic ParserOptions CreateParserOptions(stringfilePath){varparserOptions=new ParserOptions(filePath){AdaptRegexp=true,Tolerant=true};returnparserOptions;}privatestaticstringGetFileContent(stringpath){stringcontent;switch(path){case"first-file.js":content=@"num = num * 3;executeFile(""second-file.js"");";break;case"second-file.js":content=@"// Intentionally making a mistake in the variable namenuм -= 3;";break;default:thrownew FileNotFoundException(string.Format("File '{0}' not exist.", path), path);}returncontent;}}}
Hello!
In Jint version Beta 2039 during a recursive call of incorrect code, the following unexpected exception is thrown:
There were no such errors in version Beta 2038. To reproduce this error, I created a example:
In fact, I use more complex code in my tests.
The text was updated successfully, but these errors were encountered: