From cc86addd087747188ab5ce5a0a9d6191376c2e5f Mon Sep 17 00:00:00 2001 From: samadala Date: Wed, 21 Mar 2018 16:43:10 +0530 Subject: [PATCH 1/8] Add more logging for datacollection manager --- .../ProxyDataCollectionManager.cs | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs index 89b59fde03..6e6d2ceee4 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs @@ -45,6 +45,8 @@ internal class ProxyDataCollectionManager : IProxyDataCollectionManager private string settingsXml; private int connectionTimeout; private IRequestData requestData; + private int dataCollectionPort; + private int dataCollectionProcessId; /// /// Initializes a new instance of the class. @@ -126,6 +128,7 @@ public Collection AfterTestRunEnd(bool isCanceled, ITestMessageEv this.InvokeDataCollectionServiceAction( () => { + EqtTrace.Verbose("ProxyDataCollectionManager.AfterTestRunEnd: Get attachment set for datacollector processId: {0} port: {1}", dataCollectionProcessId, dataCollectionPort); attachmentSet = this.dataCollectionRequestSender.SendAfterTestRunStartAndGetResult(runEventsHandler, isCanceled); }, runEventsHandler); @@ -159,9 +162,15 @@ public DataCollectionParameters BeforeTestRunStart( this.InvokeDataCollectionServiceAction( () => { + EqtTrace.Verbose("ProxyDataCollectionManager.BeforeTestRunStart: Get env variable and port for datacollector processId: {0} port: {1}", this.dataCollectionProcessId, this.dataCollectionPort); var result = this.dataCollectionRequestSender.SendBeforeTestRunStartAndGetResult(this.settingsXml, runEventsHandler); environmentVariables = result.EnvironmentVariables; dataCollectionEventsPort = result.DataCollectionEventsPort; + + EqtTrace.Verbose( + "ProxyDataCollectionManager.BeforeTestRunStart: SendBeforeTestRunStartAndGetResult successful, env variable from datacollector: {0} and testhost port: {1}", + string.Join(";", environmentVariables), + dataCollectionEventsPort); }, runEventsHandler); return new DataCollectionParameters( @@ -175,21 +184,27 @@ public DataCollectionParameters BeforeTestRunStart( /// public void Dispose() { + EqtTrace.Verbose("ProxyDataCollectionManager.Dispose: calling dospose for datacollector processId: {0} port: {1}", this.dataCollectionProcessId, this.dataCollectionPort); this.dataCollectionRequestSender.Close(); } /// public void Initialize() { - var port = this.dataCollectionRequestSender.InitializeCommunication(); + this.dataCollectionPort = this.dataCollectionRequestSender.InitializeCommunication(); // Warn the user that execution will wait for debugger attach. - var processId = this.dataCollectionLauncher.LaunchDataCollector(null, this.GetCommandLineArguments(port)); + this.dataCollectionProcessId = this.dataCollectionLauncher.LaunchDataCollector(null, this.GetCommandLineArguments(this.dataCollectionPort)); + EqtTrace.Verbose("ProxyDataCollectionManager.Initialize: Launched datacollector processId: {0} port: {1}", this.dataCollectionProcessId, this.dataCollectionPort); + + ChangeConnectionTimeoutIfRequired(dataCollectionProcessId); + + EqtTrace.Verbose("ProxyDataCollectionManager.Initialize: waiting for connection with timeout: {0}", this.connectionTimeout); - ChangeConnectionTimeoutIfRequired(processId); var connected = this.dataCollectionRequestSender.WaitForRequestHandlerConnection(this.connectionTimeout); if (connected == false) { + EqtTrace.Error("ProxyDataCollectionManager.Initialize: failed to connect to datacollector process."); throw new TestPlatformException(string.Format(CultureInfo.CurrentUICulture, CrossPlatEngineResources.FailedToConnectDataCollector)); } } From 014dcfbfbc244c1a88e0ef554c550ac30a15c8bc Mon Sep 17 00:00:00 2001 From: samadala Date: Thu, 22 Mar 2018 19:55:27 +0530 Subject: [PATCH 2/8] Skip additional messages --- .../TestRequestSender.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs index bf570335fe..ae71265b61 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs @@ -384,6 +384,13 @@ private void OnExecutionMessageReceived(object sender, MessageReceivedEventArgs try { var rawMessage = messageReceived.Data; + + if (this.IsOperationComplete()) + { + EqtTrace.Verbose("TestRequestSender: OnExecutionMessageReceived: Operation is already complete. Skip additional messages. message: {0}", rawMessage); + return; + } + if (EqtTrace.IsVerboseEnabled) { EqtTrace.Verbose("TestRequestSender.OnExecutionMessageReceived: Received message: {0}", rawMessage); @@ -444,6 +451,12 @@ private void OnDiscoveryMessageReceived(ITestDiscoveryEventsHandler2 discoveryEv { var rawMessage = args.Data; + if (this.IsOperationComplete()) + { + EqtTrace.Verbose("TestRequestSender: OnDiscoveryMessageReceived: Operation is already complete. Skip additional messages. message: {0}", rawMessage); + return; + } + // Currently each of the operations are not separate tasks since they should not each take much time. This is just a notification. if (EqtTrace.IsVerboseEnabled) { From a84629b9080739a38bd40fc85e950b510895e1f3 Mon Sep 17 00:00:00 2001 From: samadala Date: Fri, 23 Mar 2018 11:24:51 +0530 Subject: [PATCH 3/8] Add more logging --- .../LengthPrefixCommunicationChannel.cs | 4 +++- .../SocketClient.cs | 10 +++++++- .../SocketServer.cs | 14 +++++++---- .../TestRequestSender.cs | 6 +++-- .../Utilities/MulticastDelegateUtilities.cs | 1 + .../EventHandlers/TestRequestHandler.cs | 23 ++++++++++++------- 6 files changed, 42 insertions(+), 16 deletions(-) diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs index c09ad20eb6..9148d228d3 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs @@ -53,7 +53,7 @@ public Task Send(string data) } catch (Exception ex) { - EqtTrace.Verbose("LengthPrefixCommunicationChannel: Error sending data: {0}.", ex); + EqtTrace.Verbose("LengthPrefixCommunicationChannel.Send: Error sending data: {0}.", ex); throw new CommunicationException("Unable to send data over channel.", ex); } @@ -69,6 +69,7 @@ public Task NotifyDataAvailable() if (this.MessageReceived != null) { var data = this.reader.ReadString(); + EqtTrace.Verbose("LengthPrefixCommunicationChannel.NotifyDataAvailable: received data: {0}", data); this.MessageReceived.SafeInvoke(this, new MessageReceivedEventArgs { Data = data }, "LengthPrefixCommunicationChannel: MessageReceived"); } @@ -78,6 +79,7 @@ public Task NotifyDataAvailable() /// public void Dispose() { + EqtTrace.Verbose("LengthPrefixCommunicationChannel.Dispose: Dispose reader and writer."); this.reader.Dispose(); this.writer.Dispose(); } diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketClient.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketClient.cs index 1fc7739f72..f30b850b3f 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketClient.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketClient.cs @@ -24,6 +24,7 @@ public class SocketClient : ICommunicationEndPoint private readonly Func channelFactory; private ICommunicationChannel channel; private bool stopped; + private string endPoint; public SocketClient() : this(stream => new LengthPrefixCommunicationChannel(stream)) @@ -49,11 +50,12 @@ protected SocketClient(Func channelFactory) /// public string Start(string endPoint) { + this.endPoint = endPoint; var ipEndPoint = endPoint.GetIPEndPoint(); if (EqtTrace.IsVerboseEnabled) { - EqtTrace.Verbose("Waiting for connecting to server"); + EqtTrace.Verbose("SocketClient.Start: connecting to server endpoint: {0}", endPoint); } // Don't start if the endPoint port is zero @@ -64,6 +66,8 @@ public string Start(string endPoint) /// public void Stop() { + EqtTrace.Verbose("SocketClient.Stop: connecting to server endpoint: {0}", this.endPoint); + if (!this.stopped) { EqtTrace.Info("SocketClient: Stop: Cancellation requested. Stopping message loop."); @@ -73,6 +77,8 @@ public void Stop() private void OnServerConnected(Task connectAsyncTask) { + EqtTrace.Verbose("SocketClient.OnServerConnected: connected to server endpoint: {0}", this.endPoint); + if (this.Connected != null) { if (connectAsyncTask.IsFaulted) @@ -105,6 +111,8 @@ private void OnServerConnected(Task connectAsyncTask) private void Stop(Exception error) { + EqtTrace.Verbose("SocketClient.Stop: connected to server endpoint: {0}, error:{1}", this.endPoint, error); + if (!this.stopped) { // Do not allow stop to be called multiple times. diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs index 8057e48af6..adf4b26075 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs @@ -31,6 +31,8 @@ public class SocketServer : ICommunicationEndPoint private bool stopped; + private string endPoint; + /// /// Initializes a new instance of the class. /// @@ -60,12 +62,13 @@ protected SocketServer(Func channelFactory) public string Start(string endPoint) { - this.tcpListener = new TcpListener(endPoint.GetIPEndPoint()); + this.endPoint = endPoint; + this.tcpListener = new TcpListener(this.endPoint.GetIPEndPoint()); this.tcpListener.Start(); var connectionInfo = ((IPEndPoint)this.tcpListener.LocalEndpoint).ToString(); - EqtTrace.Info("SocketServer: Listening on end point : {0}", connectionInfo); + EqtTrace.Info("SocketServer.Start: Listening on endpoint : {0}", connectionInfo); // Serves a single client at the moment. An error in connection, or message loop just // terminates the entire server. @@ -76,9 +79,10 @@ public string Start(string endPoint) /// public void Stop() { + EqtTrace.Info("SocketServer.Stop: Stopping server endpoint: {0}", this.endPoint); if (!this.stopped) { - EqtTrace.Info("SocketServer: Stop: Cancellation requested. Stopping message loop."); + EqtTrace.Info("SocketServer.Stop: Cancellation requested. Stopping message loop."); this.cancellation.Cancel(); } } @@ -95,7 +99,7 @@ private void OnClientConnected(TcpClient client) if (EqtTrace.IsVerboseEnabled) { - EqtTrace.Verbose("Client connected, and starting MessageLoopAsync"); + EqtTrace.Verbose("SocketServer.OnClientConnected: Client connected for endpoint: {0}, starting MessageLoopAsync:", this.endPoint); } // Start the message loop @@ -105,6 +109,8 @@ private void OnClientConnected(TcpClient client) private void Stop(Exception error) { + EqtTrace.Info("SocketServer.Stop: Stopping server endpoint: {0} error: {1}", this.endPoint, error); + if (!this.stopped) { // Do not allow stop to be called multiple times. diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs index ae71265b61..b26f13397f 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs @@ -388,7 +388,8 @@ private void OnExecutionMessageReceived(object sender, MessageReceivedEventArgs if (this.IsOperationComplete()) { EqtTrace.Verbose("TestRequestSender: OnExecutionMessageReceived: Operation is already complete. Skip additional messages. message: {0}", rawMessage); - return; + + // return; } if (EqtTrace.IsVerboseEnabled) @@ -454,7 +455,8 @@ private void OnDiscoveryMessageReceived(ITestDiscoveryEventsHandler2 discoveryEv if (this.IsOperationComplete()) { EqtTrace.Verbose("TestRequestSender: OnDiscoveryMessageReceived: Operation is already complete. Skip additional messages. message: {0}", rawMessage); - return; + + // return; } // Currently each of the operations are not separate tasks since they should not each take much time. This is just a notification. diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Utilities/MulticastDelegateUtilities.cs b/src/Microsoft.TestPlatform.CoreUtilities/Utilities/MulticastDelegateUtilities.cs index 234f918fe4..03fa7eebbb 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Utilities/MulticastDelegateUtilities.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Utilities/MulticastDelegateUtilities.cs @@ -41,6 +41,7 @@ public static void SafeInvoke(this Delegate delegates, object sender, EventArgs { try { + EqtTrace.Verbose("MulticastDelegateUtilities.SafeInvoke: {0}", handler); handler.DynamicInvoke(sender, args); } catch (TargetInvocationException e) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs index 144787bb24..37663446aa 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs @@ -10,7 +10,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.EventHandlers; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel; - using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.DataCollection.Interfaces; using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.EventHandlers; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; @@ -20,7 +19,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; using Microsoft.VisualStudio.TestPlatform.Utilities; using CrossPlatResources = Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources.Resources; - using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine; public class TestRequestHandler : IDisposable, ITestRequestHandler { @@ -131,14 +129,14 @@ public void Close() public void SendTestCases(IEnumerable discoveredTestCases) { var data = this.dataSerializer.SerializePayload(MessageType.TestCasesFound, discoveredTestCases, this.protocolVersion); - this.channel.Send(data); + this.SendData(data); } /// public void SendTestRunStatistics(TestRunChangedEventArgs testRunChangedArgs) { var data = this.dataSerializer.SerializePayload(MessageType.TestRunStatsChange, testRunChangedArgs, this.protocolVersion); - this.channel.Send(data); + this.SendData(data); } /// @@ -148,7 +146,7 @@ public void SendLog(TestMessageLevel messageLevel, string message) MessageType.TestMessage, new TestMessagePayload { MessageLevel = messageLevel, Message = message }, this.protocolVersion); - this.channel.Send(data); + this.SendData(data); } /// @@ -168,7 +166,7 @@ public void SendExecutionComplete( ExecutorUris = executorUris }, this.protocolVersion); - this.channel.Send(data); + this.SendData(data); } /// @@ -184,7 +182,7 @@ public void DiscoveryComplete(DiscoveryCompleteEventArgs discoveryCompleteEventA Metrics = discoveryCompleteEventArgs.Metrics }, this.protocolVersion); - this.channel.Send(data); + this.SendData(data); } /// @@ -201,7 +199,7 @@ public int LaunchProcessWithDebuggerAttached(TestProcessStartInfo testProcessSta var data = dataSerializer.SerializePayload(MessageType.LaunchAdapterProcessWithDebuggerAttached, testProcessStartInfo, protocolVersion); - this.channel.Send(data); + this.SendData(data); EqtTrace.Verbose("Waiting for LaunchAdapterProcessWithDebuggerAttached ack"); waitHandle.Wait(); @@ -389,5 +387,14 @@ private void SetCommunicationEndPoint() } } + private void SendData(string data) + { + if (EqtTrace.IsVerboseEnabled) + { + EqtTrace.Verbose("TestRequestHandler.SendData: sending data from testhost: {0}", data); + } + + this.channel.Send(data); + } } } From 77a6181f74aba2c1ab3ee28f03a5b15c5841e640 Mon Sep 17 00:00:00 2001 From: samadala Date: Fri, 23 Mar 2018 18:29:14 +0530 Subject: [PATCH 4/8] Add logging for MessageLoopAsync --- .../LengthPrefixCommunicationChannel.cs | 1 + .../SocketServer.cs | 19 ++++++++++--------- .../TcpClientExtensions.cs | 19 +++++++++++++++---- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs index 9148d228d3..4a15eddf60 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs @@ -68,6 +68,7 @@ public Task NotifyDataAvailable() // connection is closed. if (this.MessageReceived != null) { + EqtTrace.Verbose("LengthPrefixCommunicationChannel.NotifyDataAvailable: Start reading data. "); var data = this.reader.ReadString(); EqtTrace.Verbose("LengthPrefixCommunicationChannel.NotifyDataAvailable: received data: {0}", data); this.MessageReceived.SafeInvoke(this, new MessageReceivedEventArgs { Data = data }, "LengthPrefixCommunicationChannel: MessageReceived"); diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs index adf4b26075..78da2d7bbf 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs @@ -31,7 +31,7 @@ public class SocketServer : ICommunicationEndPoint private bool stopped; - private string endPoint; + private string connectionInfo; /// /// Initializes a new instance of the class. @@ -62,24 +62,24 @@ protected SocketServer(Func channelFactory) public string Start(string endPoint) { - this.endPoint = endPoint; - this.tcpListener = new TcpListener(this.endPoint.GetIPEndPoint()); + this.connectionInfo = endPoint; + this.tcpListener = new TcpListener(this.connectionInfo.GetIPEndPoint()); this.tcpListener.Start(); - var connectionInfo = ((IPEndPoint)this.tcpListener.LocalEndpoint).ToString(); - EqtTrace.Info("SocketServer.Start: Listening on endpoint : {0}", connectionInfo); + this.connectionInfo = ((IPEndPoint)this.tcpListener.LocalEndpoint).ToString(); + EqtTrace.Info("SocketServer.Start: Listening on endpoint : {0}", this.connectionInfo); // Serves a single client at the moment. An error in connection, or message loop just // terminates the entire server. this.tcpListener.AcceptTcpClientAsync().ContinueWith(t => this.OnClientConnected(t.Result)); - return connectionInfo; + return this.connectionInfo; } /// public void Stop() { - EqtTrace.Info("SocketServer.Stop: Stopping server endpoint: {0}", this.endPoint); + EqtTrace.Info("SocketServer.Stop: Stopping server connectionInfo: {0}", this.connectionInfo); if (!this.stopped) { EqtTrace.Info("SocketServer.Stop: Cancellation requested. Stopping message loop."); @@ -99,7 +99,7 @@ private void OnClientConnected(TcpClient client) if (EqtTrace.IsVerboseEnabled) { - EqtTrace.Verbose("SocketServer.OnClientConnected: Client connected for endpoint: {0}, starting MessageLoopAsync:", this.endPoint); + EqtTrace.Verbose("SocketServer.OnClientConnected: Client connected for connectionInfo: {0}, starting MessageLoopAsync:", this.connectionInfo); } // Start the message loop @@ -109,7 +109,7 @@ private void OnClientConnected(TcpClient client) private void Stop(Exception error) { - EqtTrace.Info("SocketServer.Stop: Stopping server endpoint: {0} error: {1}", this.endPoint, error); + EqtTrace.Info("SocketServer.Stop: Stopping server connectionInfo: {0} error: {1}", this.connectionInfo, error); if (!this.stopped) { @@ -130,6 +130,7 @@ private void Stop(Exception error) this.channel.Dispose(); this.cancellation.Dispose(); + EqtTrace.Info("SocketServer.Stop: Raise disconnected event connectionInfo: {0} error: {1}", this.connectionInfo, error); this.Disconnected?.SafeInvoke(this, new DisconnectedEventArgs { Error = error }, "SocketServer: ClientDisconnected"); } } diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/TcpClientExtensions.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/TcpClientExtensions.cs index 5ccc88f2d7..30994982b9 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/TcpClientExtensions.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/TcpClientExtensions.cs @@ -25,14 +25,19 @@ internal static Task MessageLoopAsync( CancellationToken cancellationToken) { Exception error = null; + var remoteEndPoint = ((IPEndPoint)client.Client.RemoteEndPoint).ToString(); + var localEndPoint = ((IPEndPoint)client.Client.LocalEndPoint).ToString(); // Set read timeout to avoid blocking receive raw message while (channel != null && !cancellationToken.IsCancellationRequested) { + EqtTrace.Verbose("TcpClientExtensions.MessageLoopAsync: loop starting: remoteendPoint: {0} localEndPoint: {1}", remoteEndPoint, localEndPoint); + try { if (client.Client.Poll(STREAMREADTIMEOUT, SelectMode.SelectRead)) { + EqtTrace.Verbose("TcpClientExtensions.MessageLoopAsync: NotifyDataAvailable remoteendPoint: {0} localEndPoint: {1}", remoteEndPoint, localEndPoint); channel.NotifyDataAvailable(); } } @@ -43,14 +48,18 @@ internal static Task MessageLoopAsync( && socketException.SocketErrorCode == SocketError.TimedOut) { EqtTrace.Info( - "Socket: Message loop: failed to receive message due to read timeout {0}", - ioException); + "Socket: Message loop: failed to receive message due to read timeout {0}, remoteendPoint: {1} localEndPoint: {2}", + ioException, + remoteEndPoint, + localEndPoint); } else { EqtTrace.Error( - "Socket: Message loop: failed to receive message due to socket error {0}", - ioException); + "Socket: Message loop: failed to receive message due to socket error {0}, remoteendPoint: {1} localEndPoint: {2}", + ioException, + remoteEndPoint, + localEndPoint); error = ioException; break; } @@ -68,6 +77,8 @@ internal static Task MessageLoopAsync( // Try clean up and raise client disconnected events errorHandler(error); + EqtTrace.Verbose("TcpClientExtensions.MessageLoopAsync: exiting MessageLoopAsync remoteendPoint: {0} localEndPoint: {1}", remoteEndPoint, localEndPoint); + return Task.FromResult(0); } From ebb01e30baf788d86e5b827c9061cca0debcfe22 Mon Sep 17 00:00:00 2001 From: samadala Date: Fri, 23 Mar 2018 18:32:25 +0530 Subject: [PATCH 5/8] Add logging for MessageLoopAsync 2 --- .../TcpClientExtensions.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/TcpClientExtensions.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/TcpClientExtensions.cs index 30994982b9..fa1bd6cc9f 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/TcpClientExtensions.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/TcpClientExtensions.cs @@ -67,8 +67,10 @@ internal static Task MessageLoopAsync( catch (Exception exception) { EqtTrace.Error( - "Socket: Message loop: failed to receive message {0}", - exception); + "Socket: Message loop: failed to receive message {0}, remoteendPoint: {1} localEndPoint: {2}", + exception, + remoteEndPoint, + localEndPoint); error = exception; break; } From 709508a00df3671ea801af078f678dea357990bf Mon Sep 17 00:00:00 2001 From: samadala Date: Sat, 24 Mar 2018 16:14:30 +0530 Subject: [PATCH 6/8] Stop the communication server on operation complete --- .../TestRequestSender.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs index b26f13397f..473435cfa5 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs @@ -611,6 +611,7 @@ private void SetOperationComplete() EqtTrace.Verbose("TestRequestSender.SetOperationComplete: Setting operation complete."); } + this.communicationEndpoint.Stop(); Interlocked.CompareExchange(ref this.operationCompleted, 1, 0); } From d08518fb66f4aa077101fe111115c07abca6708d Mon Sep 17 00:00:00 2001 From: samadala Date: Mon, 26 Mar 2018 12:25:01 +0530 Subject: [PATCH 7/8] Add tests and remove not required logging --- .../LengthPrefixCommunicationChannel.cs | 4 +-- .../SocketClient.cs | 11 +++---- .../SocketServer.cs | 20 +++++------ .../TestRequestSender.cs | 15 --------- .../Utilities/MulticastDelegateUtilities.cs | 1 - .../ProxyDataCollectionManager.cs | 12 +++---- .../EventHandlers/TestRequestHandler.cs | 6 +--- .../TestRequestSenderTests.cs | 33 +++++++++++++++++++ 8 files changed, 54 insertions(+), 48 deletions(-) diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs index 4a15eddf60..fc5923787d 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs @@ -53,7 +53,7 @@ public Task Send(string data) } catch (Exception ex) { - EqtTrace.Verbose("LengthPrefixCommunicationChannel.Send: Error sending data: {0}.", ex); + EqtTrace.Error("LengthPrefixCommunicationChannel.Send: Error sending data: {0}.", ex); throw new CommunicationException("Unable to send data over channel.", ex); } @@ -68,9 +68,7 @@ public Task NotifyDataAvailable() // connection is closed. if (this.MessageReceived != null) { - EqtTrace.Verbose("LengthPrefixCommunicationChannel.NotifyDataAvailable: Start reading data. "); var data = this.reader.ReadString(); - EqtTrace.Verbose("LengthPrefixCommunicationChannel.NotifyDataAvailable: received data: {0}", data); this.MessageReceived.SafeInvoke(this, new MessageReceivedEventArgs { Data = data }, "LengthPrefixCommunicationChannel: MessageReceived"); } diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketClient.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketClient.cs index f30b850b3f..4459dc8ec2 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketClient.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketClient.cs @@ -53,10 +53,7 @@ public string Start(string endPoint) this.endPoint = endPoint; var ipEndPoint = endPoint.GetIPEndPoint(); - if (EqtTrace.IsVerboseEnabled) - { - EqtTrace.Verbose("SocketClient.Start: connecting to server endpoint: {0}", endPoint); - } + EqtTrace.Info("SocketClient.Start: connecting to server endpoint: {0}", endPoint); // Don't start if the endPoint port is zero this.tcpClient.ConnectAsync(ipEndPoint.Address, ipEndPoint.Port).ContinueWith(this.OnServerConnected); @@ -66,7 +63,7 @@ public string Start(string endPoint) /// public void Stop() { - EqtTrace.Verbose("SocketClient.Stop: connecting to server endpoint: {0}", this.endPoint); + EqtTrace.Info("SocketClient.Stop: Stop communication from server endpoint: {0}", this.endPoint); if (!this.stopped) { @@ -77,7 +74,7 @@ public void Stop() private void OnServerConnected(Task connectAsyncTask) { - EqtTrace.Verbose("SocketClient.OnServerConnected: connected to server endpoint: {0}", this.endPoint); + EqtTrace.Info("SocketClient.OnServerConnected: connected to server endpoint: {0}", this.endPoint); if (this.Connected != null) { @@ -111,7 +108,7 @@ private void OnServerConnected(Task connectAsyncTask) private void Stop(Exception error) { - EqtTrace.Verbose("SocketClient.Stop: connected to server endpoint: {0}, error:{1}", this.endPoint, error); + EqtTrace.Info("SocketClient.PrivateStop: Stop communication from server endpoint: {0}, error:{1}", this.endPoint, error); if (!this.stopped) { diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs index 78da2d7bbf..b2e6cd6649 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs @@ -11,7 +11,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities using System.Threading.Tasks; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; - using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; using Microsoft.VisualStudio.TestPlatform.Utilities; /// @@ -31,7 +30,7 @@ public class SocketServer : ICommunicationEndPoint private bool stopped; - private string connectionInfo; + private string endPoint; /// /// Initializes a new instance of the class. @@ -62,24 +61,23 @@ protected SocketServer(Func channelFactory) public string Start(string endPoint) { - this.connectionInfo = endPoint; - this.tcpListener = new TcpListener(this.connectionInfo.GetIPEndPoint()); + this.tcpListener = new TcpListener(endPoint.GetIPEndPoint()); this.tcpListener.Start(); - this.connectionInfo = ((IPEndPoint)this.tcpListener.LocalEndpoint).ToString(); - EqtTrace.Info("SocketServer.Start: Listening on endpoint : {0}", this.connectionInfo); + this.endPoint = ((IPEndPoint)this.tcpListener.LocalEndpoint).ToString(); + EqtTrace.Info("SocketServer.Start: Listening on endpoint : {0}", this.endPoint); // Serves a single client at the moment. An error in connection, or message loop just // terminates the entire server. this.tcpListener.AcceptTcpClientAsync().ContinueWith(t => this.OnClientConnected(t.Result)); - return this.connectionInfo; + return this.endPoint; } /// public void Stop() { - EqtTrace.Info("SocketServer.Stop: Stopping server connectionInfo: {0}", this.connectionInfo); + EqtTrace.Info("SocketServer.Stop: Stop server endPoint: {0}", this.endPoint); if (!this.stopped) { EqtTrace.Info("SocketServer.Stop: Cancellation requested. Stopping message loop."); @@ -99,7 +97,7 @@ private void OnClientConnected(TcpClient client) if (EqtTrace.IsVerboseEnabled) { - EqtTrace.Verbose("SocketServer.OnClientConnected: Client connected for connectionInfo: {0}, starting MessageLoopAsync:", this.connectionInfo); + EqtTrace.Verbose("SocketServer.OnClientConnected: Client connected for endPoint: {0}, starting MessageLoopAsync:", this.endPoint); } // Start the message loop @@ -109,7 +107,7 @@ private void OnClientConnected(TcpClient client) private void Stop(Exception error) { - EqtTrace.Info("SocketServer.Stop: Stopping server connectionInfo: {0} error: {1}", this.connectionInfo, error); + EqtTrace.Info("SocketServer.PrivateStop: Stopp server endPoint: {0} error: {1}", this.endPoint, error); if (!this.stopped) { @@ -130,7 +128,7 @@ private void Stop(Exception error) this.channel.Dispose(); this.cancellation.Dispose(); - EqtTrace.Info("SocketServer.Stop: Raise disconnected event connectionInfo: {0} error: {1}", this.connectionInfo, error); + EqtTrace.Info("SocketServer.Stop: Raise disconnected event endPoint: {0} error: {1}", this.endPoint, error); this.Disconnected?.SafeInvoke(this, new DisconnectedEventArgs { Error = error }, "SocketServer: ClientDisconnected"); } } diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs index 473435cfa5..874bdd3b2e 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs @@ -384,14 +384,6 @@ private void OnExecutionMessageReceived(object sender, MessageReceivedEventArgs try { var rawMessage = messageReceived.Data; - - if (this.IsOperationComplete()) - { - EqtTrace.Verbose("TestRequestSender: OnExecutionMessageReceived: Operation is already complete. Skip additional messages. message: {0}", rawMessage); - - // return; - } - if (EqtTrace.IsVerboseEnabled) { EqtTrace.Verbose("TestRequestSender.OnExecutionMessageReceived: Received message: {0}", rawMessage); @@ -452,13 +444,6 @@ private void OnDiscoveryMessageReceived(ITestDiscoveryEventsHandler2 discoveryEv { var rawMessage = args.Data; - if (this.IsOperationComplete()) - { - EqtTrace.Verbose("TestRequestSender: OnDiscoveryMessageReceived: Operation is already complete. Skip additional messages. message: {0}", rawMessage); - - // return; - } - // Currently each of the operations are not separate tasks since they should not each take much time. This is just a notification. if (EqtTrace.IsVerboseEnabled) { diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Utilities/MulticastDelegateUtilities.cs b/src/Microsoft.TestPlatform.CoreUtilities/Utilities/MulticastDelegateUtilities.cs index 03fa7eebbb..234f918fe4 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Utilities/MulticastDelegateUtilities.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Utilities/MulticastDelegateUtilities.cs @@ -41,7 +41,6 @@ public static void SafeInvoke(this Delegate delegates, object sender, EventArgs { try { - EqtTrace.Verbose("MulticastDelegateUtilities.SafeInvoke: {0}", handler); handler.DynamicInvoke(sender, args); } catch (TargetInvocationException e) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs index 6e6d2ceee4..8cd357b281 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs @@ -128,7 +128,7 @@ public Collection AfterTestRunEnd(bool isCanceled, ITestMessageEv this.InvokeDataCollectionServiceAction( () => { - EqtTrace.Verbose("ProxyDataCollectionManager.AfterTestRunEnd: Get attachment set for datacollector processId: {0} port: {1}", dataCollectionProcessId, dataCollectionPort); + EqtTrace.Info("ProxyDataCollectionManager.AfterTestRunEnd: Get attachment set for datacollector processId: {0} port: {1}", dataCollectionProcessId, dataCollectionPort); attachmentSet = this.dataCollectionRequestSender.SendAfterTestRunStartAndGetResult(runEventsHandler, isCanceled); }, runEventsHandler); @@ -162,12 +162,12 @@ public DataCollectionParameters BeforeTestRunStart( this.InvokeDataCollectionServiceAction( () => { - EqtTrace.Verbose("ProxyDataCollectionManager.BeforeTestRunStart: Get env variable and port for datacollector processId: {0} port: {1}", this.dataCollectionProcessId, this.dataCollectionPort); + EqtTrace.Info("ProxyDataCollectionManager.BeforeTestRunStart: Get env variable and port for datacollector processId: {0} port: {1}", this.dataCollectionProcessId, this.dataCollectionPort); var result = this.dataCollectionRequestSender.SendBeforeTestRunStartAndGetResult(this.settingsXml, runEventsHandler); environmentVariables = result.EnvironmentVariables; dataCollectionEventsPort = result.DataCollectionEventsPort; - EqtTrace.Verbose( + EqtTrace.Info( "ProxyDataCollectionManager.BeforeTestRunStart: SendBeforeTestRunStartAndGetResult successful, env variable from datacollector: {0} and testhost port: {1}", string.Join(";", environmentVariables), dataCollectionEventsPort); @@ -184,7 +184,7 @@ public DataCollectionParameters BeforeTestRunStart( /// public void Dispose() { - EqtTrace.Verbose("ProxyDataCollectionManager.Dispose: calling dospose for datacollector processId: {0} port: {1}", this.dataCollectionProcessId, this.dataCollectionPort); + EqtTrace.Info("ProxyDataCollectionManager.Dispose: calling dospose for datacollector processId: {0} port: {1}", this.dataCollectionProcessId, this.dataCollectionPort); this.dataCollectionRequestSender.Close(); } @@ -195,11 +195,11 @@ public void Initialize() // Warn the user that execution will wait for debugger attach. this.dataCollectionProcessId = this.dataCollectionLauncher.LaunchDataCollector(null, this.GetCommandLineArguments(this.dataCollectionPort)); - EqtTrace.Verbose("ProxyDataCollectionManager.Initialize: Launched datacollector processId: {0} port: {1}", this.dataCollectionProcessId, this.dataCollectionPort); + EqtTrace.Info("ProxyDataCollectionManager.Initialize: Launched datacollector processId: {0} port: {1}", this.dataCollectionProcessId, this.dataCollectionPort); ChangeConnectionTimeoutIfRequired(dataCollectionProcessId); - EqtTrace.Verbose("ProxyDataCollectionManager.Initialize: waiting for connection with timeout: {0}", this.connectionTimeout); + EqtTrace.Info("ProxyDataCollectionManager.Initialize: waiting for connection with timeout: {0}", this.connectionTimeout); var connected = this.dataCollectionRequestSender.WaitForRequestHandlerConnection(this.connectionTimeout); if (connected == false) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs index 37663446aa..cbe9a27f5a 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs @@ -389,11 +389,7 @@ private void SetCommunicationEndPoint() private void SendData(string data) { - if (EqtTrace.IsVerboseEnabled) - { - EqtTrace.Verbose("TestRequestHandler.SendData: sending data from testhost: {0}", data); - } - + EqtTrace.Verbose("TestRequestHandler.SendData: sending data from testhost: {0}", data); this.channel.Send(data); } } diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs index 94dfe51409..bb0e9412fa 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs @@ -289,6 +289,20 @@ public void DiscoverTestsShouldNotifyDiscoveryCompleteOnCompleteMessageReceived( this.mockDiscoveryEventsHandler.Verify(eh => eh.HandleDiscoveryComplete(It.Is(dc => dc.IsAborted == false && dc.TotalCount == 10), null)); } + [TestMethod] + public void DiscoverTestsShouldStopServerOnCompleteMessageReceived() + { + var completePayload = new DiscoveryCompletePayload { TotalTests = 10, IsAborted = false }; + this.SetupDeserializeMessage(MessageType.DiscoveryComplete, completePayload); + this.SetupFakeCommunicationChannel(); + + this.testRequestSender.DiscoverTests(new DiscoveryCriteria(), this.mockDiscoveryEventsHandler.Object); + + this.RaiseMessageReceivedEvent(); + + this.mockServer.Verify(ms => ms.Stop()); + } + [TestMethod] public void DiscoverTestShouldNotifyLogMessageOnTestMessageReceived() { @@ -505,6 +519,25 @@ public void StartTestRunShouldNotifyExecutionCompleteOnRunCompleteMessageReceive Times.Once); } + [TestMethod] + public void StartTestRunShouldStopServerOnRunCompleteMessageReceived() + { + var testRunCompletePayload = new TestRunCompletePayload + { + TestRunCompleteArgs = new TestRunCompleteEventArgs(null, false, false, null, null, TimeSpan.MaxValue), + LastRunTests = new TestRunChangedEventArgs(null, null, null), + RunAttachments = new List() + }; + this.SetupDeserializeMessage(MessageType.ExecutionComplete, testRunCompletePayload); + this.SetupFakeCommunicationChannel(); + + this.testRequestSender.StartTestRun(this.testRunCriteriaWithSources, this.mockExecutionEventsHandler.Object); + + this.RaiseMessageReceivedEvent(); + + this.mockServer.Verify(ms => ms.Stop()); + } + [TestMethod] public void StartTestRunShouldNotifyLogMessageOnTestMessageReceived() { From c6d8c9b57c86a0eb8533ce648f26ece30bb79939 Mon Sep 17 00:00:00 2001 From: samadala Date: Mon, 26 Mar 2018 19:00:36 +0530 Subject: [PATCH 8/8] Address review comments --- .../TcpClientExtensions.cs | 16 ++++++++-------- .../DataCollection/ProxyDataCollectionManager.cs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/TcpClientExtensions.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/TcpClientExtensions.cs index fa1bd6cc9f..f0e3e2ef80 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/TcpClientExtensions.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/TcpClientExtensions.cs @@ -25,19 +25,19 @@ internal static Task MessageLoopAsync( CancellationToken cancellationToken) { Exception error = null; - var remoteEndPoint = ((IPEndPoint)client.Client.RemoteEndPoint).ToString(); - var localEndPoint = ((IPEndPoint)client.Client.LocalEndPoint).ToString(); + var remoteEndPoint = client.Client.RemoteEndPoint.ToString(); + var localEndPoint = client.Client.LocalEndPoint.ToString(); // Set read timeout to avoid blocking receive raw message while (channel != null && !cancellationToken.IsCancellationRequested) { - EqtTrace.Verbose("TcpClientExtensions.MessageLoopAsync: loop starting: remoteendPoint: {0} localEndPoint: {1}", remoteEndPoint, localEndPoint); + EqtTrace.Verbose("TcpClientExtensions.MessageLoopAsync: Polling on remoteEndPoint: {0} localEndPoint: {1}", remoteEndPoint, localEndPoint); try { if (client.Client.Poll(STREAMREADTIMEOUT, SelectMode.SelectRead)) { - EqtTrace.Verbose("TcpClientExtensions.MessageLoopAsync: NotifyDataAvailable remoteendPoint: {0} localEndPoint: {1}", remoteEndPoint, localEndPoint); + EqtTrace.Verbose("TcpClientExtensions.MessageLoopAsync: NotifyDataAvailable remoteEndPoint: {0} localEndPoint: {1}", remoteEndPoint, localEndPoint); channel.NotifyDataAvailable(); } } @@ -48,7 +48,7 @@ internal static Task MessageLoopAsync( && socketException.SocketErrorCode == SocketError.TimedOut) { EqtTrace.Info( - "Socket: Message loop: failed to receive message due to read timeout {0}, remoteendPoint: {1} localEndPoint: {2}", + "Socket: Message loop: failed to receive message due to read timeout {0}, remoteEndPoint: {1} localEndPoint: {2}", ioException, remoteEndPoint, localEndPoint); @@ -56,7 +56,7 @@ internal static Task MessageLoopAsync( else { EqtTrace.Error( - "Socket: Message loop: failed to receive message due to socket error {0}, remoteendPoint: {1} localEndPoint: {2}", + "Socket: Message loop: failed to receive message due to socket error {0}, remoteEndPoint: {1} localEndPoint: {2}", ioException, remoteEndPoint, localEndPoint); @@ -67,7 +67,7 @@ internal static Task MessageLoopAsync( catch (Exception exception) { EqtTrace.Error( - "Socket: Message loop: failed to receive message {0}, remoteendPoint: {1} localEndPoint: {2}", + "Socket: Message loop: failed to receive message {0}, remoteEndPoint: {1} localEndPoint: {2}", exception, remoteEndPoint, localEndPoint); @@ -79,7 +79,7 @@ internal static Task MessageLoopAsync( // Try clean up and raise client disconnected events errorHandler(error); - EqtTrace.Verbose("TcpClientExtensions.MessageLoopAsync: exiting MessageLoopAsync remoteendPoint: {0} localEndPoint: {1}", remoteEndPoint, localEndPoint); + EqtTrace.Verbose("TcpClientExtensions.MessageLoopAsync: exiting MessageLoopAsync remoteEndPoint: {0} localEndPoint: {1}", remoteEndPoint, localEndPoint); return Task.FromResult(0); } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs index 8cd357b281..a6dbc7645d 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyDataCollectionManager.cs @@ -204,7 +204,7 @@ public void Initialize() var connected = this.dataCollectionRequestSender.WaitForRequestHandlerConnection(this.connectionTimeout); if (connected == false) { - EqtTrace.Error("ProxyDataCollectionManager.Initialize: failed to connect to datacollector process."); + EqtTrace.Error("ProxyDataCollectionManager.Initialize: failed to connect to datacollector process, processId: {0} port: {1}", this.dataCollectionProcessId, this.dataCollectionPort); throw new TestPlatformException(string.Format(CultureInfo.CurrentUICulture, CrossPlatEngineResources.FailedToConnectDataCollector)); } }