Exemple #1
0
 internal void DispatchEvent(ManagedCallbackType callback,CorEventArgs e)
 {
     try
     {
         if( m_callbackAttachedEvent!=null )
             m_callbackAttachedEvent.WaitOne(); // waits till callbacks are enabled
         Debug.Assert((int)callback>=0 && (int)callback<m_callbacksArray.Length);
         Delegate d = m_callbacksArray[(int)callback];
         if( d!=null )
             d.DynamicInvoke( new Object[]{this,e});
     }
     catch(Exception ex)
     {
         CorExceptionInCallbackEventArgs e2 = new CorExceptionInCallbackEventArgs(e.Controller,ex);
         Debug.Assert(false,"Exception in callback: "+ex.ToString());
         try 
         {
             // we need to dispatch the exceptin in callback error, but we cannot
             // use DispatchEvent since throwing exception in ExceptionInCallback
             // would lead to infinite recursion.
             Debug.Assert( m_callbackAttachedEvent==null);
             Delegate d = m_callbacksArray[(int)ManagedCallbackType.OnExceptionInCallback];
             if( d!=null )
                 d.DynamicInvoke( new Object[]{this, e2});
         } 
         catch(Exception ex2)
         {
             Debug.Assert(false,"Exception in Exception notification callback: "+ex2.ToString());
             // ignore it -- there is nothing we can do.
         }
         e.Continue = e2.Continue;
     }
 }
        internal void DispatchEvent(ManagedCallbackType callback, CorEventArgs e)
        {
            try
            {
                // CorProcess.Continue has an extra abstraction layer. 
                // - The fist call just sets m_callbackAttachedEvent
                // - future calls go to ICorDebugProcess::Continue.
                // This ensures that we don't dispatch any callbacks until
                // after CorProcess.Continue() is called. 
                if (m_callbackAttachedEvent != null)
                {
                    m_callbackAttachedEvent.WaitOne(); // waits till callbacks are enabled
                }

                Debug.Assert((int)callback >= 0 && (int)callback < m_callbacksArray.Length);
                Delegate d = m_callbacksArray[(int)callback];
                if (d != null)
                {
                    d.DynamicInvoke(new Object[] { this, e });
                }
            }
            catch (Exception ex)
            {
                CorExceptionInCallbackEventArgs e2 = new CorExceptionInCallbackEventArgs(e.Controller, ex);
                Debug.Assert(false, "Exception in callback: " + ex.ToString());
                try
                {
                    // we need to dispatch the exception in callback error, but we cannot
                    // use DispatchEvent since throwing exception in ExceptionInCallback
                    // would lead to infinite recursion.
                    Debug.Assert(m_callbackAttachedEvent == null);
                    Delegate d = m_callbacksArray[(int)ManagedCallbackType.OnExceptionInCallback];
                    if (d != null)
                        d.DynamicInvoke(new Object[] { this, e2 });
                }
                catch (Exception ex2)
                {
                    Debug.Assert(false, "Exception in Exception notification callback: " + ex2.ToString());
                    // ignore it -- there is nothing we can do.
                }
                e.Continue = e2.Continue;
            }
        }
Exemple #3
0
        private void ExceptionInCallbackEventHandler(Object sender, CorExceptionInCallbackEventArgs e)
        {
            Trace.WriteLine("CorProcess::ExceptionInCallback");

            e.Continue = false;
            m_stopReason = new MDbgErrorStopReason(e.ExceptionThrown);
            m_stopGo.MarkAsStopped();
            m_stopCounter = g_stopCounter++;
            m_stopEvent.Set();
        }