From 5ae0b3a193c38a9b8deb3981d511117004fdf962 Mon Sep 17 00:00:00 2001 From: Jakub Chocholowicz Date: Fri, 12 Jun 2020 21:36:02 +0200 Subject: [PATCH] More changes --- .../DataCollectorAttachmentsHandler.cs | 18 ++++++++++-------- .../EventHandlers/TestRequestHandler.cs | 1 - .../Adapter/Interfaces/IFrameworkHandle.cs | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectorAttachmentsHandler.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectorAttachmentsHandler.cs index 639bd48ef9..d4da660a77 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectorAttachmentsHandler.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectorAttachmentsHandler.cs @@ -28,16 +28,18 @@ public void HandleAttachements(ICollection attachments, Cancellat if (attachementUri != null) { var attachmentsToBeProcessed = attachments.Where(dataCollectionAttachment => attachementUri.Equals(dataCollectionAttachment.Uri)).ToArray(); - - foreach (var attachment in attachmentsToBeProcessed) + if(attachmentsToBeProcessed.Any()) { - attachments.Remove(attachment); - } + foreach (var attachment in attachmentsToBeProcessed) + { + attachments.Remove(attachment); + } - ICollection processedAttachements = dataCollectorAttachmentsHandler.HandleDataCollectionAttachmentSets(new Collection(attachmentsToBeProcessed), cancellationToken); - foreach (var attachment in processedAttachements) - { - attachments.Add(attachment); + ICollection processedAttachements = dataCollectorAttachmentsHandler.HandleDataCollectionAttachmentSets(new Collection(attachmentsToBeProcessed), cancellationToken); + foreach (var attachment in processedAttachements) + { + attachments.Add(attachment); + } } } } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs index 2436f0a9f5..5319d0bb78 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/EventHandlers/TestRequestHandler.cs @@ -5,7 +5,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities { using System; using System.Collections.Generic; - using System.Linq; using System.Threading; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.EventHandlers; diff --git a/src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/IFrameworkHandle.cs b/src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/IFrameworkHandle.cs index 947b857477..4e71e2e870 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/IFrameworkHandle.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/IFrameworkHandle.cs @@ -12,7 +12,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter public interface IFrameworkHandle : ITestExecutionRecorder, IMessageLogger { /// - /// Gets or sets a value indicating whether the execution framework enables the shutdown of execution process after the test run is complete. This should be used only in out of process test run when IRunContext.KeepAlive is true + /// Gets or sets a value indicating whether the execution framework enables the shutdown of execution process after the test run is complete. This should be used only in out of process test runs when IRunContext.KeepAlive is true /// and should be used only when absolutely required as using it degrades the performance of the subsequent run. /// It throws InvalidOperationException when it is attempted to be enabled when keepAlive is false. ///