// This method evaluates the expression synchronously. int IDebugExpression2.EvaluateSync(enum_EVALFLAGS dwFlags, uint dwTimeout, IDebugEventCallback2 pExprCallback, out IDebugProperty2 ppResult) { AutoResetEvent completion = new AutoResetEvent(false); LuaEvaluationResult result = null; _frame.StackFrame.ExecuteText(_expression, (obj) => { result = obj; completion.Set(); }); while (!_frame.StackFrame.Thread.Process.HasExited && !completion.WaitOne(Math.Min((int)dwTimeout, 100))) { if (dwTimeout <= 100) { break; } dwTimeout -= 100; } if (_frame.StackFrame.Thread.Process.HasExited || result == null) { ppResult = null; return(VSConstants.E_FAIL); } else if (result == null) { ppResult = null; return(DebuggerConstants.E_EVALUATE_TIMEOUT); } if (result != null && !result.ExecuteText) { ppResult = null; return(VSConstants.S_FALSE); } ppResult = new AD7Property(_frame, result, _writable); return(VSConstants.S_OK); }
public AD7Property(AD7StackFrame frame, LuaEvaluationResult obj, bool writable = false) { _evalResult = obj; _frame = frame; _writable = writable; }