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
            }
        }
예제 #3
0
 internal void NotifyClientCallOut(WebRequest request)
 {
     if (RemoteDebugger.IsClientCallOutEnabled())
     {
         debugger = new RemoteDebugger();
         debugger.NotifyClientCallOut(request);
     }
     else
     {
         debugger = null;
     }
 }
        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);
                }
            }
        }
예제 #5
0
        /// <include file='doc\ClientProtocol.uex' path='docs/doc[@for="WebClientProtocol.GetWebRequest"]/*' />
        /// <devdoc>
        ///    <para>
        ///     Creates a new <see cref='System.Net.WebRequest'/> instance for the given url. The base implementation creates a new
        ///     instance using the WebRequest.Create() and then sets request related properties from
        ///     the WebClientProtocol instance. Derived classes can override this method if additional
        ///     properties need to be set on the web request instance.
        ///    </para>
        /// </devdoc>
        protected virtual WebRequest GetWebRequest(Uri uri)
        {
            if (uri == null)
            {
                throw new InvalidOperationException(Res.GetString(Res.WebMissingPath));
            }
            WebRequest request = (WebRequest)WebRequest.Create(uri);

            PendingSyncRequest          = request;
            request.Timeout             = this.timeout;
            request.ConnectionGroupName = connectionGroupName;
            request.Credentials         = Credentials;
            request.PreAuthenticate     = PreAuthenticate;
            if (RemoteDebugger.IsClientCallOutEnabled())
            {
                debugger = new RemoteDebugger();
                debugger.NotifyClientCallOut(request);
            }
            else
            {
                debugger = null;
            }
            return(request);
        }
        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);
            }
        }
        internal void NotifyClientCallOut(WebRequest request) {
#if !MONO
            if (RemoteDebugger.IsClientCallOutEnabled()) {
                debugger = new RemoteDebugger();
                debugger.NotifyClientCallOut(request);
            }
            else {
                debugger = null;
            }
#endif
        }
        /// <summary>
        /// Instantiate a new remote <see cref="T:TcmDebugger.Host.Debugger" /> and return the unique session id.
        /// </summary>
        /// <returns>Remote <see cref="T:TcmDebugger.Host.Debugger" /> session id.</returns>
        protected Debugger StartNewDebugger()
        {
            RemoteDebugger remoteDebugger = new RemoteDebugger();
            mDebugSessions.TryAdd(remoteDebugger.SessionId, remoteDebugger);

            return remoteDebugger.Debugger;
        }
 internal void NotifyClientCallOut(WebRequest request)
 {
     if (RemoteDebugger.IsClientCallOutEnabled())
     {
         this.debugger = new RemoteDebugger();
         this.debugger.NotifyClientCallOut(request);
     }
     else
     {
         this.debugger = null;
     }
 }
 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);
         }
     }
 }