Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<ModernUwpMinimum>net9.0-windows10.0.17763.0</ModernUwpMinimum>
<WinUiMinimum>net8.0-windows10.0.18362.0</WinUiMinimum>

<SupportedNetFrameworks>net8.0;net9.0</SupportedNetFrameworks>
<SupportedNetFrameworks>net8.0;net10.0</SupportedNetFrameworks>
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SupportedNetFrameworks is changed from net8.0;net9.0 to net8.0;net10.0, which drops the net9.0 build across projects that use this property (and adds a net10.0 build requirement). If net9.0 support is still intended, consider keeping it here or clarifying/updating the PR description/TFM strategy accordingly.

Copilot uses AI. Check for mistakes.
</PropertyGroup>

<!-- Build config -->
Expand Down
20 changes: 10 additions & 10 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.26229.1">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.26230.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>3ed6c23fee67b840de0fb5473ea6a95fc667b0a9</Sha>
<Sha>8a7b2d3d39078db20f33067c7929b88fdff4ee63</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Templating" Version="11.0.0-beta.26229.1">
<Dependency Name="Microsoft.DotNet.Build.Tasks.Templating" Version="11.0.0-beta.26230.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>3ed6c23fee67b840de0fb5473ea6a95fc667b0a9</Sha>
<Sha>8a7b2d3d39078db20f33067c7929b88fdff4ee63</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="11.0.0-beta.26229.1">
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="11.0.0-beta.26230.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>3ed6c23fee67b840de0fb5473ea6a95fc667b0a9</Sha>
<Sha>8a7b2d3d39078db20f33067c7929b88fdff4ee63</Sha>
</Dependency>
<Dependency Name="Microsoft.Testing.Extensions.CodeCoverage" Version="18.8.0-preview.26229.1">
<Uri>https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage</Uri>
<Sha>6b29c14c934bae1e26c21961b7e5ad1a25c4d3c5</Sha>
</Dependency>
<Dependency Name="MSTest" Version="4.3.0-preview.26229.1">
<Dependency Name="MSTest" Version="4.3.0-preview.26230.4">
<Uri>https://github.com/microsoft/testfx</Uri>
<Sha>0da10c24091f1ad35610ac05dd5aa7bd3ea79dd5</Sha>
<Sha>e6af9df44f1c17bcae2798b15388641609add3a3</Sha>
</Dependency>
<Dependency Name="Microsoft.Testing.Platform" Version="2.3.0-preview.26229.1">
<Dependency Name="Microsoft.Testing.Platform" Version="2.3.0-preview.26230.4">
<Uri>https://github.com/microsoft/testfx</Uri>
<Sha>0da10c24091f1ad35610ac05dd5aa7bd3ea79dd5</Sha>
<Sha>e6af9df44f1c17bcae2798b15388641609add3a3</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
6 changes: 3 additions & 3 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
</PropertyGroup>
<PropertyGroup Label="MSTest prod dependencies - darc updated">
<MicrosoftDotNetBuildTasksTemplatingPackageVersion>11.0.0-beta.26229.1</MicrosoftDotNetBuildTasksTemplatingPackageVersion>
<MicrosoftDotNetBuildTasksTemplatingPackageVersion>11.0.0-beta.26230.2</MicrosoftDotNetBuildTasksTemplatingPackageVersion>
<MicrosoftTestingExtensionsCodeCoverageVersion>18.8.0-preview.26229.1</MicrosoftTestingExtensionsCodeCoverageVersion>
<!-- empty line to avoid merge conflicts for darc PRs to update CC and MSTest+MTP -->
<MSTestVersion>4.3.0-preview.26229.1</MSTestVersion>
<MicrosoftTestingPlatformVersion>2.3.0-preview.26229.1</MicrosoftTestingPlatformVersion>
<MSTestVersion>4.3.0-preview.26230.4</MSTestVersion>
<MicrosoftTestingPlatformVersion>2.3.0-preview.26230.4</MicrosoftTestingPlatformVersion>
</PropertyGroup>
</Project>
5 changes: 5 additions & 0 deletions eng/common/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# `eng/common`

Files under `eng/common` come from [Arcade](https://github.com/dotnet/arcade).
Edits in `eng/common` will be overwritten by automation unless the changes are made directly in the Arcade repository.
For more information, see the [Arcade documentation](https://github.com/dotnet/arcade/tree/main/Documentation).
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"runner": "Microsoft.Testing.Platform"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26229.1",
"Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26230.2",
"MSBuild.Sdk.Extras": "3.0.44"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discove

internal void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink, IConfiguration? configuration, bool isMTP)
{
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(sources);
ArgumentNullException.ThrowIfNull(logger);
ArgumentNullException.ThrowIfNull(discoverySink);
#else
if (sources is null)
{
throw new ArgumentNullException(nameof(sources));
Expand All @@ -57,6 +62,7 @@ internal void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext disco
{
throw new ArgumentNullException(nameof(discoverySink));
}
#endif

if (MSTestDiscovererHelpers.InitializeDiscovery(sources, discoveryContext, logger, configuration, _testSourceHandler))
{
Expand Down
10 changes: 10 additions & 0 deletions src/Adapter/MSTest.TestAdapter/VSTestAdapter/MSTestExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ internal async Task RunTestsAsync(IEnumerable<TestCase>? tests, IRunContext? run
PlatformServiceProvider.Instance.AdapterTraceLogger.Info("MSTestExecutor.RunTests: Running tests from testcases.");
}

#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(frameworkHandle);
ArgumentNullException.ThrowIfNull(tests);
#else
if (frameworkHandle is null)
{
throw new ArgumentNullException(nameof(frameworkHandle));
Expand All @@ -112,6 +116,7 @@ internal async Task RunTestsAsync(IEnumerable<TestCase>? tests, IRunContext? run
{
throw new ArgumentNullException(nameof(tests));
}
#endif

Ensure.NotEmpty(tests);

Expand All @@ -130,6 +135,10 @@ internal async Task RunTestsAsync(IEnumerable<string>? sources, IRunContext? run
PlatformServiceProvider.Instance.AdapterTraceLogger.Info("MSTestExecutor.RunTests: Running tests from sources.");
}

#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(frameworkHandle);
ArgumentNullException.ThrowIfNull(sources);
#else
if (frameworkHandle is null)
{
throw new ArgumentNullException(nameof(frameworkHandle));
Expand All @@ -140,6 +149,7 @@ internal async Task RunTestsAsync(IEnumerable<string>? sources, IRunContext? run
{
throw new ArgumentNullException(nameof(sources));
}
#endif

Ensure.NotEmpty(sources);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,57 @@
using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
#if NET8_0_OR_GREATER
using System.Runtime.CompilerServices;

Check failure on line 9 in src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs#L9

src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs(9,1): error SA1516: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directives should be separated by blank line (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1516.md)

Check failure on line 9 in src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs#L9

src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs(9,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 9 in src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs#L9

src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs(9,1): error SA1516: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directives should be separated by blank line (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1516.md)

Check failure on line 9 in src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Release)

src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs#L9

src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs(9,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 9 in src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs#L9

src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs(9,1): error SA1516: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directives should be separated by blank line (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1516.md)

Check failure on line 9 in src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs#L9

src/Adapter/MSTestAdapter.PlatformServices/Execution/ClassCleanupManager.cs(9,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)
using System.Runtime.InteropServices;
#endif

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

internal sealed class ClassCleanupManager
{
private readonly ConcurrentDictionary<string, int> _remainingTestCountsByClass;
#if NET9_0_OR_GREATER
private readonly Lock _lock = new();
#else
private readonly object _lock = new();
#endif
private readonly Dictionary<string, int> _remainingTestCountsByClass;

public ClassCleanupManager(IEnumerable<UnitTestElement> testsToRun)
{
_remainingTestCountsByClass =
new(testsToRun.GroupBy(t => t.TestMethod.FullClassName)
testsToRun.GroupBy(t => t.TestMethod.FullClassName)
.ToDictionary(
g => g.Key,
g => g.Count()));
g => g.Count());
}

public bool ShouldRunEndOfAssemblyCleanup => _remainingTestCountsByClass.IsEmpty;
public bool ShouldRunEndOfAssemblyCleanup
{
get
{
lock (_lock)
{
return _remainingTestCountsByClass.Count == 0;
}
}
}

public void MarkTestComplete(TestMethod testMethod, out bool isLastTestInClass)
{
lock (_remainingTestCountsByClass)
lock (_lock)
{
#if NET8_0_OR_GREATER
ref int remainingCount = ref CollectionsMarshal.GetValueRefOrNullRef(
_remainingTestCountsByClass, testMethod.FullClassName);
if (Unsafe.IsNullRef(ref remainingCount))
{
throw ApplicationStateGuard.Unreachable();
}

remainingCount--;
isLastTestInClass = remainingCount == 0;
#else
if (!_remainingTestCountsByClass.TryGetValue(testMethod.FullClassName, out int remainingCount))
{
throw ApplicationStateGuard.Unreachable();
Expand All @@ -35,20 +64,23 @@
remainingCount--;
_remainingTestCountsByClass[testMethod.FullClassName] = remainingCount;
isLastTestInClass = remainingCount == 0;
#endif
}
}

public void MarkClassComplete(string fullClassName)
{
lock (_remainingTestCountsByClass)
lock (_lock)
{
if (!_remainingTestCountsByClass.TryRemove(fullClassName, out int remainingTests) ||
if (!_remainingTestCountsByClass.TryGetValue(fullClassName, out int remainingTests) ||
remainingTests != 0)
{
// We failed to remove the class, or we are incorrectly marking the class as complete while there are remaining tests.
// We failed to find the class, or we are incorrectly marking the class as complete while there are remaining tests.
// This should never happen.
throw ApplicationStateGuard.Unreachable();
}

_remainingTestCountsByClass.Remove(fullClassName);
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
internal static class RandomId
{
private const string Pool = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
#if NET9_0_OR_GREATER
private static readonly Lock s_lock = new();
#else
private static readonly object s_lock = new();

Check failure on line 18 in src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs#L18

src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs(18,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: Prefix 's_' is not expected (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 18 in src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build Linux Debug)

src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs#L18

src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs(18,36): error SA1311: (NETCORE_ENGINEERING_TELEMETRY=Build) Static readonly fields should begin with upper-case letter (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md)

Check failure on line 18 in src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs#L18

src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs(18,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: Prefix 's_' is not expected (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 18 in src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx (Build MacOS Debug)

src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs#L18

src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs(18,36): error SA1311: (NETCORE_ENGINEERING_TELEMETRY=Build) Static readonly fields should begin with upper-case letter (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md)

Check failure on line 18 in src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs#L18

src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs(18,36): error IDE1006: (NETCORE_ENGINEERING_TELEMETRY=Build) Naming rule violation: Prefix 's_' is not expected (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide1006)

Check failure on line 18 in src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs

View check run for this annotation

Azure Pipelines / microsoft.testfx

src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs#L18

src/Platform/Microsoft.Testing.Extensions.Retry/RandomId.cs(18,36): error SA1311: (NETCORE_ENGINEERING_TELEMETRY=Build) Static readonly fields should begin with upper-case letter (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md)
#endif
private static readonly RandomNumberGenerator Rng = RandomNumberGenerator.Create();

/// <summary>
Expand All @@ -23,7 +28,7 @@
{
int poolLength = Pool.Length;
char[] id = new char[length];
lock (Pool)
lock (s_lock)
{
for (int idIndex = 0; idIndex < length; idIndex++)
{
Expand Down
26 changes: 26 additions & 0 deletions src/Platform/Microsoft.Testing.Platform/Logging/TypeNameHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#if NET8_0_OR_GREATER
using System.Collections.Frozen;
#endif

namespace Microsoft.Testing.Platform.Logging;

/// <summary>
Expand All @@ -11,6 +15,27 @@ internal static class TypeNameHelper
{
private const char DefaultNestedTypeDelimiter = '+';

#if NET8_0_OR_GREATER
private static readonly FrozenDictionary<Type, string> BuiltInTypeNames = new Dictionary<Type, string>
{
{ typeof(void), "void" },
{ typeof(bool), "bool" },
{ typeof(byte), "byte" },
{ typeof(char), "char" },
{ typeof(decimal), "decimal" },
{ typeof(double), "double" },
{ typeof(float), "float" },
{ typeof(int), "int" },
{ typeof(long), "long" },
{ typeof(object), "object" },
{ typeof(sbyte), "sbyte" },
{ typeof(short), "short" },
{ typeof(string), "string" },
{ typeof(uint), "uint" },
{ typeof(ulong), "ulong" },
{ typeof(ushort), "ushort" },
}.ToFrozenDictionary();
#else
private static readonly Dictionary<Type, string> BuiltInTypeNames = new()
{
{ typeof(void), "void" },
Expand All @@ -30,6 +55,7 @@ internal static class TypeNameHelper
{ typeof(ulong), "ulong" },
{ typeof(ushort), "ushort" },
};
#endif

/// <summary>
/// Pretty print a type name.
Expand Down
Loading
Loading