protected virtual ScriptResult Execute(string code, Session session) { Guard.AgainstNullArgument("session", session); var result = new ScriptResult(); try { var submission = session.CompileSubmission <object>(code); try { result.ReturnValue = submission.Execute(); } catch (Exception ex) { result.ExecuteExceptionInfo = ExceptionDispatchInfo.Capture(ex); } } catch (Exception ex) { result.UpdateClosingExpectation(ex); if (!result.IsPendingClosingChar) { result.CompileExceptionInfo = ExceptionDispatchInfo.Capture(ex); } } return(result); }
protected virtual ScriptResult Execute(string code, Session session) { Guard.AgainstNullArgument("session", session); var result = new ScriptResult(); try { var submission = session.CompileSubmission<object>(code); try { result.ReturnValue = submission.Execute(); } catch (Exception ex) { result.ExecuteExceptionInfo = ExceptionDispatchInfo.Capture(ex); } } catch (Exception ex) { result.UpdateClosingExpectation(ex); if (!result.IsPendingClosingChar) result.CompileExceptionInfo = ExceptionDispatchInfo.Capture(ex); } return result; }