public object Execute(CompiledCode compiledCode, ScriptScope scope) { Debug.Assert(_executingThread == null); _executingThread = Thread.CurrentThread; try { object result = compiledCode.Execute(scope); Console.WriteLine(RemoteCommandDispatcher.OutputCompleteMarker); return(result); } catch (ThreadAbortException tae) { KeyboardInterruptException pki = tae.ExceptionState as KeyboardInterruptException; if (pki != null) { // Most exceptions get propagated back to the client. However, ThreadAbortException is handled // differently by the remoting infrastructure, and gets wrapped in a RemotingException // ("An error occurred while processing the request on the server"). So we filter it out // and raise the KeyboardInterruptException Thread.ResetAbort(); throw pki; } else { throw; } } finally { _executingThread = null; } }
/// <summary> /// Attempts to run a single interaction and handle any language-specific /// exceptions. Base classes can override this and call the base implementation /// surrounded with their own exception handling. /// /// Returns null if successful and execution should continue, or an exit code. /// </summary> protected virtual int?TryInteractiveAction() { int?result = null; try { result = RunOneInteraction(); #if !FEATURE_EXCEPTION_STATE } catch (ThreadAbortException) { #else } catch (ThreadAbortException tae) { KeyboardInterruptException pki = tae.ExceptionState as KeyboardInterruptException; if (pki != null) { UnhandledException(tae); Thread.ResetAbort(); } else { throw; } #endif } return(result); }
/// <summary> /// Attempts to run a single interaction and handle any language-specific /// exceptions. Base classes can override this and call the base implementation /// surrounded with their own exception handling. /// /// Returns null if successful and execution should continue, or an exit code. /// </summary> private int?TryInteractiveActionWorker() { int?result = null; try { result = RunOneInteraction(); #if !FEATURE_EXCEPTION_STATE } catch (ThreadAbortException) { #else } catch (ThreadAbortException tae) { KeyboardInterruptException pki = tae.ExceptionState as KeyboardInterruptException; if (pki != null) { Thread.ResetAbort(); } #endif } return(result); }
/// <summary> /// Attempts to run a single interaction and handle any language-specific /// exceptions. Base classes can override this and call the base implementation /// surrounded with their own exception handling. /// /// Returns null if successful and execution should continue, or an exit code. /// </summary> private int?TryInteractiveActionWorker() { int?result = null; try { result = RunOneInteraction(); #if SILVERLIGHT // ThreadAbortException.ExceptionState } catch (ThreadAbortException) { #else } catch (ThreadAbortException tae) { KeyboardInterruptException pki = tae.ExceptionState as KeyboardInterruptException; if (pki != null) { Console.WriteLine(Language.FormatException(tae), Style.Error); Thread.ResetAbort(); } #endif } return(result); }
protected override int?TryInteractiveAction() { int?result = null; try { result = RunOneInteraction(); } catch (ThreadAbortException tae) { KeyboardInterruptException pki = tae.ExceptionState as KeyboardInterruptException; if (pki != null) { UnhandledException(tae); Thread.ResetAbort(); } else { throw; } } return(result); }