void Invoke()
        {
            PrepareContext();
            object[] parameters = protocol.ReadParameters();
            protocol.CreateServerInstance();

            string         stringBuffer;
            RemoteDebugger debugger = null;

            if (!protocol.IsOneWay && RemoteDebugger.IsServerCallInEnabled(protocol, out stringBuffer))
            {
                debugger = new RemoteDebugger();
                debugger.NotifyServerCallEnter(protocol, stringBuffer);
            }

            try {
                object[] returnValues = protocol.MethodInfo.Invoke(protocol.Target, parameters);
                WriteReturns(returnValues);
            }
            catch (Exception e) {
                if (!protocol.IsOneWay)
                {
                    WriteException(e);
                }
                throw;
            }
            finally {
                protocol.DisposeServerInstance();

                if (debugger != null)
                {
                    debugger.NotifyServerCallExit(protocol.Response);
                }
            }
        }
Пример #2
0
        void Invoke()
        {
            PrepareContext();
            protocol.CreateServerInstance();

            string stringBuffer;

#if !MONO
            RemoteDebugger debugger = null;
            if (!protocol.IsOneWay && RemoteDebugger.IsServerCallInEnabled(protocol, out stringBuffer))
            {
                debugger = new RemoteDebugger();
                debugger.NotifyServerCallEnter(protocol, stringBuffer);
            }
#endif
            try {
                TraceMethod caller     = Tracing.On ? new TraceMethod(this, "Invoke") : null;
                TraceMethod userMethod = Tracing.On ? new TraceMethod(protocol.Target, protocol.MethodInfo.Name, this.parameters) : null;
                if (Tracing.On)
                {
                    Tracing.Enter(protocol.MethodInfo.ToString(), caller, userMethod);
                }
                object[] returnValues = protocol.MethodInfo.Invoke(protocol.Target, this.parameters);
                if (Tracing.On)
                {
                    Tracing.Exit(protocol.MethodInfo.ToString(), caller);
                }
                WriteReturns(returnValues);
            }
            catch (Exception e) {
                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException)
                {
                    throw;
                }
                if (Tracing.On)
                {
                    Tracing.ExceptionCatch(TraceEventType.Error, this, "Invoke", e);
                }
                if (!protocol.IsOneWay)
                {
                    WriteException(e);
                    throw;
                }
            }
            finally {
                protocol.DisposeServerInstance();
#if !MONO
                if (debugger != null)
                {
                    debugger.NotifyServerCallExit(protocol.Response);
                }
#endif
            }
        }
        private void Invoke()
        {
            string str;

            this.PrepareContext();
            this.protocol.CreateServerInstance();
            RemoteDebugger debugger = null;

            if (!this.protocol.IsOneWay && RemoteDebugger.IsServerCallInEnabled(this.protocol, out str))
            {
                debugger = new RemoteDebugger();
                debugger.NotifyServerCallEnter(this.protocol, str);
            }
            try
            {
                TraceMethod caller      = Tracing.On ? new TraceMethod(this, "Invoke", new object[0]) : null;
                TraceMethod callDetails = Tracing.On ? new TraceMethod(this.protocol.Target, this.protocol.MethodInfo.Name, this.parameters) : null;
                if (Tracing.On)
                {
                    Tracing.Enter(this.protocol.MethodInfo.ToString(), caller, callDetails);
                }
                object[] returnValues = this.protocol.MethodInfo.Invoke(this.protocol.Target, this.parameters);
                if (Tracing.On)
                {
                    Tracing.Exit(this.protocol.MethodInfo.ToString(), caller);
                }
                this.WriteReturns(returnValues);
            }
            catch (Exception exception)
            {
                if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException))
                {
                    throw;
                }
                if (Tracing.On)
                {
                    Tracing.ExceptionCatch(TraceEventType.Error, this, "Invoke", exception);
                }
                if (!this.protocol.IsOneWay)
                {
                    this.WriteException(exception);
                    throw;
                }
            }
            finally
            {
                this.protocol.DisposeServerInstance();
                if (debugger != null)
                {
                    debugger.NotifyServerCallExit(this.protocol.Response);
                }
            }
        }
        void Invoke() {
            PrepareContext();
            protocol.CreateServerInstance();

            string stringBuffer;
            RemoteDebugger debugger = null;
            if (!protocol.IsOneWay && RemoteDebugger.IsServerCallInEnabled(protocol, out stringBuffer)) {
                debugger = new RemoteDebugger();
                debugger.NotifyServerCallEnter(protocol, stringBuffer);
            }

            try {
                TraceMethod caller = Tracing.On ? new TraceMethod(this, "Invoke") : null;
                TraceMethod userMethod = Tracing.On ? new TraceMethod(protocol.Target, protocol.MethodInfo.Name, this.parameters) : null;
                if (Tracing.On) Tracing.Enter(protocol.MethodInfo.ToString(), caller, userMethod);
                object[] returnValues = protocol.MethodInfo.Invoke(protocol.Target, this.parameters);
                if (Tracing.On) Tracing.Exit(protocol.MethodInfo.ToString(), caller);
                WriteReturns(returnValues);
            }
            catch (Exception e) {
                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException) {
                    throw;
                }
                if (Tracing.On) Tracing.ExceptionCatch(TraceEventType.Error, this, "Invoke", e);
                if (!protocol.IsOneWay) {
                    WriteException(e);
                    throw;
                }
            }
            finally {
                protocol.DisposeServerInstance();

                if (debugger != null)
                    debugger.NotifyServerCallExit(protocol.Response);
            }
        }
 private void Invoke()
 {
     string str;
     this.PrepareContext();
     this.protocol.CreateServerInstance();
     RemoteDebugger debugger = null;
     if (!this.protocol.IsOneWay && RemoteDebugger.IsServerCallInEnabled(this.protocol, out str))
     {
         debugger = new RemoteDebugger();
         debugger.NotifyServerCallEnter(this.protocol, str);
     }
     try
     {
         TraceMethod caller = Tracing.On ? new TraceMethod(this, "Invoke", new object[0]) : null;
         TraceMethod callDetails = Tracing.On ? new TraceMethod(this.protocol.Target, this.protocol.MethodInfo.Name, this.parameters) : null;
         if (Tracing.On)
         {
             Tracing.Enter(this.protocol.MethodInfo.ToString(), caller, callDetails);
         }
         object[] returnValues = this.protocol.MethodInfo.Invoke(this.protocol.Target, this.parameters);
         if (Tracing.On)
         {
             Tracing.Exit(this.protocol.MethodInfo.ToString(), caller);
         }
         this.WriteReturns(returnValues);
     }
     catch (Exception exception)
     {
         if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException))
         {
             throw;
         }
         if (Tracing.On)
         {
             Tracing.ExceptionCatch(TraceEventType.Error, this, "Invoke", exception);
         }
         if (!this.protocol.IsOneWay)
         {
             this.WriteException(exception);
             throw;
         }
     }
     finally
     {
         this.protocol.DisposeServerInstance();
         if (debugger != null)
         {
             debugger.NotifyServerCallExit(this.protocol.Response);
         }
     }
 }