From 4a4f539e6fef9929dcb3a2a3fbf673f2df997ab3 Mon Sep 17 00:00:00 2001 From: nohwnd Date: Wed, 12 Aug 2020 09:12:15 +0200 Subject: [PATCH 1/3] Replace NET451 compiler directives with NETFRAMEWORK --- .../ExtensionFramework/TestPluginCache.cs | 4 ++-- .../ExtensionFramework/TestPluginManager.cs | 2 +- .../Logging/InternalTestLoggerEvents.cs | 6 ++--- .../Utilities/FakesUtilities.cs | 2 +- .../RunSettingsProviderExtensions.cs | 4 ++-- .../SocketClient.cs | 2 +- .../SocketCommunicationManager.cs | 2 +- .../SocketServer.cs | 2 +- .../Tracing/EqtTrace.cs | 2 +- .../Adapter/TestPlatformFormatException.cs | 6 ++--- .../Adapter/TestsCanceledException.cs | 6 ++--- .../Constants.cs | 2 +- .../DataCollectionEnvironmentContext.cs | 4 ++-- .../Events/DataCollectionEventArgs.cs | 2 +- .../ExceptionConverter.cs | 4 ++-- .../Framework.cs | 2 +- .../RegistryFreeActivationContext.cs | 2 +- .../RunSettings/SettingsException.cs | 6 ++--- .../Trait.cs | 4 ++-- .../TraitCollection.cs | 4 ++-- .../Utilities/AssemblyHelper.cs | 2 +- .../Utilities/AssemblyLoadWorker.cs | 2 +- .../Utilities/SuspendCodeCoverage.cs | 2 +- .../XmlUtilities.cs | 4 ++-- .../ConsoleParameters.cs | 4 ++-- .../VsTestConsoleProcessManager.cs | 2 +- src/testhost.x86/AppDomainEngineInvoker.cs | 2 +- src/testhost.x86/DefaultEngineInvoker.cs | 4 ++-- src/testhost.x86/Program.cs | 2 +- src/vstest.console/Internal/ConsoleLogger.cs | 2 +- .../EnableLoggerArgumentProcessor.cs | 2 +- .../SocketClientTests.cs | 4 ++-- .../SocketCommunicationManagerTests.cs | 2 +- .../SocketServerTests.cs | 4 ++-- .../Tracing/EqtTraceTests.cs | 22 +++++++++---------- .../Client/ProxyOperationManagerTests.cs | 4 ++-- .../ProxyDataCollectionManagerTests.cs | 4 ++-- .../DiaSessionTests.cs | 2 +- .../FrameworkTests.cs | 2 +- .../Utilities/AssemblyHelperTests.cs | 2 +- .../PerfInstrumentation/PerfAnalyzer.cs | 22 +++++++++---------- .../PerformanceTestBase.cs | 8 +++---- .../UnitTest1.cs | 2 +- test/TestAssets/SimpleDataCollector/Class1.cs | 2 +- .../TestAssets/SimpleTestProject/UnitTest1.cs | 2 +- .../SimpleTestProject3/UnitTest1.cs | 4 ++-- .../AppDomainEngineInvokerTests.cs | 2 +- .../DefaultEngineInvokerTests.cs | 4 ++-- .../Internal/ConsoleLoggerTests.cs | 2 +- .../EnableDiagArgumentProcessorTests.cs | 8 +++---- .../EnableLoggersArgumentProcessorTests.cs | 2 +- .../ResultsDirectoryArgumentProcessorTests.cs | 4 ++-- 52 files changed, 102 insertions(+), 102 deletions(-) diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginCache.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginCache.cs index b2905830f5..a7dc4e04fe 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginCache.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginCache.cs @@ -3,7 +3,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework { -#if NET451 +#if NETFRAMEWORK using System.Threading; #endif using System; @@ -196,7 +196,7 @@ public Dictionary DiscoverTestExtensions(Type extensionType) } throw; } -#if NET451 +#if NETFRAMEWORK else if (ex is SystemException) { if (EqtTrace.IsErrorEnabled) diff --git a/src/Microsoft.TestPlatform.Common/Logging/InternalTestLoggerEvents.cs b/src/Microsoft.TestPlatform.Common/Logging/InternalTestLoggerEvents.cs index 725fc1c5d4..26bbcef7d1 100644 --- a/src/Microsoft.TestPlatform.Common/Logging/InternalTestLoggerEvents.cs +++ b/src/Microsoft.TestPlatform.Common/Logging/InternalTestLoggerEvents.cs @@ -11,7 +11,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Common.Logging using System.Collections.ObjectModel; using System.Diagnostics; -#if NET451 +#if NETFRAMEWORK using System.Configuration; #endif @@ -398,7 +398,7 @@ private int GetMaxBytesQueueCanHold() private static bool IsBoundsEnabledOnLoggerEventQueue() { bool enableBounds; -#if NET451 +#if NETFRAMEWORK string enableBoundsOnEventQueueIsDefined = ConfigurationManager.AppSettings[TestPlatformDefaults.EnableBoundsOnLoggerEventQueue]; #else string enableBoundsOnEventQueueIsDefined = null; @@ -444,7 +444,7 @@ private static int FindTestResultSize(TestResultEventArgs args) private int GetSetting(string appSettingKey, int defaultValue) { int value; -#if NET451 +#if NETFRAMEWORK string appSettingValue = ConfigurationManager.AppSettings[appSettingKey]; #else string appSettingValue = null; diff --git a/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs b/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs index a269a16d18..502de37d13 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs @@ -216,7 +216,7 @@ private static void EnsureSettingsNode(XmlDocument settings, TestRunSettings set private static Func, string> TryGetNetFrameworkFakesDataCollectorConfigurator() { -#if NET451 +#if NETFRAMEWORK try { Assembly assembly = Assembly.Load(FakesConfiguratorAssembly); diff --git a/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs b/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs index 7af12b0f87..99f6909bdd 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs @@ -226,7 +226,7 @@ private static XmlDocument GetRunSettingXmlDocument(this IRunSettingsProvider ru { var settingsXml = runSettingsProvider.ActiveRunSettings.SettingsXml; -#if NET451 +#if NETFRAMEWORK using (var reader = XmlReader.Create(new StringReader(settingsXml), new XmlReaderSettings() { XmlResolver = null, CloseInput = true, DtdProcessing = DtdProcessing.Prohibit })) { #else @@ -240,7 +240,7 @@ private static XmlDocument GetRunSettingXmlDocument(this IRunSettingsProvider ru } else { -#if NET451 +#if NETFRAMEWORK doc = (XmlDocument) XmlRunSettingsUtilities.CreateDefaultRunSettings(); #else using ( diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketClient.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketClient.cs index 9d7dca6b98..7059a538bc 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketClient.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketClient.cs @@ -115,7 +115,7 @@ private void Stop(Exception error) this.stopped = true; // Close the client and dispose the underlying stream -#if NET451 +#if NETFRAMEWORK // tcpClient.Close() calls tcpClient.Dispose(). this.tcpClient?.Close(); #else diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketCommunicationManager.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketCommunicationManager.cs index a0d2540eae..6365219ba9 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketCommunicationManager.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketCommunicationManager.cs @@ -222,7 +222,7 @@ public bool WaitForServerConnection(int connectionTimeout) /// public void StopClient() { -#if NET451 +#if NETFRAMEWORK // tcpClient.Close() calls tcpClient.Dispose(). this.tcpClient?.Close(); #else diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs index 84adaee226..51de6af960 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketServer.cs @@ -117,7 +117,7 @@ private void Stop(Exception error) this.tcpListener.Stop(); // Close the client and dispose the underlying stream -#if NET451 +#if NETFRAMEWORK // tcpClient.Close() calls tcpClient.Dispose(). this.tcpClient?.Close(); #else diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Tracing/EqtTrace.cs b/src/Microsoft.TestPlatform.CoreUtilities/Tracing/EqtTrace.cs index bb43be33ce..6a798a33bc 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Tracing/EqtTrace.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Tracing/EqtTrace.cs @@ -25,7 +25,7 @@ public static class EqtTrace { private static IPlatformEqtTrace traceImpl = new PlatformEqtTrace(); -#if NET451 +#if NETFRAMEWORK public static void SetupRemoteEqtTraceListeners(AppDomain childDomain) { traceImpl.SetupRemoteEqtTraceListeners(childDomain); diff --git a/src/Microsoft.TestPlatform.ObjectModel/Adapter/TestPlatformFormatException.cs b/src/Microsoft.TestPlatform.ObjectModel/Adapter/TestPlatformFormatException.cs index f92930757e..e704e11842 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Adapter/TestPlatformFormatException.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Adapter/TestPlatformFormatException.cs @@ -10,7 +10,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter /// Exception thrown on parsing error in user provided filter expression. /// This can happen when filter has invalid format or has unsupported properties. /// -#if NET451 +#if NETFRAMEWORK [Serializable] #endif public class TestPlatformFormatException : Exception @@ -55,7 +55,7 @@ public TestPlatformFormatException(string message, Exception innerException) { } -#if NET451 +#if NETFRAMEWORK /// /// Serialization constructor. /// @@ -79,7 +79,7 @@ public string FilterValue private set; } -#if NET451 +#if NETFRAMEWORK /// /// Serialization helper. /// diff --git a/src/Microsoft.TestPlatform.ObjectModel/Adapter/TestsCanceledException.cs b/src/Microsoft.TestPlatform.ObjectModel/Adapter/TestsCanceledException.cs index 090df725fe..5b09bce3ec 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Adapter/TestsCanceledException.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Adapter/TestsCanceledException.cs @@ -5,7 +5,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter { using System; -#if NET451 +#if NETFRAMEWORK using System.Runtime.Serialization; #endif @@ -13,7 +13,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter /// Exception thrown by the framework when an executor attempts to send /// test result to the framework when the test is canceled. /// -#if NET451 +#if NETFRAMEWORK [Serializable] #endif public class TestCanceledException : Exception @@ -46,7 +46,7 @@ public TestCanceledException(string message, Exception innerException) { } -#if NET451 +#if NETFRAMEWORK /// /// Serialization constructor. /// diff --git a/src/Microsoft.TestPlatform.ObjectModel/Constants.cs b/src/Microsoft.TestPlatform.ObjectModel/Constants.cs index d3aee31966..4ddd017778 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Constants.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Constants.cs @@ -194,7 +194,7 @@ public static class Constants /// The default execution thread apartment state. /// [CLSCompliant(false)] -#if NET451 +#if NETFRAMEWORK // Keeping default STA thread for desktop tests for UI/Functional test scenarios public static readonly PlatformApartmentState DefaultExecutionThreadApartmentState = PlatformApartmentState.STA; #else diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectionEnvironmentContext.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectionEnvironmentContext.cs index 386a75647f..612b8b09cb 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectionEnvironmentContext.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectionEnvironmentContext.cs @@ -3,14 +3,14 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection { -#if NET451 +#if NETFRAMEWORK using System; #endif /// /// Encapsulates the context of the environment a data collector is being hosted in. /// -#if NET451 +#if NETFRAMEWORK [Serializable] #endif public sealed class DataCollectionEnvironmentContext diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Events/DataCollectionEventArgs.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Events/DataCollectionEventArgs.cs index 0276ec003c..37596ceffc 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Events/DataCollectionEventArgs.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Events/DataCollectionEventArgs.cs @@ -9,7 +9,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection /// /// Base class for all execution event arguments /// -#if NET451 +#if NETFRAMEWORK [Serializable] #endif public abstract class DataCollectionEventArgs : EventArgs diff --git a/src/Microsoft.TestPlatform.ObjectModel/ExceptionConverter.cs b/src/Microsoft.TestPlatform.ObjectModel/ExceptionConverter.cs index cf59e85610..638ad2ad6b 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/ExceptionConverter.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/ExceptionConverter.cs @@ -9,7 +9,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel /// /// Base exception for all Rocksteady service exceptions /// -#if NET451 +#if NETFRAMEWORK [Serializable] #endif [SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")] @@ -96,7 +96,7 @@ private static Exception ConvertException(String exceptionType, String message, } #endif -#if NET451 +#if NETFRAMEWORK [Serializable] #endif [SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")] diff --git a/src/Microsoft.TestPlatform.ObjectModel/Framework.cs b/src/Microsoft.TestPlatform.ObjectModel/Framework.cs index a84d074e58..005df6147e 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Framework.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Framework.cs @@ -11,7 +11,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel /// public class Framework { -#if NET451 +#if NETFRAMEWORK private static readonly Framework Default = Framework.FromString(".NETFramework,Version=v4.0"); #else private static readonly Framework Default = Framework.FromString(".NETCoreApp,Version=v1.0"); diff --git a/src/Microsoft.TestPlatform.ObjectModel/RegistryFreeActivationContext.cs b/src/Microsoft.TestPlatform.ObjectModel/RegistryFreeActivationContext.cs index a402c7ccaa..4c9600f246 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/RegistryFreeActivationContext.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/RegistryFreeActivationContext.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#if NET451 +#if NETFRAMEWORK namespace Microsoft.VisualStudio.TestPlatform.ObjectModel { diff --git a/src/Microsoft.TestPlatform.ObjectModel/RunSettings/SettingsException.cs b/src/Microsoft.TestPlatform.ObjectModel/RunSettings/SettingsException.cs index 539d5de954..4bc746f0c2 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/RunSettings/SettingsException.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/RunSettings/SettingsException.cs @@ -4,7 +4,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel { using System; -#if NET451 +#if NETFRAMEWORK using System.Runtime.Serialization; #endif @@ -13,7 +13,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel /// Exception thrown by Run Settings when an error with a settings provider /// is encountered. /// -#if NET451 +#if NETFRAMEWORK [Serializable] #endif public class SettingsException : Exception @@ -46,7 +46,7 @@ public SettingsException(string message, Exception innerException) { } -#if NET451 +#if NETFRAMEWORK /// /// Serialization constructor. /// diff --git a/src/Microsoft.TestPlatform.ObjectModel/Trait.cs b/src/Microsoft.TestPlatform.ObjectModel/Trait.cs index 3c2ca54138..2cca9be161 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Trait.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Trait.cs @@ -3,7 +3,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel { -#if NET451 +#if NETFRAMEWORK using System; #endif using System.Collections.Generic; @@ -13,7 +13,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel /// Class that holds Trait. /// A traits is Name, Value pair. /// -#if NET451 +#if NETFRAMEWORK [Serializable] #endif [DataContract] diff --git a/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs b/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs index f172b3d72f..3c594f7813 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs @@ -11,7 +11,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel /// /// Class that holds collection of traits /// -#if NET451 +#if NETFRAMEWORK [Serializable] #endif public class TraitCollection : IEnumerable @@ -33,7 +33,7 @@ public class TraitCollection : IEnumerable #pragma warning restore 618 typeof(TestObject)); -#if NET451 +#if NETFRAMEWORK [NonSerialized] #endif private readonly TestObject testObject; diff --git a/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyHelper.cs b/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyHelper.cs index 36906b8cd9..3c1616c217 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyHelper.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyHelper.cs @@ -3,7 +3,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities { -#if NET451 +#if NETFRAMEWORK using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyLoadWorker.cs b/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyLoadWorker.cs index 11be2f2f69..275b880db3 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyLoadWorker.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyLoadWorker.cs @@ -3,7 +3,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities { -#if NET451 +#if NETFRAMEWORK using System; using System.Diagnostics; using System.IO; diff --git a/src/Microsoft.TestPlatform.ObjectModel/Utilities/SuspendCodeCoverage.cs b/src/Microsoft.TestPlatform.ObjectModel/Utilities/SuspendCodeCoverage.cs index 9b54a56d80..bc1ea0354f 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Utilities/SuspendCodeCoverage.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Utilities/SuspendCodeCoverage.cs @@ -3,7 +3,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities { -#if NET451 +#if NETFRAMEWORK using System; /// diff --git a/src/Microsoft.TestPlatform.Utilities/XmlUtilities.cs b/src/Microsoft.TestPlatform.Utilities/XmlUtilities.cs index 074a738186..ed6f6220d7 100644 --- a/src/Microsoft.TestPlatform.Utilities/XmlUtilities.cs +++ b/src/Microsoft.TestPlatform.Utilities/XmlUtilities.cs @@ -5,7 +5,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Utilities { using System; using System.Diagnostics.CodeAnalysis; -#if NET451 +#if NETFRAMEWORK using System.Security; #endif using System.Xml; @@ -62,7 +62,7 @@ internal static void AppendOrModifyChild( // TODO: There isn't an equivalent API to SecurityElement.Escape in Core yet. // So trusting that the XML is always valid for now. -#if NET451 +#if NETFRAMEWORK var secureInnerXml = SecurityElement.Escape(innerXml); #else // fixing manually as we currently target to netcore 1.1 and we don't have default implementation for Escape functionality diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/ConsoleParameters.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/ConsoleParameters.cs index 6595f24375..d40d888127 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/ConsoleParameters.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/ConsoleParameters.cs @@ -4,7 +4,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer { using System; -#if NET451 +#if NETFRAMEWORK using System.Collections.Generic; #endif using System.Diagnostics; @@ -40,7 +40,7 @@ public ConsoleParameters(IFileHelper fileHelper) this.fileHelper = fileHelper; } -#if NET451 +#if NETFRAMEWORK /// /// TODO: Remove the #if when project is targeted to netstandard2.0 diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleProcessManager.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleProcessManager.cs index e57b34641a..abeb12e72b 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleProcessManager.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleProcessManager.cs @@ -113,7 +113,7 @@ public void StartProcess(ConsoleParameters consoleParameters) EqtTrace.Verbose("VsTestCommandLineWrapper: Process Start Info {0} {1}", info.FileName, info.Arguments); -#if NET451 +#if NETFRAMEWORK if (consoleParameters.EnvironmentVariables != null) { info.EnvironmentVariables.Clear(); diff --git a/src/testhost.x86/AppDomainEngineInvoker.cs b/src/testhost.x86/AppDomainEngineInvoker.cs index 101c0a878b..9c2213958d 100644 --- a/src/testhost.x86/AppDomainEngineInvoker.cs +++ b/src/testhost.x86/AppDomainEngineInvoker.cs @@ -3,7 +3,7 @@ namespace Microsoft.VisualStudio.TestPlatform.TestHost { -#if NET451 +#if NETFRAMEWORK using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing; diff --git a/src/testhost.x86/DefaultEngineInvoker.cs b/src/testhost.x86/DefaultEngineInvoker.cs index 8b1d2cc568..7495aa848c 100644 --- a/src/testhost.x86/DefaultEngineInvoker.cs +++ b/src/testhost.x86/DefaultEngineInvoker.cs @@ -25,7 +25,7 @@ namespace Microsoft.VisualStudio.TestPlatform.TestHost using CoreUtilitiesConstants = Microsoft.VisualStudio.TestPlatform.CoreUtilities.Constants; internal class DefaultEngineInvoker : -#if NET451 +#if NETFRAMEWORK MarshalByRefObject, #endif IEngineInvoker @@ -77,7 +77,7 @@ public void Invoke(IDictionary argsDictionary) { EqtTrace.Info("DefaultEngineInvoker.Invoke: Testhost process started with args :{0}", string.Join(",", argsDictionary)); -#if NET451 +#if NETFRAMEWORK var appConfigText = System.IO.File.ReadAllText(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); EqtTrace.Info("DefaultEngineInvoker: Using Application Configuration: '{0}'", appConfigText); diff --git a/src/testhost.x86/Program.cs b/src/testhost.x86/Program.cs index dd97bf6d65..1f9f5a4f70 100644 --- a/src/testhost.x86/Program.cs +++ b/src/testhost.x86/Program.cs @@ -62,7 +62,7 @@ public static void Run(string[] args) private static IEngineInvoker GetEngineInvoker(IDictionary argsDictionary) { IEngineInvoker invoker = null; -#if NET451 +#if NETFRAMEWORK // If Args contains test source argument, invoker Engine in new appdomain string testSourcePath; if (argsDictionary.TryGetValue(TestSourceArgumentString, out testSourcePath) && !string.IsNullOrWhiteSpace(testSourcePath)) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 846ad79c7e..a9d2371d0c 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -105,7 +105,7 @@ internal enum Verbosity /// /// Level of verbosity /// -#if NET451 +#if NETFRAMEWORK private Verbosity verbosityLevel = Verbosity.Normal; #else // Keep default verbosity for x-plat command line as minimal diff --git a/src/vstest.console/Processors/EnableLoggerArgumentProcessor.cs b/src/vstest.console/Processors/EnableLoggerArgumentProcessor.cs index c6cd204c11..d05365dc88 100644 --- a/src/vstest.console/Processors/EnableLoggerArgumentProcessor.cs +++ b/src/vstest.console/Processors/EnableLoggerArgumentProcessor.cs @@ -99,7 +99,7 @@ internal class EnableLoggerArgumentProcessorCapabilities : BaseArgumentProcessor /// /// Gets the help content resource name. /// -#if NET451 +#if NETFRAMEWORK public override string HelpContentResourceName => CommandLineResources.EnableLoggersArgumentHelp; #else public override string HelpContentResourceName => CommandLineResources.EnableLoggerArgumentsInNetCore; diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketClientTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketClientTests.cs index 8b450ef6c7..c329837bc1 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketClientTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketClientTests.cs @@ -35,7 +35,7 @@ public SocketClientTests() public void Dispose() { this.socketClient.Stop(); -#if NET451 +#if NETFRAMEWORK // tcpClient.Close() calls tcpClient.Dispose(). this.tcpClient?.Close(); #else @@ -100,7 +100,7 @@ public void SocketClientShouldRaiseClientDisconnectedEventIfConnectionIsBroken() // Close the communication from server side this.tcpClient.GetStream().Dispose(); -#if NET451 +#if NETFRAMEWORK // tcpClient.Close() calls tcpClient.Dispose(). this.tcpClient?.Close(); #else diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketCommunicationManagerTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketCommunicationManagerTests.cs index eaa60b437a..8bff436bed 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketCommunicationManagerTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketCommunicationManagerTests.cs @@ -42,7 +42,7 @@ public SocketCommunicationManagerTests() public void Dispose() { this.tcpListener.Stop(); -#if NET451 +#if NETFRAMEWORK // tcpClient.Close() calls tcpClient.Dispose(). this.tcpClient?.Close(); #else diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketServerTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketServerTests.cs index 69cc154485..b6dbab41ea 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketServerTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketServerTests.cs @@ -32,7 +32,7 @@ public SocketServerTests() public void Dispose() { this.socketServer.Stop(); -#if NET451 +#if NETFRAMEWORK // tcpClient.Close() calls tcpClient.Dispose(). this.tcpClient?.Close(); #else @@ -131,7 +131,7 @@ public void SocketServerShouldRaiseClientDisconnectedEventIfConnectionIsBroken() }; // Close the client channel. Message loop should stop. -#if NET451 +#if NETFRAMEWORK // tcpClient.Close() calls tcpClient.Dispose(). this.tcpClient?.Close(); #else diff --git a/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Tracing/EqtTraceTests.cs b/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Tracing/EqtTraceTests.cs index 5e5bd2ec26..8d0c51fea5 100644 --- a/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Tracing/EqtTraceTests.cs +++ b/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Tracing/EqtTraceTests.cs @@ -3,7 +3,7 @@ namespace TestPlatform.CoreUtilities.UnitTests { -#if NET451 +#if NETFRAMEWORK using System.Diagnostics; #endif using System.IO; @@ -46,7 +46,7 @@ public void CheckInitializeLogFileTest() [TestMethod] public void CheckIfTraceStateIsVerboseEnabled() { -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Verbose; #else EqtTrace.TraceLevel = PlatformTraceLevel.Verbose; @@ -57,7 +57,7 @@ public void CheckIfTraceStateIsVerboseEnabled() [TestMethod] public void CheckIfTraceStateIsErrorEnabled() { -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Error; #else EqtTrace.TraceLevel = PlatformTraceLevel.Error; @@ -68,7 +68,7 @@ public void CheckIfTraceStateIsErrorEnabled() [TestMethod] public void CheckIfTraceStateIsInfoEnabled() { -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Info; #else EqtTrace.TraceLevel = PlatformTraceLevel.Info; @@ -79,7 +79,7 @@ public void CheckIfTraceStateIsInfoEnabled() [TestMethod] public void CheckIfTraceStateIsWarningEnabled() { -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Warning; #else EqtTrace.TraceLevel = PlatformTraceLevel.Warning; @@ -90,7 +90,7 @@ public void CheckIfTraceStateIsWarningEnabled() [TestMethod] public void TraceShouldWriteError() { -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Error; #else EqtTrace.TraceLevel = PlatformTraceLevel.Error; @@ -102,7 +102,7 @@ public void TraceShouldWriteError() [TestMethod] public void TraceShouldWriteWarning() { -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Warning; #else EqtTrace.TraceLevel = PlatformTraceLevel.Warning; @@ -114,7 +114,7 @@ public void TraceShouldWriteWarning() [TestMethod] public void TraceShouldWriteVerbose() { -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Verbose; #else EqtTrace.TraceLevel = PlatformTraceLevel.Verbose; @@ -126,7 +126,7 @@ public void TraceShouldWriteVerbose() [TestMethod] public void TraceShouldWriteInfo() { -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Info; #else EqtTrace.TraceLevel = PlatformTraceLevel.Info; @@ -138,7 +138,7 @@ public void TraceShouldWriteInfo() [TestMethod] public void TraceShouldNotWriteVerboseIfTraceLevelIsInfo() { -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Info; #else EqtTrace.TraceLevel = PlatformTraceLevel.Info; @@ -155,7 +155,7 @@ public void TraceShouldNotWriteVerboseIfTraceLevelIsInfo() public void TraceShouldNotWriteIfDoNotInitializationIsSetToTrue() { EqtTrace.DoNotInitailize = true; -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Info; #else EqtTrace.TraceLevel = PlatformTraceLevel.Info; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs index 71b651429b..9313a0ddb8 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs @@ -99,7 +99,7 @@ public void SetupChannelShouldCreateTimestampedLogFileForHost() It.Is( t => t.LogFile.Contains("log.host." + DateTime.Now.ToString("yy-MM-dd")) && t.LogFile.Contains("_" + Thread.CurrentThread.ManagedThreadId + ".txt")))); -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Off; #else EqtTrace.TraceLevel = PlatformTraceLevel.Off; @@ -124,7 +124,7 @@ public void SetupChannelShouldAddRunnerProcessIdForTestHost() [TestMethod] public void SetupChannelShouldAddCorrectTraceLevelForTestHost() { -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Info; #else EqtTrace.TraceLevel = PlatformTraceLevel.Info; diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs index e4846fd8f5..c89ffb9fa8 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ProxyDataCollectionManagerTests.cs @@ -106,7 +106,7 @@ public void InitializeShouldSetTimeoutBasedOnDebugEnvironmentVaribleName() public void InitializeShouldPassDiagArgumentsIfDiagIsEnabled() { // Saving the EqtTrace state -#if NET451 +#if NETFRAMEWORK var traceLevel = EqtTrace.TraceLevel; EqtTrace.TraceLevel = TraceLevel.Off; #else @@ -134,7 +134,7 @@ public void InitializeShouldPassDiagArgumentsIfDiagIsEnabled() { // Restoring to initial state for EqtTrace EqtTrace.InitializeTrace(traceFileName, PlatformTraceLevel.Verbose); -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = traceLevel; #else EqtTrace.TraceLevel = (PlatformTraceLevel)traceLevel; diff --git a/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/DiaSessionTests.cs b/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/DiaSessionTests.cs index 2c5c81b06a..29bdd56e45 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/DiaSessionTests.cs +++ b/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/DiaSessionTests.cs @@ -19,7 +19,7 @@ public class DiaSessionTests : IntegrationTestBase public static string GetAndSetTargetFrameWork(IntegrationTestEnvironment testEnvironment) { var currentTargetFrameWork = testEnvironment.TargetFramework; -#if NET451 +#if NETFRAMEWORK testEnvironment.TargetFramework = NET451; #else testEnvironment.TargetFramework = NETCOREAPP21; diff --git a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/FrameworkTests.cs b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/FrameworkTests.cs index d8ff68a75d..78c0b2857a 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/FrameworkTests.cs +++ b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/FrameworkTests.cs @@ -70,7 +70,7 @@ public void FrameworkFromStringShouldWorkForShortNames() [TestMethod] public void DefaultFrameworkShouldBeNet40OnDesktop() { -#if NET451 +#if NETFRAMEWORK Assert.AreEqual(".NETFramework,Version=v4.0", Framework.DefaultFramework.Name); #endif } diff --git a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Utilities/AssemblyHelperTests.cs b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Utilities/AssemblyHelperTests.cs index 7e4eb1a889..bee3795169 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Utilities/AssemblyHelperTests.cs +++ b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Utilities/AssemblyHelperTests.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -#if NET451 +#if NETFRAMEWORK namespace Microsoft.TestPlatform.ObjectModel.UnitTests.Utilities { diff --git a/test/Microsoft.TestPlatform.TestUtilities/PerfInstrumentation/PerfAnalyzer.cs b/test/Microsoft.TestPlatform.TestUtilities/PerfInstrumentation/PerfAnalyzer.cs index d4ad706bbd..8d8922693e 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/PerfInstrumentation/PerfAnalyzer.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/PerfInstrumentation/PerfAnalyzer.cs @@ -5,7 +5,7 @@ namespace Microsoft.TestPlatform.TestUtilities.PerfInstrumentation { using System.Collections.Generic; -#if NET451 +#if NETFRAMEWORK using Microsoft.Diagnostics.Tracing; using Microsoft.Diagnostics.Tracing.Parsers; using Microsoft.Diagnostics.Tracing.Session; @@ -23,7 +23,7 @@ public class PerfAnalyzer /// private const string ETWSessionProviderName = "TestPlatform"; -#if NET451 +#if NETFRAMEWORK private string perfDataFileName; private TraceEventSession traceEventSession; private Dictionary> testPlatformTaskMap; @@ -34,7 +34,7 @@ public class PerfAnalyzer /// public PerfAnalyzer() { -#if NET451 +#if NETFRAMEWORK this.perfDataFileName = "TestPlatformEventsData.etl"; this.testPlatformTaskMap = new Dictionary>(); this.traceEventSession = new TraceEventSession("TestPlatformSession", this.perfDataFileName); @@ -46,7 +46,7 @@ public PerfAnalyzer() /// public void EnableProvider() { -#if NET451 +#if NETFRAMEWORK this.traceEventSession.StopOnDispose = true; this.traceEventSession.EnableProvider(ETWSessionProviderName); #endif @@ -57,7 +57,7 @@ public void EnableProvider() /// public void DisableProvider() { -#if NET451 +#if NETFRAMEWORK this.traceEventSession.Dispose(); #endif } @@ -67,7 +67,7 @@ public void DisableProvider() /// public void AnalyzeEventsData() { -#if NET451 +#if NETFRAMEWORK using (var source = new ETWTraceEventSource(this.perfDataFileName)) { // Open the file @@ -121,7 +121,7 @@ public void AnalyzeEventsData() public double GetElapsedTimeByTaskName(string taskName) { var timeTaken = 0.0; -#if NET451 +#if NETFRAMEWORK var key = GetEventKey(taskName); if (key != null) @@ -145,7 +145,7 @@ public double GetElapsedTimeByTaskName(string taskName) public IDictionary GetEventDataByTaskName(string taskName) { IDictionary properties = new Dictionary(); -#if NET451 +#if NETFRAMEWORK var key = GetEventKey(taskName); if(key != null) @@ -159,7 +159,7 @@ public IDictionary GetEventDataByTaskName(string taskName) public double GetAdapterExecutionTime(string executorUri) { var timeTaken = 0.0; -#if NET451 +#if NETFRAMEWORK var key = GetEventKey(Constants.AdapterExecutionTask); if(key != null) @@ -174,7 +174,7 @@ public double GetAdapterExecutionTime(string executorUri) public long GetAdapterExecutedTests(string executorUri) { long totalTestsExecuted = 0; -#if NET451 +#if NETFRAMEWORK var key = GetEventKey(Constants.AdapterExecutionTask); if (key != null) @@ -186,7 +186,7 @@ public long GetAdapterExecutedTests(string executorUri) return totalTestsExecuted; } -#if NET451 +#if NETFRAMEWORK private string GetEventKey(string taskName) { diff --git a/test/Microsoft.TestPlatform.TestUtilities/PerfInstrumentation/PerformanceTestBase.cs b/test/Microsoft.TestPlatform.TestUtilities/PerfInstrumentation/PerformanceTestBase.cs index 57f3b0adcd..476d7c7684 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/PerfInstrumentation/PerformanceTestBase.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/PerfInstrumentation/PerformanceTestBase.cs @@ -36,14 +36,14 @@ public PerformanceTestBase() public void RunExecutionPerformanceTests(string testAsset, string testAdapterPath, string runSettings) { // Start session and listen -#if NET451 +#if NETFRAMEWORK this.perfAnalyzer.EnableProvider(); #endif // Run Test this.InvokeVsTestForExecution(testAsset, testAdapterPath, ".NETFramework,Version=v4.5.1", runSettings); // Stop Listening -#if NET451 +#if NETFRAMEWORK this.perfAnalyzer.DisableProvider(); #endif } @@ -63,14 +63,14 @@ public void RunExecutionPerformanceTests(string testAsset, string testAdapterPat public void RunDiscoveryPerformanceTests(string testAsset, string testAdapterPath, string runSettings) { // Start session and listen -#if NET451 +#if NETFRAMEWORK this.perfAnalyzer.EnableProvider(); #endif // Run Test this.InvokeVsTestForDiscovery(testAsset, testAdapterPath, runSettings, ".NETFramework,Version=v4.5.1"); // Stop Listening -#if NET451 +#if NETFRAMEWORK this.perfAnalyzer.DisableProvider(); #endif } diff --git a/test/TestAssets/MultitargetedNetFrameworkProject/UnitTest1.cs b/test/TestAssets/MultitargetedNetFrameworkProject/UnitTest1.cs index a7b364d9a0..9236799fd2 100644 --- a/test/TestAssets/MultitargetedNetFrameworkProject/UnitTest1.cs +++ b/test/TestAssets/MultitargetedNetFrameworkProject/UnitTest1.cs @@ -9,7 +9,7 @@ namespace MultitargetedNetFrameworkProject public class UnitTest1 { -#if NET451 +#if NETFRAMEWORK public string TargetFramework { get; } = "NET451"; #endif diff --git a/test/TestAssets/SimpleDataCollector/Class1.cs b/test/TestAssets/SimpleDataCollector/Class1.cs index f052d92c23..50998b8881 100644 --- a/test/TestAssets/SimpleDataCollector/Class1.cs +++ b/test/TestAssets/SimpleDataCollector/Class1.cs @@ -39,7 +39,7 @@ public void TestSessionStart(TestSessionStartArgs testSessionStartArgs) { Console.WriteLine(testSessionStartArgs.Configuration); File.WriteAllText(this.fileName, "TestSessionStart : " + testSessionStartArgs.Configuration + "\r\n"); -#if NET451 +#if NETFRAMEWORK var appDomainFilePath = Path.Combine(Path.GetTempPath(), "appdomain_datacollector.txt"); File.WriteAllText(appDomainFilePath, "AppDomain FriendlyName: "+ AppDomain.CurrentDomain.FriendlyName); #endif diff --git a/test/TestAssets/SimpleTestProject/UnitTest1.cs b/test/TestAssets/SimpleTestProject/UnitTest1.cs index ccb01aef4c..fba55f698b 100644 --- a/test/TestAssets/SimpleTestProject/UnitTest1.cs +++ b/test/TestAssets/SimpleTestProject/UnitTest1.cs @@ -31,7 +31,7 @@ public void PassingTest() [TestMethod] public void FailingTest() { -#if NET451 +#if NETFRAMEWORK // current App domain should be write to file to test DisableAppDomain acceptance test. var appDomainFilePath = Path.Combine(Path.GetTempPath(), "appdomain_test.txt"); File.WriteAllText(appDomainFilePath, "AppDomain FriendlyName: " + AppDomain.CurrentDomain.FriendlyName); diff --git a/test/TestAssets/SimpleTestProject3/UnitTest1.cs b/test/TestAssets/SimpleTestProject3/UnitTest1.cs index 1e3ad8f003..3ce4c563cc 100644 --- a/test/TestAssets/SimpleTestProject3/UnitTest1.cs +++ b/test/TestAssets/SimpleTestProject3/UnitTest1.cs @@ -7,7 +7,7 @@ namespace SampleUnitTestProject3 using System.IO; using System.Reflection; using System.Threading; -#if NET451 +#if NETFRAMEWORK using System.Windows.Forms; #endif @@ -36,7 +36,7 @@ public void ExitWithStackoverFlow() Span s = stackalloc byte[int.MaxValue]; } -#if NET451 +#if NETFRAMEWORK [TestMethod] public void UITestMethod() { diff --git a/test/testhost.UnitTests/AppDomainEngineInvokerTests.cs b/test/testhost.UnitTests/AppDomainEngineInvokerTests.cs index e2e4738226..4d75b7ec9c 100644 --- a/test/testhost.UnitTests/AppDomainEngineInvokerTests.cs +++ b/test/testhost.UnitTests/AppDomainEngineInvokerTests.cs @@ -3,7 +3,7 @@ namespace testhost.UnitTests { -#if NET451 +#if NETFRAMEWORK using Microsoft.VisualStudio.TestPlatform.TestHost; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; diff --git a/test/testhost.UnitTests/DefaultEngineInvokerTests.cs b/test/testhost.UnitTests/DefaultEngineInvokerTests.cs index 0c129ec34a..34fb8c9a31 100644 --- a/test/testhost.UnitTests/DefaultEngineInvokerTests.cs +++ b/test/testhost.UnitTests/DefaultEngineInvokerTests.cs @@ -99,7 +99,7 @@ public void InvokeShouldSetParentProcessExistCallback() public void InvokeShouldInitializeTraceWithCorrectTraceLevel() { // Setting EqtTrace.TraceLevel to a value other than info. -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Verbose; #else EqtTrace.TraceLevel = PlatformTraceLevel.Verbose; @@ -115,7 +115,7 @@ public void InvokeShouldInitializeTraceWithCorrectTraceLevel() public void InvokeShouldInitializeTraceWithVerboseTraceLevelIfInvalidTraceLevelPassed() { // Setting EqtTrace.TraceLevel to a value other than info. -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Warning; #else EqtTrace.TraceLevel = PlatformTraceLevel.Warning; diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index eeaa16aeba..45cc4f5553 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -115,7 +115,7 @@ public void InitializeWithParametersShouldDefaultToNormalVerbosityLevelForInvali this.consoleLogger.Initialize(new Mock().Object, parameters); -#if NET451 +#if NETFRAMEWORK Assert.AreEqual(ConsoleLogger.Verbosity.Normal, this.consoleLogger.VerbosityLevel); #else Assert.AreEqual(ConsoleLogger.Verbosity.Minimal, this.consoleLogger.VerbosityLevel); diff --git a/test/vstest.console.UnitTests/Processors/EnableDiagArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/EnableDiagArgumentProcessorTests.cs index 19f43fc542..a74fa767b9 100644 --- a/test/vstest.console.UnitTests/Processors/EnableDiagArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/EnableDiagArgumentProcessorTests.cs @@ -35,7 +35,7 @@ public EnableDiagArgumentProcessorTests() this.diagProcessor = new TestableEnableDiagArgumentProcessor(this.mockFileHelper.Object); // Saving the EqtTrace state -#if NET451 +#if NETFRAMEWORK traceLevel = EqtTrace.TraceLevel; EqtTrace.TraceLevel = TraceLevel.Off; #else @@ -51,7 +51,7 @@ public void Cleanup() { // Restoring to initial state for EqtTrace EqtTrace.InitializeTrace(traceFileName, PlatformTraceLevel.Verbose); -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = traceLevel; #else EqtTrace.TraceLevel = (PlatformTraceLevel)traceLevel; @@ -137,7 +137,7 @@ public void EnableDiagArgumentProcessorExecutorShouldNotThrowIfValidArgument(str public void EnableDiagArgumentProcessorExecutorShouldInitializeTraceWithCorrectTraceLevel(string argument) { // Setting any trace level other than info. -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Verbose; #else EqtTrace.TraceLevel = PlatformTraceLevel.Verbose; @@ -174,7 +174,7 @@ public void EnableDiagArgumentProcessorExecutorShouldDisableVerboseLoggingIfEqtT this.diagProcessor.Executor.Value.Initialize(this.dummyFilePath); Assert.IsTrue(!EqtTrace.IsVerboseEnabled); -#if NET451 +#if NETFRAMEWORK EqtTrace.TraceLevel = TraceLevel.Off; #else EqtTrace.TraceLevel = PlatformTraceLevel.Off; diff --git a/test/vstest.console.UnitTests/Processors/EnableLoggersArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/EnableLoggersArgumentProcessorTests.cs index 2e38a8579f..c7c7d367b2 100644 --- a/test/vstest.console.UnitTests/Processors/EnableLoggersArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/EnableLoggersArgumentProcessorTests.cs @@ -40,7 +40,7 @@ public void CapabilitiesShouldAppropriateProperties() { EnableLoggerArgumentProcessorCapabilities capabilities = new EnableLoggerArgumentProcessorCapabilities(); Assert.AreEqual("/Logger", capabilities.CommandName); -#if NET451 +#if NETFRAMEWORK Assert.AreEqual("--logger|/logger:" + Environment.NewLine + " Specify a logger for test results. For example, to log results into a " + Environment.NewLine + " Visual Studio Test Results File (TRX) use /logger:trx[;LogFileName=]" + Environment.NewLine + " Creates file in TestResults directory with given LogFileName." + Environment.NewLine + "" + Environment.NewLine + " Change the verbosity level in log messages for console logger as shown below" + Environment.NewLine + " Example: /logger:console;verbosity=" + Environment.NewLine + " Allowed values for verbosity: quiet, minimal, normal and detailed." + Environment.NewLine + "" + Environment.NewLine + " Change the diagnostic level prefix for console logger as shown below" + Environment.NewLine + " Example: /logger:console;prefix=" + Environment.NewLine + " More info on Console Logger here : https://aka.ms/console-logger", capabilities.HelpContentResourceName); #else Assert.AreEqual("--logger|/logger:" + Environment.NewLine + " Specify a logger for test results. For example, to log results into a " + Environment.NewLine + " Visual Studio Test Results File (TRX) use /logger:trx[;LogFileName=]" + Environment.NewLine + " Creates file in TestResults directory with given LogFileName." + Environment.NewLine + "" + Environment.NewLine + " Change the verbosity level in log messages for console logger as shown below" + Environment.NewLine + " Example: /logger:console;verbosity=" + Environment.NewLine + " Allowed values for verbosity: quiet, minimal, normal and detailed." + Environment.NewLine + "" + Environment.NewLine + " Change the diagnostic level prefix for console logger as shown below" + Environment.NewLine + " Example: /logger:console;prefix=" + Environment.NewLine + " More info on Console Logger here : https://aka.ms/console-logger", capabilities.HelpContentResourceName); diff --git a/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs index b86e0ceeb1..d7e1d562d6 100644 --- a/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs @@ -94,7 +94,7 @@ public void InitializeShouldThrowIfGivenPathisIllegal() folder, "The filename, directory name, or volume label syntax is incorrect : \'c:\\som>\\illegal\\path\\\'"); -#if NET451 +#if NETFRAMEWORK message = string.Format( @"The path '{0}' specified in the 'ResultsDirectory' is invalid. Error: {1}", folder, @@ -113,7 +113,7 @@ public void InitializeShouldThrowIfPathIsNotSupported() @"The path '{0}' specified in the 'ResultsDirectory' is invalid. Error: {1}", folder, "The directory name is invalid : \'c:\\path\\to\\in:valid\'"); -#if NET451 +#if NETFRAMEWORK message = string.Format( @"The path '{0}' specified in the 'ResultsDirectory' is invalid. Error: {1}", folder, From 1a659202b9bdc0255315e64d2bca3e682f65a838 Mon Sep 17 00:00:00 2001 From: nohwnd Date: Wed, 12 Aug 2020 11:02:57 +0200 Subject: [PATCH 2/3] Revert change in acceptance test --- test/TestAssets/MultitargetedNetFrameworkProject/UnitTest1.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/TestAssets/MultitargetedNetFrameworkProject/UnitTest1.cs b/test/TestAssets/MultitargetedNetFrameworkProject/UnitTest1.cs index 9236799fd2..a7b364d9a0 100644 --- a/test/TestAssets/MultitargetedNetFrameworkProject/UnitTest1.cs +++ b/test/TestAssets/MultitargetedNetFrameworkProject/UnitTest1.cs @@ -9,7 +9,7 @@ namespace MultitargetedNetFrameworkProject public class UnitTest1 { -#if NETFRAMEWORK +#if NET451 public string TargetFramework { get; } = "NET451"; #endif From afb7907c714c7cad389ad0f98df25e2fbb503b8a Mon Sep 17 00:00:00 2001 From: nohwnd Date: Wed, 12 Aug 2020 12:36:27 +0200 Subject: [PATCH 3/3] Fix Linux build hopefully --- src/testhost.x86/testhost.x86.csproj | 3 ++- src/testhost/testhost.csproj | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/testhost.x86/testhost.x86.csproj b/src/testhost.x86/testhost.x86.csproj index 244737eb76..67a3bf57a8 100644 --- a/src/testhost.x86/testhost.x86.csproj +++ b/src/testhost.x86/testhost.x86.csproj @@ -30,7 +30,8 @@ true - + + diff --git a/src/testhost/testhost.csproj b/src/testhost/testhost.csproj index 494fcb5ab6..8b57e6b9f1 100644 --- a/src/testhost/testhost.csproj +++ b/src/testhost/testhost.csproj @@ -32,7 +32,8 @@ true - + +