Esempio n. 1
0
        /// <summary>
        /// Gets all environement variables and their values from the target process.
        /// </summary>
        /// <returns>A dictionary containing all of the environment variables defined in the target process.</returns>
        public Dictionary <string, string> GetProcessEnvironment()
        {
            IpcMessage message = CreateProcessEnvironmentMessage();

            using IpcResponse response = IpcClient.SendMessageGetContinuation(_endpoint, message);
            ValidateResponseMessage(response.Message, nameof(GetProcessEnvironmentAsync));

            ProcessEnvironmentHelper helper = ProcessEnvironmentHelper.Parse(response.Message.Payload);

            return(helper.ReadEnvironment(response.Continuation));
        }
Esempio n. 2
0
        internal async Task <Dictionary <string, string> > GetProcessEnvironmentAsync(CancellationToken token)
        {
            IpcMessage message = CreateProcessEnvironmentMessage();

            using IpcResponse response = await IpcClient.SendMessageGetContinuationAsync(_endpoint, message, token).ConfigureAwait(false);

            ValidateResponseMessage(response.Message, nameof(GetProcessEnvironmentAsync));

            ProcessEnvironmentHelper helper = ProcessEnvironmentHelper.Parse(response.Message.Payload);

            return(await helper.ReadEnvironmentAsync(response.Continuation, token).ConfigureAwait(false));
        }
Esempio n. 3
0
 private EventPipeSession(IpcEndpoint endpoint, IpcResponse response, long sessionId)
 {
     _endpoint  = endpoint;
     _response  = response;
     _sessionId = sessionId;
 }
Esempio n. 4
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>
        /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
        /// <returns>An <see cref="IpcMessage"/> that is the response message.</returns>
        public static async Task <IpcMessage> SendMessageAsync(IpcEndpoint endpoint, IpcMessage message, CancellationToken cancellationToken)
        {
            using IpcResponse response = await SendMessageGetContinuationAsync(endpoint, message, cancellationToken).ConfigureAwait(false);

            return(response.Message);
        }
Esempio n. 5
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="IpcMessage"/> that is the response message.</returns>
 public static IpcMessage SendMessage(IpcEndpoint endpoint, IpcMessage message)
 {
     using IpcResponse response = SendMessageGetContinuation(endpoint, message);
     return(response.Message);
 }