From 001a29d71a6c1e003ddb604874260d00cd1657f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Sat, 14 Dec 2024 20:35:10 +0100 Subject: [PATCH] Make obsolete only on release (#4353) --- .../Execution/LogMessageListener.cs | 2 ++ .../Execution/TestAssemblyInfo.cs | 2 ++ .../Execution/TestClassInfo.cs | 2 ++ .../Execution/TestExecutionManager.cs | 2 ++ .../Execution/TestMethodInfo.cs | 2 ++ .../Execution/TestRunCancellationToken.cs | 2 ++ .../Extensions/UnitTestOutcomeExtensions.cs | 2 ++ .../MSTest.TestAdapter/MSTestSettings.cs | 2 ++ .../ObjectModel/TestMethod.cs | 2 ++ .../ObjectModel/UnitTestOutcome.cs | 2 ++ .../ObjectModel/UnitTestResult.cs | 2 ++ .../RunConfigurationSettings.cs | 2 ++ .../VSTestAdapter/MSTestDiscoverer.cs | 2 ++ .../VSTestAdapter/MSTestExecutor.cs | 2 ++ .../AssemblyResolver.cs | 2 ++ .../Deployment/TestRunDirectories.cs | 2 ++ .../Interfaces/IAdapterTraceLogger.cs | 2 ++ .../Interfaces/IFileOperations.cs | 2 ++ .../Interfaces/IReflectionOperations.cs | 2 ++ .../Interfaces/ISettingsProvider.cs | 2 ++ .../Interfaces/ITestDeployment.cs | 2 ++ .../Interfaces/ITestSource.cs | 2 ++ .../Interfaces/ITestSourceHost.cs | 2 ++ .../Interfaces/IThreadOperations.cs | 2 ++ .../Interfaces/ITraceListener.cs | 2 ++ .../Interfaces/ITraceListenerManager.cs | 2 ++ .../RecursiveDirectoryPath.cs | 2 ++ .../Services/FileOperations.cs | 2 ++ .../Services/MSTestAdapterSettings.cs | 2 ++ .../Services/ReflectionOperations.cs | 2 ++ .../Services/SettingsProvider.cs | 2 ++ .../Services/TestContextImplementation.cs | 2 ++ .../Services/TestDataSource.cs | 2 ++ .../Services/TestDeployment.cs | 2 ++ .../Services/TestSource.cs | 2 ++ .../Services/TestSourceHost.cs | 2 ++ .../Services/ThreadOperations.cs | 2 ++ .../Services/ThreadSafeStringWriter.cs | 2 ++ .../Services/TraceListener.cs | 2 ++ .../Services/TraceListenerManager.cs | 2 ++ .../Services/TraceLogger.cs | 2 ++ .../Utilities/VSInstallationUtilities.cs | 2 ++ .../Services/MSTestAdapterSettingsTests.cs | 20 +++++++++---------- 43 files changed, 94 insertions(+), 10 deletions(-) diff --git a/src/Adapter/MSTest.TestAdapter/Execution/LogMessageListener.cs b/src/Adapter/MSTest.TestAdapter/Execution/LogMessageListener.cs index 41df65ebee..b574bd1f15 100644 --- a/src/Adapter/MSTest.TestAdapter/Execution/LogMessageListener.cs +++ b/src/Adapter/MSTest.TestAdapter/Execution/LogMessageListener.cs @@ -14,11 +14,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution; /// Listens for log messages and Debug.WriteLine /// Note that this class is not thread-safe and thus should only be used when unit tests are being run serially. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class LogMessageListener : IDisposable { private static readonly Lock TraceLock = new(); diff --git a/src/Adapter/MSTest.TestAdapter/Execution/TestAssemblyInfo.cs b/src/Adapter/MSTest.TestAdapter/Execution/TestAssemblyInfo.cs index c89657609d..2af076c1a9 100644 --- a/src/Adapter/MSTest.TestAdapter/Execution/TestAssemblyInfo.cs +++ b/src/Adapter/MSTest.TestAdapter/Execution/TestAssemblyInfo.cs @@ -18,11 +18,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution; /// /// Defines TestAssembly Info object. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class TestAssemblyInfo { private readonly Lock _assemblyInfoExecuteSyncObject = new(); diff --git a/src/Adapter/MSTest.TestAdapter/Execution/TestClassInfo.cs b/src/Adapter/MSTest.TestAdapter/Execution/TestClassInfo.cs index fe29c5998e..7fb4dd3131 100644 --- a/src/Adapter/MSTest.TestAdapter/Execution/TestClassInfo.cs +++ b/src/Adapter/MSTest.TestAdapter/Execution/TestClassInfo.cs @@ -20,11 +20,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution; /// /// Defines the TestClassInfo object. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class TestClassInfo { private readonly Lock _testClassExecuteSyncObject = new(); diff --git a/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs b/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs index b8af1f04b5..e05a6e1b02 100644 --- a/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs +++ b/src/Adapter/MSTest.TestAdapter/Execution/TestExecutionManager.cs @@ -19,11 +19,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution; /// /// Class responsible for execution of tests at assembly level and sending tests via framework handle. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class TestExecutionManager { /// diff --git a/src/Adapter/MSTest.TestAdapter/Execution/TestMethodInfo.cs b/src/Adapter/MSTest.TestAdapter/Execution/TestMethodInfo.cs index b6d05a1b25..259903d3d4 100644 --- a/src/Adapter/MSTest.TestAdapter/Execution/TestMethodInfo.cs +++ b/src/Adapter/MSTest.TestAdapter/Execution/TestMethodInfo.cs @@ -21,11 +21,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution; /// /// Defines the TestMethod Info object. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class TestMethodInfo : ITestMethod { /// diff --git a/src/Adapter/MSTest.TestAdapter/Execution/TestRunCancellationToken.cs b/src/Adapter/MSTest.TestAdapter/Execution/TestRunCancellationToken.cs index fb380b6bb2..436e5791ad 100644 --- a/src/Adapter/MSTest.TestAdapter/Execution/TestRunCancellationToken.cs +++ b/src/Adapter/MSTest.TestAdapter/Execution/TestRunCancellationToken.cs @@ -8,11 +8,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter; /// /// Cancellation token supporting cancellation of a test run. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class TestRunCancellationToken { /// diff --git a/src/Adapter/MSTest.TestAdapter/Extensions/UnitTestOutcomeExtensions.cs b/src/Adapter/MSTest.TestAdapter/Extensions/UnitTestOutcomeExtensions.cs index 0e05bd2bb0..947f9b77a7 100644 --- a/src/Adapter/MSTest.TestAdapter/Extensions/UnitTestOutcomeExtensions.cs +++ b/src/Adapter/MSTest.TestAdapter/Extensions/UnitTestOutcomeExtensions.cs @@ -7,11 +7,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Extensions; +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public static class UnitTestOutcomeExtensions { /// diff --git a/src/Adapter/MSTest.TestAdapter/MSTestSettings.cs b/src/Adapter/MSTest.TestAdapter/MSTestSettings.cs index 2574a2b81d..1870ce1d62 100644 --- a/src/Adapter/MSTest.TestAdapter/MSTestSettings.cs +++ b/src/Adapter/MSTest.TestAdapter/MSTestSettings.cs @@ -20,11 +20,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter; /// Adapter Settings for the run. /// [Serializable] +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class MSTestSettings { /// diff --git a/src/Adapter/MSTest.TestAdapter/ObjectModel/TestMethod.cs b/src/Adapter/MSTest.TestAdapter/ObjectModel/TestMethod.cs index e245e2bc3c..e24df2d56c 100644 --- a/src/Adapter/MSTest.TestAdapter/ObjectModel/TestMethod.cs +++ b/src/Adapter/MSTest.TestAdapter/ObjectModel/TestMethod.cs @@ -16,11 +16,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel; /// /// TestMethod contains information about a unit test method that needs to be executed. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif [Serializable] public sealed class TestMethod : ITestMethod { diff --git a/src/Adapter/MSTest.TestAdapter/ObjectModel/UnitTestOutcome.cs b/src/Adapter/MSTest.TestAdapter/ObjectModel/UnitTestOutcome.cs index a519c454eb..8aff354865 100644 --- a/src/Adapter/MSTest.TestAdapter/ObjectModel/UnitTestOutcome.cs +++ b/src/Adapter/MSTest.TestAdapter/ObjectModel/UnitTestOutcome.cs @@ -6,11 +6,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel; /// /// Outcome of a test. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public enum UnitTestOutcome : int { /// diff --git a/src/Adapter/MSTest.TestAdapter/ObjectModel/UnitTestResult.cs b/src/Adapter/MSTest.TestAdapter/ObjectModel/UnitTestResult.cs index 38975edd70..57f2ec8e28 100644 --- a/src/Adapter/MSTest.TestAdapter/ObjectModel/UnitTestResult.cs +++ b/src/Adapter/MSTest.TestAdapter/ObjectModel/UnitTestResult.cs @@ -14,11 +14,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel; [Serializable] [DebuggerDisplay("{DisplayName} ({Outcome})")] +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class UnitTestResult { /// diff --git a/src/Adapter/MSTest.TestAdapter/RunConfigurationSettings.cs b/src/Adapter/MSTest.TestAdapter/RunConfigurationSettings.cs index 2f6613ffe4..d7009797eb 100644 --- a/src/Adapter/MSTest.TestAdapter/RunConfigurationSettings.cs +++ b/src/Adapter/MSTest.TestAdapter/RunConfigurationSettings.cs @@ -13,11 +13,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter; +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class RunConfigurationSettings { /// diff --git a/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestDiscoverer.cs b/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestDiscoverer.cs index 3f3a15d2fb..c61b73aaa3 100644 --- a/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestDiscoverer.cs +++ b/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestDiscoverer.cs @@ -16,11 +16,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter; [FileExtension(".appx")] [FileExtension(".dll")] [FileExtension(".exe")] +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class MSTestDiscoverer : ITestDiscoverer { /// diff --git a/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs b/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs index ecdf3e498a..51f8df0a8b 100644 --- a/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs +++ b/src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs @@ -15,11 +15,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter; /// Contains the execution logic for this adapter. /// [ExtensionUri(Constants.ExecutorUriString)] +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class MSTestExecutor : ITestExecutor { private readonly CancellationToken _cancellationToken; diff --git a/src/Adapter/MSTestAdapter.PlatformServices/AssemblyResolver.cs b/src/Adapter/MSTestAdapter.PlatformServices/AssemblyResolver.cs index ba2917c1eb..6e09cd6020 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/AssemblyResolver.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/AssemblyResolver.cs @@ -21,11 +21,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// Since we don't want to put our assemblies to GAC and they are not in tests dir, we use custom way to resolve them. /// #if NETFRAMEWORK +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public #else internal sealed diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Deployment/TestRunDirectories.cs b/src/Adapter/MSTestAdapter.PlatformServices/Deployment/TestRunDirectories.cs index 217bc8b6b6..db0a583a89 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Deployment/TestRunDirectories.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Deployment/TestRunDirectories.cs @@ -12,11 +12,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Dep /// /// The test run directories. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif [Serializable] public class TestRunDirectories { diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IAdapterTraceLogger.cs b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IAdapterTraceLogger.cs index 14d14d6337..85dff3e128 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IAdapterTraceLogger.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IAdapterTraceLogger.cs @@ -8,11 +8,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Int /// /// A service to log any trace messages from the adapter that would be shown in *.TpTrace files. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public interface IAdapterTraceLogger { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IFileOperations.cs b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IFileOperations.cs index 3ae7c05162..220384a574 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IFileOperations.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IFileOperations.cs @@ -8,11 +8,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Int /// /// This service is responsible for any file based operations. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public interface IFileOperations { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IReflectionOperations.cs b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IReflectionOperations.cs index 29a90e3033..6d45ad9137 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IReflectionOperations.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IReflectionOperations.cs @@ -9,11 +9,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Int /// /// This service is responsible for platform specific reflection operations. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public interface IReflectionOperations { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ISettingsProvider.cs b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ISettingsProvider.cs index e0939a3976..84d99b8c11 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ISettingsProvider.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ISettingsProvider.cs @@ -8,11 +8,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Int /// /// To read settings from the runsettings xml for the corresponding platform service. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public interface ISettingsProvider { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITestDeployment.cs b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITestDeployment.cs index aeeee1826a..a8cd1766ef 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITestDeployment.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITestDeployment.cs @@ -11,11 +11,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Int /// /// The TestDeployment interface. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public interface ITestDeployment { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITestSource.cs b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITestSource.cs index 3bd96ce786..ee1321c162 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITestSource.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITestSource.cs @@ -9,11 +9,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Int /// This platform service is responsible for any data or operations to validate /// the test sources provided to the adapter. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public interface ITestSource { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITestSourceHost.cs b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITestSourceHost.cs index 5f4f73b8bf..9d2f93a7b5 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITestSourceHost.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITestSourceHost.cs @@ -8,11 +8,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Int /// /// A host that loads the test source.This can be in isolation for desktop using an AppDomain or just loading the source in the current context. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public interface ITestSourceHost : IDisposable { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IThreadOperations.cs b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IThreadOperations.cs index f03762ff1d..8655d44b27 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IThreadOperations.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/IThreadOperations.cs @@ -6,11 +6,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Int /// /// This service is responsible for any thread operations specific to a platform. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public interface IThreadOperations { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITraceListener.cs b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITraceListener.cs index 6bc98aaec5..3356a46238 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITraceListener.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITraceListener.cs @@ -6,11 +6,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Int /// /// Operations on the TraceListener object that is implemented differently for each platform. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public interface ITraceListener { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITraceListenerManager.cs b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITraceListenerManager.cs index 9dbe78d52e..cc0779a5f9 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITraceListenerManager.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Interfaces/ITraceListenerManager.cs @@ -7,11 +7,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Int /// Manager to perform operations on the TraceListener object passed as parameter. /// These operations are implemented differently for each platform service. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public interface ITraceListenerManager { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/RecursiveDirectoryPath.cs b/src/Adapter/MSTestAdapter.PlatformServices/RecursiveDirectoryPath.cs index 7aaea3d496..93f712ca1c 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/RecursiveDirectoryPath.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/RecursiveDirectoryPath.cs @@ -20,11 +20,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// For each directory we need to have two info 1) path 2) includeSubDirectories. /// [Serializable] +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1603:DocumentationMustContainValidXml", Justification = "Reviewed. Suppression is ok here.")] public class RecursiveDirectoryPath : MarshalByRefObject { diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/FileOperations.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/FileOperations.cs index 04475207db..6a257ae966 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/FileOperations.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/FileOperations.cs @@ -18,11 +18,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// /// The file operations. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class FileOperations : IFileOperations { private readonly ConcurrentDictionary _assemblyCache = new(); diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/MSTestAdapterSettings.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/MSTestAdapterSettings.cs index 0949dec0f6..59ac48a834 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/MSTestAdapterSettings.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/MSTestAdapterSettings.cs @@ -12,11 +12,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class MSTestAdapterSettings { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/ReflectionOperations.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/ReflectionOperations.cs index 8663ff8570..f927fd9137 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/ReflectionOperations.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/ReflectionOperations.cs @@ -17,11 +17,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// /// This service is responsible for platform specific reflection operations. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class ReflectionOperations : IReflectionOperations { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/SettingsProvider.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/SettingsProvider.cs index baf259c3dc..618229553b 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/SettingsProvider.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/SettingsProvider.cs @@ -14,11 +14,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// /// Class to read settings from the runsettings xml for the desktop. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class MSTestSettingsProvider : ISettingsProvider { #if !WINDOWS_UWP diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestContextImplementation.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestContextImplementation.cs index 2a2823bd5e..5685895cd2 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestContextImplementation.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestContextImplementation.cs @@ -20,11 +20,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// The virtual string properties of the TestContext are retrieved from the property dictionary /// like GetProperty<string>("TestName") or GetProperty<string>("FullyQualifiedTestClassName"). /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class TestContextImplementation : TestContext, ITestContext { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDataSource.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDataSource.cs index 24dbc96867..06ecd53fbe 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDataSource.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDataSource.cs @@ -26,11 +26,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// the tests since it can only be found at the test output directory. DO NOT call into this platform service outside of the appdomain context if you do not want to hit /// a ReflectionTypeLoadException. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class TestDataSource : ITestDataSource { #if NETFRAMEWORK diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDeployment.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDeployment.cs index c8fc00c01a..142cbe85d6 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDeployment.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestDeployment.cs @@ -25,11 +25,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// /// The test deployment. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class TestDeployment : ITestDeployment { #if !WINDOWS_UWP diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSource.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSource.cs index 13d03b2955..07421a54a6 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSource.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSource.cs @@ -17,11 +17,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// This platform service is responsible for any data or operations to validate /// the test sources provided to the adapter. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class TestSource : ITestSource { #if WINDOWS_UWP || WIN_UI diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSourceHost.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSourceHost.cs index 25e8a8e3ce..3947aae28b 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSourceHost.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestSourceHost.cs @@ -23,11 +23,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// /// A host that loads the test source. This can be in isolation for desktop using an AppDomain or just loading the source in the current context. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class TestSourceHost : ITestSourceHost { #if !WINDOWS_UWP diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/ThreadOperations.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/ThreadOperations.cs index c67aa5a18e..156a2e7efb 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/ThreadOperations.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/ThreadOperations.cs @@ -12,11 +12,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// /// This service is responsible for any Async operations specific to a platform. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class ThreadOperations : IThreadOperations { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/ThreadSafeStringWriter.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/ThreadSafeStringWriter.cs index 9d3efef984..af48e6c7ae 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/ThreadSafeStringWriter.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/ThreadSafeStringWriter.cs @@ -8,11 +8,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// /// AsyncContext aware, thread safe string writer that allows output writes from different threads to end up in the same async local context. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class ThreadSafeStringWriter : StringWriter { #if DEBUG diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/TraceListener.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/TraceListener.cs index d63c8e0363..25196e6784 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/TraceListener.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/TraceListener.cs @@ -16,11 +16,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// The virtual operations of the TraceListener are implemented here /// like Close(), Dispose() etc. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class TraceListenerWrapper : #if !WINDOWS_UWP && !WIN_UI TextWriterTraceListener, diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/TraceListenerManager.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/TraceListenerManager.cs index 4c06279271..7aa3dcbd53 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/TraceListenerManager.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/TraceListenerManager.cs @@ -13,11 +13,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// Internal implementation of TraceListenerManager exposed to the user. /// Responsible for performing Add(), Remove(), Close(), Dispose() operations on traceListener object. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class TraceListenerManager : ITraceListenerManager { #if !WINDOWS_UWP && !WIN_UI diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/TraceLogger.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/TraceLogger.cs index 44baf76b71..60234199e6 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/TraceLogger.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/TraceLogger.cs @@ -9,11 +9,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices; /// /// A service to log any trace messages from the adapter that would be shown in *.TpTrace files. /// +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public class AdapterTraceLogger : IAdapterTraceLogger { /// diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Utilities/VSInstallationUtilities.cs b/src/Adapter/MSTestAdapter.PlatformServices/Utilities/VSInstallationUtilities.cs index d2ea62d3d0..0a16f5e3f4 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Utilities/VSInstallationUtilities.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Utilities/VSInstallationUtilities.cs @@ -10,11 +10,13 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Utilities; +#if RELEASE #if NET6_0_OR_GREATER [Obsolete(Constants.PublicTypeObsoleteMessage, DiagnosticId = "MSTESTOBS")] #else [Obsolete(Constants.PublicTypeObsoleteMessage)] #endif +#endif public static class VSInstallationUtilities { /// diff --git a/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Services/MSTestAdapterSettingsTests.cs b/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Services/MSTestAdapterSettingsTests.cs index 2d8df6545a..787e96b51a 100644 --- a/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Services/MSTestAdapterSettingsTests.cs +++ b/test/UnitTests/MSTestAdapter.PlatformServices.UnitTests/Services/MSTestAdapterSettingsTests.cs @@ -318,16 +318,16 @@ public void ToSettings_ShouldInitializeDeploymentAndAssemblyResolutionSettingsCo { // Arrange var configDictionary = new Dictionary - { - { "mstest:deployment:enabled", "true" }, - { "mstest:deployment:deployTestSourceDependencies", "true" }, - { "mstest:deployment:deleteDeploymentDirectoryAfterTestRunIsComplete", "false" }, - { "mstest:assemblyResolution:0:path", "C:\\project\\dependencies" }, - { "mstest:assemblyResolution:0:includeSubDirectories", "true" }, - { "mstest:assemblyResolution:1:path", "C:\\project\\libs" }, - { "mstest:assemblyResolution:1:includeSubDirectories", "false" }, - { "mstest:assemblyResolution:2:path", "C:\\project\\plugins" }, - }; + { + { "mstest:deployment:enabled", "true" }, + { "mstest:deployment:deployTestSourceDependencies", "true" }, + { "mstest:deployment:deleteDeploymentDirectoryAfterTestRunIsComplete", "false" }, + { "mstest:assemblyResolution:0:path", "C:\\project\\dependencies" }, + { "mstest:assemblyResolution:0:includeSubDirectories", "true" }, + { "mstest:assemblyResolution:1:path", "C:\\project\\libs" }, + { "mstest:assemblyResolution:1:includeSubDirectories", "false" }, + { "mstest:assemblyResolution:2:path", "C:\\project\\plugins" }, + }; var mockConfig = new Mock(); mockConfig.Setup(config => config[It.IsAny()])