示例#1
0
        /// <summary>
        /// Sends a single DiagnosticsIpc Message to the dotnet process with PID processId
        /// and returns the Stream for reuse in Optional Continuations.
        /// </summary>
        /// <param name="endpoint">An endpoint that provides a diagnostics connection to a runtime instance.</param>
        /// <param name="message">The DiagnosticsIpc Message to be sent</param>
        /// <param name="response">out var for response message</param>
        /// <returns>The response DiagnosticsIpc Message from the dotnet process</returns>
        public static Stream SendMessage(IpcEndpoint endpoint, IpcMessage message, out IpcMessage response)
        {
            var stream = endpoint.Connect(ConnectTimeout);

            Write(stream, message);
            response = Read(stream);
            return(stream);
        }
示例#2
0
 /// <summary>
 /// Sends a single DiagnosticsIpc Message to the dotnet process with PID processId.
 /// </summary>
 /// <param name="endpoint">An endpoint that provides a diagnostics connection to a runtime instance.</param>
 /// <param name="message">The DiagnosticsIpc Message to be sent</param>
 /// <returns>The response DiagnosticsIpc Message from the dotnet process</returns>
 public static IpcMessage SendMessage(IpcEndpoint endpoint, IpcMessage message)
 {
     using (var stream = endpoint.Connect(ConnectTimeout))
     {
         Write(stream, message);
         return(Read(stream));
     }
 }
示例#3
0
        /// <summary>
        /// Sends a single DiagnosticsIpc Message to the dotnet process associated with the <paramref name="endpoint"/>.
        /// </summary>
        /// <param name="endpoint">An endpoint that provides a diagnostics connection to a runtime instance.</param>
        /// <param name="message">The DiagnosticsIpc Message to be sent</param>
        /// <returns>An <see cref="IpcResponse"/> containing the response message and continuation stream.</returns>
        public static IpcResponse SendMessageGetContinuation(IpcEndpoint endpoint, IpcMessage message)
        {
            Stream stream = null;

            try
            {
                stream = endpoint.Connect(ConnectTimeout);

                Write(stream, message);

                IpcMessage response = Read(stream);

                return(new IpcResponse(response, Release(ref stream)));
            }
            finally
            {
                stream?.Dispose();
            }
        }