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); } } }
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 } }