// returns true if the CustomPostCallback requested stop.
        private bool HandleCustomPostCallback(ManagedCallbackType callbackType, CorEventArgs callbackArgs)
        {
            bool stopRequested = false;
            bool needAsyncStopCall = false;
            if (!needAsyncStopCall)
            {
                Threads.RefreshStack();
            }


            using (var psc = new MDbgProcessStopController(this, callbackArgs, needAsyncStopCall))
            {
                if (PostDebugEvent != null)
                {
                    PostDebugEvent(this, new CustomPostCallbackEventArgs(psc, callbackType, callbackArgs));
                    stopRequested = psc.CustomStopRequested;
                }
            } // end using

            return stopRequested;
        }
 /// <summary>
 /// Creates a new instance of the CustomEvalEventArgs class.
 /// </summary>
 /// <param name="processController">Which IMDbgProcessController to store in the Object.</param>
 /// <param name="callbackArgs">Which CorEvalEventArgs to encapsulate in this wrapper.</param>
 /// <param name="callbackType">What Callback type this was.</param>
 public CustomPostCallbackEventArgs(IMDbgProcessController processController,
                                    ManagedCallbackType callbackType,
                                    Object callbackArgs)
     : base(processController)
 {
     this.callbackType = callbackType;
     this.callbackArgs = callbackArgs;
 }
 private bool InternalHandleRawMode(ManagedCallbackType callbackType, CorEventArgs callbackArgs)
 {
     lock (this)
     {
         switch (RawModeType)
         {
             case RawMode.None:
                 return false;
             case RawMode.AlwaysStop:
                 callbackArgs.Continue = false;
                 m_stopReason = new RawModeStopReason(callbackType, callbackArgs);
                 ++m_stopCount;
                 Debug.Assert(m_stopCount == 1, "StopCount=" + m_stopCount);
                 // we should be stopped just by this event
                 m_stopCounter = g_stopCounter++;
                 m_stopEvent.Set();
                 return true;
             case RawMode.NeverStop:
                 return true;
             default:
                 Debug.Assert(false);
                 return false;
         }
     }
 }