private void HandleCustomHostLaunch(ITestHostLauncher customHostLauncher, Message message) { var ackPayload = new CustomHostLaunchAckPayload() { HostProcessId = -1, ErrorMessage = null }; try { var testProcessStartInfo = this.dataSerializer.DeserializePayload <TestProcessStartInfo>(message); ackPayload.HostProcessId = customHostLauncher != null ? customHostLauncher.LaunchTestHost(testProcessStartInfo) : -1; } catch (Exception ex) { EqtTrace.Error("Error while launching custom host: {0}", ex); // Vstest.console will send the abort message properly while cleaning up all the flow, so do not abort here // Let the ack go through and let vstest.console handle the error ackPayload.ErrorMessage = ex.Message; } finally { // Always unblock the Vstest.console thread which is indefintitely waiting on this ACK this.communicationManager.SendMessage(MessageType.CustomTestHostLaunchCallback, ackPayload, this.protocolVersion); } }
public void InvokeCustomHostLaunchAckCallback(int processId, string errorMessage) { var payload = new CustomHostLaunchAckPayload() { HostProcessId = processId, ErrorMessage = errorMessage }; this.onAckMessageReceived?.Invoke( new Message() { MessageType = MessageType.CustomTestHostLaunchCallback, Payload = JToken.FromObject(payload) }); }
void OnCustomTestLaunch(Message message) { var launchAckPayload = new CustomHostLaunchAckPayload { HostProcessId = -1 }; try { var startInfo = dataSerializer.DeserializePayload <TestProcessStartInfo> (message); launchAckPayload.HostProcessId = StartCustomTestHost(startInfo, runJobInProgress.TestContext); } catch (Exception ex) { LoggingService.LogError("Unable to start custom test host.", ex); launchAckPayload.ErrorMessage = ex.Message; runJobInProgress.TestContext.Monitor.ReportRuntimeError(GettextCatalog.GetString("Unable to start test host."), ex); } finally { communicationManager.SendMessage(MessageType.CustomTestHostLaunchCallback, launchAckPayload); } }