예제 #1
0
        void HandleCompilingErrors(Action action)
        {
            CompilationResult.Reset();

            try
            {
                action();
            }
            catch (Exception)
            {
                if (CompilationResult.HasErrors)
                {
                    throw CompilationResult.CreateException();
                }
                else
                {
                    //The exception is most likely related to the compilation error
                    //so do noting. Alternatively (may be in the future) we can add
                    //it to the errors collection.
                    //CompilingResult.Errors.Add(e.ToString());
                    throw;
                }
            }
            finally
            {
                //We need to reset Evaluator every time after compilation exception occurs
                //because Mono throws error on attempt to compile again in this case
                if (CompilationResult.HasErrors)
                {
                    SoftReset();
                }

                //Keep CompilationOutput instance with relevant information about last compilation
                UpdateCompilationOutput();
            }
        }