void Pause() { if (process.PauseSession.PausedReason == PausedReason.EvalComplete || process.PauseSession.PausedReason == PausedReason.ExceptionIntercepted) { process.DisableAllSteppers(); process.CheckSelectedStackFrames(); // Do not set selected stack frame // Do not raise events } else { // Raise the pause event outside the callback process.Debugger.MTA2STA.AsyncCall(process.RaisePausedEvents); } }
void ExitCallback() { bool hasQueuedCallbacks = process.CorProcess.HasQueuedCallbacks(); if (hasQueuedCallbacks) { process.TraceMessage("Process has queued callbacks"); } if (hasQueuedCallbacks) { process.AsyncContinue(DebuggeeStateAction.Keep); } else if (process.Evaluating) { // Ignore events during property evaluation pausedEventArgs = null; process.AsyncContinue(DebuggeeStateAction.Keep); } else if (pauseOnNextExit) { // process.TraceMessage("Callback exit: Paused"); process.DisableAllSteppers(); if (pausedEventArgs != null) { pausedEventArgs.Thread = threadToReport; threadToReport = null; // Raise the pause event outside the callback // Warning: Make sure that process in not resumed in the meantime DebuggerPausedEventArgs e = pausedEventArgs; // Copy for capture process.Debugger.MTA2STA.AsyncCall(delegate { process.OnPaused(e); }); } pauseOnNextExit = false; pausedEventArgs = null; } else { process.AsyncContinue(DebuggeeStateAction.Keep); } isInCallback = false; }
void Pause() { if (process.PauseSession.PausedReason == PausedReason.EvalComplete || process.PauseSession.PausedReason == PausedReason.ExceptionIntercepted) { // TODO: There might be qued callback after EvalComplete making this unrealiable process.DisableAllSteppers(); process.CheckSelectedStackFrames(); // Do not set selected stack frame // Do not raise events } else { // Raise the pause event outside the callback // Warning: Make sure that process in not resumed in the meantime process.Debugger.MTA2STA.AsyncCall(process.RaisePausedEvents); // The event might probably get called out of order when the process is running again } }