internal void NotifyServerCallExit(HttpResponse response) {
            try {
                if (NotifySink == null) return;

                IntPtr bufferPtr;
                int bufferSize = 0;
                CallId callId = new CallId(null, 0, (IntPtr)0, 0, null, null);

                TraceMethod method = Tracing.On ? new TraceMethod(this, "NotifyServerCallExit") : null;
                if (Tracing.On) Tracing.Enter("RemoteDebugger", method);

                UnsafeNativeMethods.OnSyncCallExit(NotifySink, callId, out bufferPtr, ref bufferSize);

                if (Tracing.On) Tracing.Exit("RemoteDebugger", method);

                if (bufferPtr == IntPtr.Zero) return;
                byte[] buffer = null;
                try {
                    buffer = new byte[bufferSize];
                    Marshal.Copy(bufferPtr, buffer, 0, bufferSize);
                }
                finally {
                    Marshal.FreeCoTaskMem(bufferPtr);
                }
                string stringBuffer = Convert.ToBase64String(buffer);
                response.AddHeader(debuggerHeader, stringBuffer);
            }
            catch (Exception e) {
                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException) {
                    throw;
                }
                if (Tracing.On) Tracing.ExceptionCatch(TraceEventType.Warning, typeof(RemoteDebugger), "NotifyServerCallExit", e);
            }
            this.Close();
        }
        internal void NotifyClientCallReturn(WebResponse response) {
            try {
                if (NotifySink == null) return;

                byte[] buffer = new byte[0];
                if (response != null) {
                    string bufferString = response.Headers[debuggerHeader];
                    if (bufferString != null && bufferString.Length != 0)
                        buffer = Convert.FromBase64String(bufferString);
                }
                CallId callId = new CallId(null, 0, (IntPtr)0, 0, null, null);

                TraceMethod method = Tracing.On ? new TraceMethod(this, "NotifyClientCallReturn") : null;
                if (Tracing.On) Tracing.Enter("RemoteDebugger", method);

                UnsafeNativeMethods.OnSyncCallReturn(NotifySink, callId, buffer, buffer.Length);

                if (Tracing.On) Tracing.Exit("RemoteDebugger", method);
            }
            catch (Exception e) {
                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException) {
                    throw;
                }
                if (Tracing.On) Tracing.ExceptionCatch(TraceEventType.Warning, typeof(RemoteDebugger), "NotifyClientCallReturn", e);
            }

            this.Close();
        }
        internal void NotifyServerCallEnter(ServerProtocol protocol, string stringBuffer) {
            try {
                if (NotifySink == null) return;
                StringBuilder methodBuilder = new StringBuilder();
                methodBuilder.Append(protocol.Type.FullName);
                methodBuilder.Append('.');
                methodBuilder.Append(protocol.MethodInfo.Name);
                methodBuilder.Append('(');
                ParameterInfo[] parameterInfos = protocol.MethodInfo.Parameters;
                for (int i = 0; i < parameterInfos.Length; ++i) {
                    if (i != 0)
                        methodBuilder.Append(',');

                    methodBuilder.Append(parameterInfos[i].ParameterType.FullName);
                }
                methodBuilder.Append(')');

                byte[] buffer = Convert.FromBase64String(stringBuffer);
                CallId callId = new CallId(null, 0, (IntPtr)0, 0, methodBuilder.ToString(), null);

                TraceMethod method = Tracing.On ? new TraceMethod(this, "NotifyServerCallEnter") : null;
                if (Tracing.On) Tracing.Enter("RemoteDebugger", method);

                UnsafeNativeMethods.OnSyncCallEnter(NotifySink, callId, buffer, buffer.Length);

                if (Tracing.On) Tracing.Exit("RemoteDebugger", method);
            }
            catch (Exception e) {
                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException) {
                    throw;
                }
                if (Tracing.On) Tracing.ExceptionCatch(TraceEventType.Warning, typeof(RemoteDebugger), "NotifyServerCallEnter", e);
            }
        }
 internal static void OnSyncCallExit(INotifySink2 sink, CallId callId, out IntPtr out_ppBuffer, ref int inout_pBufferSize) {
     sink.OnSyncCallExit(callId, out out_ppBuffer, ref inout_pBufferSize);
 }
 internal static void OnSyncCallReturn(INotifySink2 sink, CallId callId, byte[] in_pBuffer, int in_BufferSize) {
     sink.OnSyncCallReturn(callId, in_pBuffer, in_BufferSize);
 }
 internal void NotifyServerCallExit(HttpResponse response)
 {
     try
     {
         IntPtr ptr;
         if (this.NotifySink == null)
         {
             return;
         }
         int num = 0;
         CallId callId = new CallId(null, 0, IntPtr.Zero, 0L, null, null);
         TraceMethod caller = Tracing.On ? new TraceMethod(this, "NotifyServerCallExit", new object[0]) : null;
         if (Tracing.On)
         {
             Tracing.Enter("RemoteDebugger", caller);
         }
         System.Web.Services.UnsafeNativeMethods.OnSyncCallExit(this.NotifySink, callId, out ptr, ref num);
         if (Tracing.On)
         {
             Tracing.Exit("RemoteDebugger", caller);
         }
         if (ptr == IntPtr.Zero)
         {
             return;
         }
         byte[] destination = null;
         try
         {
             destination = new byte[num];
             Marshal.Copy(ptr, destination, 0, num);
         }
         finally
         {
             Marshal.FreeCoTaskMem(ptr);
         }
         string str = Convert.ToBase64String(destination);
         response.AddHeader(debuggerHeader, str);
     }
     catch (Exception exception)
     {
         if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException))
         {
             throw;
         }
         if (Tracing.On)
         {
             Tracing.ExceptionCatch(TraceEventType.Warning, typeof(RemoteDebugger), "NotifyServerCallExit", exception);
         }
     }
     this.Close();
 }
 internal void NotifyServerCallEnter(ServerProtocol protocol, string stringBuffer)
 {
     try
     {
         if (this.NotifySink != null)
         {
             StringBuilder builder = new StringBuilder();
             builder.Append(protocol.Type.FullName);
             builder.Append('.');
             builder.Append(protocol.MethodInfo.Name);
             builder.Append('(');
             ParameterInfo[] parameters = protocol.MethodInfo.Parameters;
             for (int i = 0; i < parameters.Length; i++)
             {
                 if (i != 0)
                 {
                     builder.Append(',');
                 }
                 builder.Append(parameters[i].ParameterType.FullName);
             }
             builder.Append(')');
             byte[] buffer = Convert.FromBase64String(stringBuffer);
             CallId callId = new CallId(null, 0, IntPtr.Zero, 0L, builder.ToString(), null);
             TraceMethod caller = Tracing.On ? new TraceMethod(this, "NotifyServerCallEnter", new object[0]) : null;
             if (Tracing.On)
             {
                 Tracing.Enter("RemoteDebugger", caller);
             }
             System.Web.Services.UnsafeNativeMethods.OnSyncCallEnter(this.NotifySink, callId, buffer, buffer.Length);
             if (Tracing.On)
             {
                 Tracing.Exit("RemoteDebugger", caller);
             }
         }
     }
     catch (Exception exception)
     {
         if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException))
         {
             throw;
         }
         if (Tracing.On)
         {
             Tracing.ExceptionCatch(TraceEventType.Warning, typeof(RemoteDebugger), "NotifyServerCallEnter", exception);
         }
     }
 }
 internal void NotifyClientCallReturn(WebResponse response)
 {
     try
     {
         if (this.NotifySink == null)
         {
             return;
         }
         byte[] buffer = new byte[0];
         if (response != null)
         {
             string s = response.Headers[debuggerHeader];
             if ((s != null) && (s.Length != 0))
             {
                 buffer = Convert.FromBase64String(s);
             }
         }
         CallId callId = new CallId(null, 0, IntPtr.Zero, 0L, null, null);
         TraceMethod caller = Tracing.On ? new TraceMethod(this, "NotifyClientCallReturn", new object[0]) : null;
         if (Tracing.On)
         {
             Tracing.Enter("RemoteDebugger", caller);
         }
         System.Web.Services.UnsafeNativeMethods.OnSyncCallReturn(this.NotifySink, callId, buffer, buffer.Length);
         if (Tracing.On)
         {
             Tracing.Exit("RemoteDebugger", caller);
         }
     }
     catch (Exception exception)
     {
         if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException))
         {
             throw;
         }
         if (Tracing.On)
         {
             Tracing.ExceptionCatch(TraceEventType.Warning, typeof(RemoteDebugger), "NotifyClientCallReturn", exception);
         }
     }
     this.Close();
 }