internal async Task SetEnvironmentVariableAsync(string name, string value, CancellationToken token) { IpcMessage request = CreateSetEnvironmentVariableMessage(name, value); IpcMessage response = await IpcClient.SendMessageAsync(_endpoint, request, token).ConfigureAwait(false); ValidateResponseMessage(response, nameof(SetEnvironmentVariableAsync)); }
internal async Task ResumeRuntimeAsync(CancellationToken token) { IpcMessage request = CreateResumeRuntimeMessage(); IpcMessage response = await IpcClient.SendMessageAsync(_endpoint, request, token).ConfigureAwait(false); ValidateResponseMessage(response, nameof(ResumeRuntimeAsync)); }
internal async Task SetStartupProfilerAsync(Guid profilerGuid, string profilerPath, CancellationToken token) { IpcMessage request = CreateSetStartupProfilerMessage(profilerGuid, profilerPath); IpcMessage response = await IpcClient.SendMessageAsync(_endpoint, request, token).ConfigureAwait(false); ValidateResponseMessage(response, nameof(SetStartupProfilerAsync), ValidateResponseOptions.InvalidArgumentIsRequiresSuspension); }
internal async Task AttachProfilerAsync(TimeSpan attachTimeout, Guid profilerGuid, string profilerPath, byte[] additionalData, CancellationToken token) { IpcMessage request = CreateAttachProfilerMessage(attachTimeout, profilerGuid, profilerPath, additionalData); IpcMessage response = await IpcClient.SendMessageAsync(_endpoint, request, token).ConfigureAwait(false); ValidateResponseMessage(response, nameof(AttachProfilerAsync)); }
/// <summary> /// Trigger a core dump generation. /// </summary> /// <param name="dumpType">Type of the dump to be generated</param> /// <param name="dumpPath">Full path to the dump to be generated. By default it is /tmp/coredump.{pid}</param> /// <param name="logDumpGeneration">When set to true, display the dump generation debug log to the console.</param> /// <param name="token">The token to monitor for cancellation requests.</param> internal async Task WriteDumpAsync(DumpType dumpType, string dumpPath, bool logDumpGeneration, CancellationToken token) { IpcMessage request = CreateWriteDumpMessage(dumpType, dumpPath, logDumpGeneration); IpcMessage response = await IpcClient.SendMessageAsync(_endpoint, request, token).ConfigureAwait(false); ValidateResponseMessage(response, nameof(WriteDumpAsync)); }
/// <summary> /// Trigger a core dump generation. /// </summary> /// <param name="dumpType">Type of the dump to be generated</param> /// <param name="dumpPath">Full path to the dump to be generated. By default it is /tmp/coredump.{pid}</param> /// <param name="flags">logging and crash report flags. On runtimes less than 6.0, only LoggingEnabled is supported.</param> /// <param name="token">The token to monitor for cancellation requests.</param> public async Task WriteDumpAsync(DumpType dumpType, string dumpPath, WriteDumpFlags flags, CancellationToken token) { IpcMessage request = CreateWriteDumpMessage2(dumpType, dumpPath, flags); IpcMessage response = await IpcClient.SendMessageAsync(_endpoint, request, token).ConfigureAwait(false); if (!ValidateResponseMessage(response, nameof(WriteDumpAsync), ValidateResponseOptions.UnknownCommandReturnsFalse)) { if ((flags & ~WriteDumpFlags.LoggingEnabled) != 0) { throw new ArgumentException($"Only {nameof(WriteDumpFlags.LoggingEnabled)} flag is supported by this runtime version", nameof(flags)); } await WriteDumpAsync(dumpType, dumpPath, logDumpGeneration : (flags & WriteDumpFlags.LoggingEnabled) != 0, token); } }
public async Task StopAsync(CancellationToken cancellationToken) { if (TryCreateStopMessage(out IpcMessage requestMessage)) { try { IpcMessage response = await IpcClient.SendMessageAsync(_endpoint, requestMessage, cancellationToken).ConfigureAwait(false); DiagnosticsClient.ValidateResponseMessage(response, nameof(StopAsync)); } // On non-abrupt exits (i.e. the target process has already exited and pipe is gone, sending Stop command will fail). catch (IOException) { throw new ServerNotAvailableException("Could not send Stop command. The target process may have exited."); } } }