private int RunFile() { Debug.Assert(_engine != null); int result = 0; try { return(_engine.CreateScriptSourceFromFile(Options.RunFile).ExecuteProgram()); #if SILVERLIGHT } catch (ExitProcessException e) { result = e.ExitCode; #endif } catch (Exception e) { UnhandledException(Engine, e); result = 1; } finally { try { Snippets.SaveAndVerifyAssemblies(); } catch (Exception) { result = 1; } } return(result); }
private int RunCommandLine() { Debug.Assert(_engine != null); _commandLine = CreateCommandLine(); ConsoleOptions consoleOptions = _languageOptionsParser.CommonConsoleOptions; if (consoleOptions.PrintVersionAndExit) { Console.WriteLine("{0} {1} on .NET {2}", Engine.Setup.DisplayName, Engine.LanguageVersion, typeof(String).Assembly.GetName().Version); return(0); } if (consoleOptions.PrintUsageAndExit) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("Usage: {0}.exe ", ExeName); PrintLanguageHelp(sb); Console.Write(sb.ToString()); return(0); } if (_console == null) { _console = CreateConsole(Engine, _commandLine, consoleOptions); } int exitCode = 0; try { if (consoleOptions.HandleExceptions) { try { exitCode = _commandLine.Run(Engine, _console, consoleOptions); } catch (Exception e) { if (CommandLine.IsFatalException(e)) { // Some exceptions are too dangerous to try to catch throw; } UnhandledException(Engine, e); exitCode = 1; } } else { exitCode = _commandLine.Run(Engine, _console, consoleOptions); } } finally { try { Snippets.SaveAndVerifyAssemblies(); } catch (Exception) { exitCode = 1; } } return(exitCode); }
private int RunCommandLine() { Debug.Assert(_engine != null); _commandLine = CreateCommandLine(); if (_console == null) { _console = CreateConsole(Engine, _commandLine, _consoleOptions); } int?exitCodeOverride = null; try { if (_consoleOptions.HandleExceptions) { try { _commandLine.Run(Engine, _console, _consoleOptions); } catch (Exception e) { if (CommandLine.IsFatalException(e)) { // Some exceptions are too dangerous to try to catch throw; } UnhandledException(Engine, e); } } else { _commandLine.Run(Engine, _console, _consoleOptions); } } finally { #if FEATURE_REFEMIT try { Snippets.SaveAndVerifyAssemblies(); } catch (Exception) { exitCodeOverride = 1; } #endif } if (exitCodeOverride == null) { return(_commandLine.ExitCode); } else { return(exitCodeOverride.Value); } }
private void RunTestCase(TestCase /*!*/ testCase, ref int failedCount) { _testRuntime = new TestRuntime(this, testCase); Console.WriteLine("Executing {0}", testCase.Name); try { testCase.TestMethod(); } catch (Exception e) { Console.Error.WriteLine(e); failedCount++; } finally { Snippets.SaveAndVerifyAssemblies(); } }
private void RunTestCase(TestCase /*!*/ testCase) { _testRuntime = new TestRuntime(this, testCase); if (_verbose) { Console.WriteLine("Executing {0}", testCase.Name); } else { Console.Write('.'); } try { testCase.TestMethod(); } catch (Exception e) { PrintTestCaseFailed(); _unexpectedExceptions.Add(new MutableTuple <string, Exception>(testCase.Name, e)); } finally { Snippets.SaveAndVerifyAssemblies(); } }