/// <summary> /// Marks the thread to be exited. /// </summary> /// <param name="action"> /// The resume action for the debugger. If the frame is not a debugger frame this parameter /// is ignored. /// </param> /// <param name="waitForExit"> /// Indicates whether the method should block until the exit is completed. /// </param> internal void StartThreadExit(DebuggerResumeAction action, bool waitForExit) { Task.Run(() => FrameExitTask.TrySetResult(action)); if (!waitForExit) { return; } _nestFrame.WaitForFrameExit(CancellationToken.None); }