Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
namespace Microsoft.VisualStudio.TestTools.UnitTesting;

[SuppressMessage("ApiDesign", "RS0030:Do not use banned APIs", Justification = "MTP logger bridge")]
internal sealed class MTPTraceLogger : MarshalByRefObject, ITraceLogger
internal sealed class MTPTraceLogger :
#if NETFRAMEWORK
MarshalByRefObject,
#endif
ITraceLogger
{
private readonly ILogger _logger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.VSTestAdapter;

internal sealed class EqtTraceLogger : MarshalByRefObject, ITraceLogger
internal sealed class EqtTraceLogger :
#if NETFRAMEWORK
MarshalByRefObject,
#endif
ITraceLogger
{
private EqtTraceLogger()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Dep
/// <summary>
/// Specifies type of deployment item origin, where the item comes from.
/// </summary>
#if NETFRAMEWORK
[Serializable]
#endif
internal enum DeploymentItemOriginType
{
/// <summary>
Expand All @@ -37,7 +39,9 @@ internal enum DeploymentItemOriginType
/// <summary>
/// The deployment item for a test class or a test method.
/// </summary>
#if NETFRAMEWORK
[Serializable]
#endif
internal sealed class DeploymentItem
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Dep
/// <summary>
/// The test run directories.
/// </summary>
#if NETFRAMEWORK
[Serializable]
#endif
internal sealed class TestRunDirectories
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Discovery;
/// </summary>
/// <param name="TestElements">The test elements that were discovered.</param>
/// <param name="Warnings">Warnings that happened during discovery.</param>
#if NETFRAMEWORK
[Serializable]
#endif
internal sealed record AssemblyEnumerationResult(List<UnitTestElement> TestElements, List<string> Warnings);
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Runtime.Serialization;
#if NETFRAMEWORK
using System.Security;
#endif

using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution;
using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Helpers;
Expand All @@ -16,7 +18,10 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Discovery;
/// Enumerates through all types in the assembly in search of valid test methods.
/// </summary>
[SuppressMessage("Performance", "CA1852: Seal internal types", Justification = "Overrides required for testability")]
internal class AssemblyEnumerator : MarshalByRefObject
internal class AssemblyEnumerator
#if NETFRAMEWORK
: MarshalByRefObject
#endif
{
/// <summary>
/// Helper for reflection API's.
Expand Down Expand Up @@ -45,17 +50,16 @@ public AssemblyEnumerator(MSTestSettings settings) =>
// This would just be resetting the settings to itself in non desktop workflows.
MSTestSettings.PopulateSettings(settings);

#if NETFRAMEWORK
/// <summary>
/// Returns object to be used for controlling lifetime, null means infinite lifetime.
/// </summary>
/// <returns>
/// The <see cref="object"/>.
/// </returns>
[SecurityCritical]
#if NET5_0_OR_GREATER
[Obsolete("MarshalByRefObject.InitializeLifetimeService is obsolete in .NET 5+. This override is required to maintain infinite lifetime service.")]
#endif
public override object InitializeLifetimeService() => null!;
#endif

/// <summary>
/// Enumerates through all types in the assembly in search of valid test methods.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if NETFRAMEWORK
using System.Security;
#endif

using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Helpers;
using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution;

internal sealed class TestAssemblySettingsProvider : MarshalByRefObject
internal sealed class TestAssemblySettingsProvider
#if NETFRAMEWORK
: MarshalByRefObject
#endif
{
#if NETFRAMEWORK
/// <summary>
/// Returns object to be used for controlling lifetime, null means infinite lifetime.
/// </summary>
/// <returns>
/// The <see cref="object"/>.
/// </returns>
[SecurityCritical]
#if NET5_0_OR_GREATER
[Obsolete("MarshalByRefObject.InitializeLifetimeService is obsolete in .NET 5+. This override is required to maintain infinite lifetime service.")]
#endif
public override object InitializeLifetimeService() => null!;
#endif

[SuppressMessage(
"Performance",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution;
#pragma warning disable CA1852 // Seal internal types - This class is inherited in tests.
internal class TestExecutionManager
{
private sealed class RemotingMessageLogger : MarshalByRefObject, IMessageLogger
private sealed class RemotingMessageLogger :
#if NETFRAMEWORK
MarshalByRefObject,
#endif
IMessageLogger
{
private readonly IMessageLogger _realMessageLogger;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if NETFRAMEWORK
using System.Security;
#endif

using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Discovery;
using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Extensions;
Expand All @@ -15,7 +17,10 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution;
/// <summary>
/// Defines type cache which reflects upon a type and cache its test artifacts.
/// </summary>
internal sealed class TypeCache : MarshalByRefObject
internal sealed class TypeCache
#if NETFRAMEWORK
: MarshalByRefObject
#endif
{
/// <summary>
/// Helper for reflection API's.
Expand Down Expand Up @@ -108,17 +113,16 @@ public IEnumerable<TestAssemblyInfo> AssemblyInfoListWithExecutableCleanupMethod
return ResolveTestMethodInfoForDiscovery(testMethod, testClassInfo);
}

#if NETFRAMEWORK
Comment thread
Evangelink marked this conversation as resolved.
/// <summary>
/// Returns object to be used for controlling lifetime, null means infinite lifetime.
/// </summary>
/// <returns>
/// The <see cref="object"/>.
/// </returns>
[SecurityCritical]
#if NET5_0_OR_GREATER
[Obsolete("MarshalByRefObject.InitializeLifetimeService is obsolete in .NET 5+. This override is required to maintain infinite lifetime service.")]
#endif
public override object InitializeLifetimeService() => null!;
Comment thread
Evangelink marked this conversation as resolved.
Outdated
#endif

#region ClassInfo creation and cache logic.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if NETFRAMEWORK
using System.Security;
#endif

using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Extensions;
using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Helpers;
Expand All @@ -18,7 +20,10 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution;
/// <summary>
/// The runner that runs a single unit test. Also manages the assembly and class cleanup methods at the end of the run.
/// </summary>
internal sealed class UnitTestRunner : MarshalByRefObject
internal sealed class UnitTestRunner
#if NETFRAMEWORK
: MarshalByRefObject
#endif
{
private readonly TypeCache _typeCache;
private readonly ClassCleanupManager _classCleanupManager;
Expand Down Expand Up @@ -75,17 +80,16 @@ public void Cancel()
=> PlatformServiceProvider.Instance.TestRunCancellationToken?.Cancel();
#pragma warning restore CA1822 // Mark members as static

#if NETFRAMEWORK
/// <summary>
/// Returns object to be used for controlling lifetime, null means infinite lifetime.
/// </summary>
/// <returns>
/// The <see cref="object"/>.
/// </returns>
[SecurityCritical]
#if NET5_0_OR_GREATER
[Obsolete("MarshalByRefObject.InitializeLifetimeService is obsolete in .NET 5+. This override is required to maintain infinite lifetime service.")]
#endif
public override object InitializeLifetimeService() => null!;
#endif

// Task cannot cross app domains.
// For now, TestExecutionManager will call this sync method which is hacky.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if NETFRAMEWORK
using System.Security;
#endif

using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Helpers;

[SuppressMessage("Performance", "CA1852: Seal internal types", Justification = "Overrides required for mocking")]
internal class ReflectHelper : MarshalByRefObject
internal class ReflectHelper
#if NETFRAMEWORK
: MarshalByRefObject
#endif
{
#pragma warning disable RS0030 // Do not use banned APIs
private static readonly Lazy<ReflectHelper> InstanceValue = new(() => new());
Expand Down Expand Up @@ -53,17 +58,16 @@ internal class ReflectHelper : MarshalByRefObject
return false;
}

#if NETFRAMEWORK
/// <summary>
/// Returns object to be used for controlling lifetime, null means infinite lifetime.
/// </summary>
/// <returns>
/// The <see cref="object"/>.
/// </returns>
[SecurityCritical]
#if NET5_0_OR_GREATER
[Obsolete("MarshalByRefObject.InitializeLifetimeService is obsolete in .NET 5+. This override is required to maintain infinite lifetime service.")]
#endif
public override object InitializeLifetimeService() => null!;
#endif

/// <summary>
/// Gets first attribute that matches the type.
Expand Down
2 changes: 2 additions & 0 deletions src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
/// <summary>
/// Adapter Settings for the run.
/// </summary>
#if NETFRAMEWORK
[Serializable]
#endif
internal sealed class MSTestSettings
{
/// <summary>
Expand All @@ -36,12 +38,12 @@
/// <summary>
/// Member variable for Adapter settings.
/// </summary>
private static MSTestSettings? s_currentSettings;

Check failure on line 41 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L41

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(41,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 41 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L41

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(41,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 41 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L41

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(41,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 41 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L41

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(41,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 41 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L41

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(41,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 41 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L41

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(41,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 41 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L41

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(41,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 41 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L41

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(41,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 41 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L41

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(41,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

/// <summary>
/// Member variable for RunConfiguration settings.
/// </summary>
private static RunConfigurationSettings? s_runConfigurationSettings;

Check failure on line 46 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L46

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(46,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 46 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L46

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(46,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 46 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L46

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(46,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 46 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L46

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(46,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 46 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Release)

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L46

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(46,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 46 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L46

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(46,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 46 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L46

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(46,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 46 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L46

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(46,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

Check failure on line 46 in src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs#L46

src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.cs(46,5): error IDE0032: (NETCORE_ENGINEERING_TELEMETRY=Build) Use auto property (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0032)

/// <summary>
/// Initializes a new instance of the <see cref="MSTestSettings"/> class.
Expand Down
6 changes: 5 additions & 1 deletion src/Adapter/MSTestAdapter.PlatformServices/NopTraceLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter;

internal sealed class NopTraceLogger : MarshalByRefObject, ITraceLogger
internal sealed class NopTraceLogger :
#if NETFRAMEWORK
MarshalByRefObject,
#endif
ITraceLogger
{
private NopTraceLogger()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel;

#if NETFRAMEWORK
[Serializable]
#endif
internal sealed class StackTraceInformation
{
public StackTraceInformation(string stackTrace)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel;

#if NETFRAMEWORK
[Serializable]
#endif
internal sealed class TestAssemblySettings
{
public TestAssemblySettings() => Workers = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel;
/// <summary>
/// TestMethod contains information about a unit test method that needs to be executed.
/// </summary>
#if NETFRAMEWORK
[Serializable]
#endif
internal sealed class TestMethod : ITestMethod
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel;
/// <summary>
/// The unit test element.
/// </summary>
#if NETFRAMEWORK
[Serializable]
#endif
[DebuggerDisplay("{TestMethod.DisplayName} ({TestMethod.ManagedTypeName})")]
internal sealed class UnitTestElement
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if !WINDOWS_UWP
#if NETFRAMEWORK
using System.Security;
#endif

namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices;

Expand All @@ -18,9 +20,14 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices;
///
/// For each directory we need to have two info 1) path 2) includeSubDirectories.
/// </summary>
#if NETFRAMEWORK
[Serializable]
#endif
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1603:DocumentationMustContainValidXml", Justification = "Reviewed. Suppression is ok here.")]
internal sealed class RecursiveDirectoryPath : MarshalByRefObject
internal sealed class RecursiveDirectoryPath
#if NETFRAMEWORK
: MarshalByRefObject
#endif
{
/// <summary>
/// Initializes a new instance of the <see cref="RecursiveDirectoryPath"/> class.
Expand All @@ -45,16 +52,15 @@ public RecursiveDirectoryPath(string dirPath, bool includeSubDirectories)
/// </summary>
public bool IncludeSubDirectories { get; private set; }

#if NETFRAMEWORK
/// <summary>
/// Returns object to be used for controlling lifetime, null means infinite lifetime.
/// </summary>
/// <returns>
/// The <see cref="object"/>.
/// </returns>
[SecurityCritical]
#if NET5_0_OR_GREATER
[Obsolete("MarshalByRefObject.InitializeLifetimeService is obsolete in .NET 5+. This override is required to maintain infinite lifetime service.")]
#endif
public override object InitializeLifetimeService() => null!;
#endif
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting;
/// <summary>
/// TestResult object to be returned to adapter.
/// </summary>
#if NETFRAMEWORK
[Serializable]
#endif
Comment thread
Evangelink marked this conversation as resolved.
public class TestResult
{
/// <summary>
Expand Down
Loading