string Evaluate(string code) { Process process = WindowsDebugger.CurrentProcess; StackFrame frame = WindowsDebugger.CurrentStackFrame; if (process == null) { return("No process is being debugged"); } if (process.IsRunning) { return("The process is running"); } if (frame == null) { return("No current execution frame"); } try { var val = WindowsDebugger.Evaluate(code, allowSetValue: true); return(ExpressionEvaluationVisitor.FormatValue(WindowsDebugger.EvalThread, val)); } catch (GetValueException e) { return(e.Message); } }
void AssertEval(string expression, string expected) { NUnit.Framework.Assert.AreEqual(expected, ExpressionEvaluationVisitor.FormatValue(EvalThread, Evaluate(CurrentStackFrame, EvalThread, expression, evalContext))); }