Exemple #1
0
        public static EvalException CreateEvalException02()
        {
            string        msg           = string.Empty;
            EvalException evalException = new EvalException(msg);

            return(evalException);
        }
Exemple #2
0
        public static EvalException CreateEvalException01()
        {
            string        varName       = string.Empty;
            EvalException evalException = EvalException.VariableNotExist(varName);

            return(evalException);
        }
 protected override unsafe int OnEvalException(
     CorDebugAppDomain pAppDomain,
     CorDebugThread pThread,
     CorDebugEval pEval)
 {
     EvalException?.Invoke(this, pAppDomain, pThread, pEval);
     return(Continue());
 }
Exemple #4
0
        public void TestCreateEvalException02()
        {
            EvalException evalException = CreateEvalException02();

            Assert.IsNotNull(evalException);
            #region Record State
            ValueRecorder recorder = new ValueRecorder();
            recorder.Record((string)evalException.HelpLink);
            recorder.Record((string)evalException.Message);
            recorder.Record((string)evalException.Source);
            recorder.Record((string)evalException.StackTrace);
            recorder.FinishRecording();
            #endregion
        }
Exemple #5
0
        public void TestVariableNotExist01()
        {
            string        varName       = string.Empty;
            EvalException evalException = EvalException.VariableNotExist(varName);

            #region Record State
            ValueRecorder recorder = new ValueRecorder();
            recorder.Record <string>(delegate { return((string)evalException.HelpLink); });
            recorder.Record <string>(delegate { return((string)evalException.Message); });
            recorder.Record <string>(delegate { return((string)evalException.Source); });
            recorder.Record <string>(delegate { return((string)evalException.StackTrace); });
            recorder.FinishRecording();
            #endregion
        }
Exemple #6
0
        public void TestEvalExceptionConstructor01()
        {
            string        msg           = string.Empty;
            EvalException evalException = new EvalException(msg);

            #region Record State
            ValueRecorder recorder = new ValueRecorder();
            recorder.Record((string)evalException.HelpLink);
            recorder.Record((string)evalException.Message);
            recorder.Record((string)evalException.Source);
            recorder.Record((string)evalException.StackTrace);
            recorder.FinishRecording();
            #endregion
        }
        internal override Result Eval(Evaluator evaluater, Result[] argArray)
        {
            if (!evaluater.VariableHolder.Exists(this.Name))
            {
                throw EvalException.VariableNotExist(this.Name);
            }

            object o = evaluater.VariableHolder.GetVariable(this.Name);

            if (o == null)
            {
                return(new Result(null, null));
            }
            return(new Result(o.GetType(), o));
        }