Example #1
0
        /// <param name="threadToRun"> Run this thread and freeze all other threads </param>
        internal void AsyncContinue(DebuggeeStateAction action, Thread threadToRun = null)
        {
            AssertPaused();

            try {
                if (threadToRun != null)
                {
                    corProcess.SetAllThreadsDebugState(CorDebugThreadState.THREAD_SUSPEND, null);
                    threadToRun.CorThread.SetDebugState(CorDebugThreadState.THREAD_RUN);
                }
                else
                {
                    corProcess.SetAllThreadsDebugState(CorDebugThreadState.THREAD_RUN, null);
                }

                NotifyResumed(action);
                corProcess.Continue(0);
                // this.TraceMessage("Continue");
            } catch (COMException ex) {
                if (ex.HResult == unchecked ((int)0x80131301))
                {
                    // Process was terminated. (Exception from HRESULT: 0x80131301)
                    // This occurs if a process is killed (e.g. console window of console application closed)
                    // while the application is doing something involving debugger callbacks (Debug.WriteLine calls, or throwing+handling exceptions).

                    // I think we can safely ignore this error.
                }
            }
            if (action == DebuggeeStateAction.Clear)
            {
                OnResumed();
            }
        }
Example #2
0
        /// <param name="threadToRun"> Run this thread and freeze all other threads </param>
        internal void AsyncContinue(DebuggeeStateAction action, Thread threadToRun = null)
        {
            AssertPaused();

            if (threadToRun != null)
            {
                corProcess.SetAllThreadsDebugState(CorDebugThreadState.THREAD_SUSPEND, null);
                threadToRun.CorThread.SetDebugState(CorDebugThreadState.THREAD_RUN);
            }
            else
            {
                corProcess.SetAllThreadsDebugState(CorDebugThreadState.THREAD_RUN, null);
            }

            NotifyResumed(action);
            corProcess.Continue(0);
            // this.TraceMessage("Continue");

            if (action == DebuggeeStateAction.Clear)
            {
                OnResumed();
            }
        }