From ffdbd08c1802168ca63c2c65fe27c4b2f1af7f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 2 Jul 2024 11:31:48 +0200 Subject: [PATCH 01/94] Rebrand 17.12 (#5129) --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 76f8b0f8b1..a250a16560 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ is trying to parse that version and will consider any version with more than 4 `.` in it as invalid. --> true - 17.11.0 + 17.12.0 preview From a1f5a6500b8cfefa81adbb652a84ad0ba884c140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 2 Jul 2024 13:55:35 +0200 Subject: [PATCH 02/94] Fix output based test (#5130) --- .../DotnetTestMSBuildOutputTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetTestMSBuildOutputTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetTestMSBuildOutputTests.cs index 089bdc74a8..be90b6a18c 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetTestMSBuildOutputTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetTestMSBuildOutputTests.cs @@ -33,7 +33,7 @@ public void MSBuildLoggerCanBeEnabledByBuildPropertyAndDoesNotEatSpecialChars(Ru // C:\Users\nohwnd\AppData\Local\Temp\vstest\xvoVt\UnitTest1.cs(41): error VSTEST1: (FailingTest) SampleUnitTestProject.UnitTest1.FailingTest() Assert.AreEqual failed. Expected:<2>. Actual:<3>. [C:\Users\nohwnd\AppData\Local\Temp\vstest\xvoVt\SimpleTestProject.csproj::TargetFramework=net462] // C:\Users\nohwnd\AppData\Local\Temp\vstest\xvoVt\UnitTest1.cs(41): error VSTEST1: (FailingTest) SampleUnitTestProject.UnitTest1.FailingTest() Assert.AreEqual failed. Expected:<2>. Actual:<3>. [C:\Users\nohwnd\AppData\Local\Temp\vstest\xvoVt\SimpleTestProject.csproj::TargetFramework=netcoreapp3.1] - StdOutputContains("error VSTEST1: FailingTest ("); + StdOutputContains("error TESTERROR: FailingTest ("); StdOutputContains("): Error Message: Assert.AreEqual failed. Expected:<ğğğ𦮙我們剛才從𓋴𓅓𓏏𓇏𓇌𓀀>. Actual:."); StdOutputContains("at TerminalLoggerUnitTests.UnitTest1.FailingTest() in"); // We are sending those as low prio messages, they won't show up on screen but will be in binlog. From e12f577bc8f1688985c2a2d01ce6c699407055d3 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Mon, 8 Jul 2024 03:57:12 -0400 Subject: [PATCH 03/94] Dispose IDisosables in HtmlTransformer (#5099) There's two IDisposables being used in HtmlTransformer. We should Dispose() both of them. --- .../HtmlTransformer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs index 7fe340f3b2..af5313cf1b 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlTransformer.cs @@ -20,7 +20,8 @@ internal class HtmlTransformer : IHtmlTransformer public HtmlTransformer() { _xslTransform = new XslCompiledTransform(); - _xslTransform.Load(XmlReader.Create(GetType().Assembly.GetManifestResourceStream("Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.Html.xslt") ?? throw new InvalidOperationException(), new XmlReaderSettings { CheckCharacters = false })); + using var reader = XmlReader.Create(GetType().Assembly.GetManifestResourceStream("Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.Html.xslt") ?? throw new InvalidOperationException(), new XmlReaderSettings { CheckCharacters = false, CloseInput = true }); + _xslTransform.Load(reader); } /// From 3df6f8914bc4e0f0d39e9e06b319b29247cdd25b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Mon, 8 Jul 2024 17:34:06 +0200 Subject: [PATCH 04/94] Fallback to latest runtimeconfig when none is found (#5136) * Runtime config fallback * Revert playground --- eng/verify-nupkgs.ps1 | 4 ++-- .../Hosting/DotnetTestHostManager.cs | 5 +++++ .../Microsoft.TestPlatform.CLI.nuspec | 1 + .../Microsoft.TestPlatform.CLI.sourcebuild.nuspec | 2 ++ ...Microsoft.TestPlatform.CLI.sourcebuild.product.nuspec | 1 + .../Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec | 1 + temp/testhost/testhost-9.0.runtimeconfig.json | 9 +++++++++ 7 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 temp/testhost/testhost-9.0.runtimeconfig.json diff --git a/eng/verify-nupkgs.ps1 b/eng/verify-nupkgs.ps1 index c87d4ceaab..3bb7d9c3ee 100644 --- a/eng/verify-nupkgs.ps1 +++ b/eng/verify-nupkgs.ps1 @@ -19,9 +19,9 @@ function Verify-Nuget-Packages { $expectedNumOfFiles = @{ "Microsoft.CodeCoverage" = 59; "Microsoft.NET.Test.Sdk" = 15; - "Microsoft.TestPlatform" = 607; + "Microsoft.TestPlatform" = 608; "Microsoft.TestPlatform.Build" = 20; - "Microsoft.TestPlatform.CLI" = 470; + "Microsoft.TestPlatform.CLI" = 471; "Microsoft.TestPlatform.Extensions.TrxLogger" = 34; "Microsoft.TestPlatform.ObjectModel" = 92; "Microsoft.TestPlatform.AdapterUtilities" = 75; diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index b8e621f077..89c019556b 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -415,6 +415,11 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( // 2) making sure we still make the project executable (and so we actually do get runtimeconfig unless the user tries hard to not make the test and EXE). var suffix = _targetFramework.Version == "1.0.0.0" ? "latest" : $"{new Version(_targetFramework.Version).Major}.{new Version(_targetFramework.Version).Minor}"; var testhostRuntimeConfig = Path.Combine(Path.GetDirectoryName(testHostNextToRunner)!, $"testhost-{suffix}.runtimeconfig.json"); + if (!File.Exists(testhostRuntimeConfig)) + { + testhostRuntimeConfig = Path.Combine(Path.GetDirectoryName(testHostNextToRunner)!, $"testhost-latest.runtimeconfig.json"); + } + argsToAdd = " --runtimeconfig " + testhostRuntimeConfig.AddDoubleQuote(); args += argsToAdd; EqtTrace.Verbose("DotnetTestHostmanager: Adding {0} in args", argsToAdd); diff --git a/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.nuspec b/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.nuspec index 7af61c0a59..e5d37dcb48 100644 --- a/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.nuspec +++ b/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.nuspec @@ -45,6 +45,7 @@ + diff --git a/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.sourcebuild.nuspec b/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.sourcebuild.nuspec index 3f1469375e..163cd961fd 100644 --- a/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.sourcebuild.nuspec +++ b/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.sourcebuild.nuspec @@ -71,6 +71,8 @@ + + diff --git a/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.sourcebuild.product.nuspec b/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.sourcebuild.product.nuspec index 5541bce3eb..e53eaba922 100644 --- a/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.sourcebuild.product.nuspec +++ b/src/package/Microsoft.TestPlatform.CLI/Microsoft.TestPlatform.CLI.sourcebuild.product.nuspec @@ -44,6 +44,7 @@ + diff --git a/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec b/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec index 0903b475db..812cab1cfe 100644 --- a/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec +++ b/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec @@ -541,6 +541,7 @@ + diff --git a/temp/testhost/testhost-9.0.runtimeconfig.json b/temp/testhost/testhost-9.0.runtimeconfig.json new file mode 100644 index 0000000000..146e13202e --- /dev/null +++ b/temp/testhost/testhost-9.0.runtimeconfig.json @@ -0,0 +1,9 @@ +{ + "runtimeOptions": { + "tfm": "net9.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "9.0.0-preview.0" + } + } +} From 7082a4d128375b89d324a243e15f5b3f9d9dcbb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 9 Jul 2024 11:37:27 +0200 Subject: [PATCH 05/94] Verify architecture and version of produced exes (#5134) * Verify architecture and version of produced exes * Program files location * Skip exe architecture check --- eng/verify-nupkgs-exe-version.ps1 | 8 -- eng/verify-nupkgs-exe.ps1 | 90 ----------------- eng/verify-nupkgs.ps1 | 154 +++++++++++++++++++++++++++++- 3 files changed, 150 insertions(+), 102 deletions(-) delete mode 100644 eng/verify-nupkgs-exe-version.ps1 delete mode 100644 eng/verify-nupkgs-exe.ps1 diff --git a/eng/verify-nupkgs-exe-version.ps1 b/eng/verify-nupkgs-exe-version.ps1 deleted file mode 100644 index 7535b9aef3..0000000000 --- a/eng/verify-nupkgs-exe-version.ps1 +++ /dev/null @@ -1,8 +0,0 @@ -Get-ChildItem S:\p\vstest3\artifacts\packages\Debug\Shipping -Filter vstest.console.exe -Recurse -Force | ForEach-Object { - if ($_.VersionInfo.ProductVersion.Contains("+")) { - throw "Some files contain '+' in the ProductVersion, this breaks DTAAgent in AzDO." - } - else { - "$_ version $($_.VersionInfo.ProductVersion) is ok." - } -} \ No newline at end of file diff --git a/eng/verify-nupkgs-exe.ps1 b/eng/verify-nupkgs-exe.ps1 deleted file mode 100644 index 459a4dcb43..0000000000 --- a/eng/verify-nupkgs-exe.ps1 +++ /dev/null @@ -1,90 +0,0 @@ -$exclusions = @{ - "CodeCoverage\CodeCoverage.exe" = "x86" - "Dynamic Code Coverage Tools\CodeCoverage.exe" = "x86" - "amd64\CodeCoverage.exe" = "x64" - - "IntelliTrace.exe" = "x86" - "ProcessSnapshotCleanup.exe" = "x86-64" - "TDEnvCleanup.exe" = "x86" - - "TestPlatform\SettingsMigrator.exe" = "x86" - - "dump\DumpMinitool.exe" = "x86-64" - - "QTAgent32.exe" = "x86" - "QTAgent32_35.exe" = "x86" - "QTAgent32_40.exe" = "x86" - "QTDCAgent32.exe" = "x86" - - "V1\VSTestVideoRecorder.exe" = "x86" - "VideoRecorder\VSTestVideoRecorder.exe" = "x86" -} - -$errs = @() -Get-ChildItem S:\p\vstest3\artifacts\packages\Debug\Shipping -Filter *.exe -Recurse -Force | ForEach-Object { - $m = & "C:\Program Files\Microsoft Visual Studio\2022\IntPreview\VC\Tools\MSVC\14.38.32919\bin\HostX86\x86\dumpbin.exe" /headers $_.FullName | Select-String "machine \((.*)\)" - if (-not $m.Matches.Success) { - $err = "Did not find the platform of the exe $fullName)." - } - - $platform = $m.Matches.Groups[1].Value - $fullName = $_.FullName - $name = $_.Name - - if ("x86" -eq $platform) { - $corFlags = "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\CorFlags.exe" - $corFlagsOutput = & $corFlags $fullName - # this is an native x86 exe or a .net x86 that requires of prefers 32bit - $platform = if ($corFlagsOutput -like "*does not have a valid managed header*" -or $corFlagsOutput -like "*32BITREQ : 1*" -or $corFlagsOutput -like "*32BITPREF : 1*") { - # this is an native x86 exe or a .net x86 that requires of prefers 32bit - "x86" } else { - # this is a x86 executable that is built as AnyCpu and does not prefer 32-bit so it will run as x64 on 64-bit system. - "x86-64" } - } - - if (($pair = $exclusions.GetEnumerator() | Where-Object { $fullName -like "*$($_.Name)" })) { - if (1 -lt $($pair).Count) { - $err = "Too many paths matched the query, only one match is allowed. Matches: $($pair.Name)" - $errs += $err - Write-Host -ForegroundColor Red Error: $err - } - - if ($platform -ne $pair.Value) { - $err = "$fullName must have architecture $($pair.Value), but it was $platform." - $errs += $err - Write-Host -ForegroundColor Red Error: $err - } - } - elseif ("x86" -eq $platform) { - if ($name -notlike "*x86*") { - $err = "$fullName has architecture $platform, and must contain x86 in the name of the executable." - $errs += $err - Write-Host -ForegroundColor Red Error: $err - } - } - elseif ($platform -in "x64", "x86-64") { - if ($name -like "*x86*" -or $name -like "*arm64*") { - $err = "$fullName has architecture $platform, and must NOT contain x86 or arm64 in the name of the executable." - $errs += $err - Write-Host -ForegroundColor Red Error: $err - } - } - elseif ("arm64" -eq $platform) { - if ($name -notlike "*arm64*") { - $err = "$fullName has architecture $platform, and must contain arm64 in the name of the executable." - $errs += $err - Write-Host -ForegroundColor Red Error: $err - } - } - else { - $err = "$fullName has unknown architecture $platform." - $errs += $err - Write-Host -ForegroundColor Red $err - } - - "Success: $name is $platform - $fullName" -} - -if ($errs) { - throw "Fail!:`n$($errs -join "`n")" -} \ No newline at end of file diff --git a/eng/verify-nupkgs.ps1 b/eng/verify-nupkgs.ps1 index 3bb7d9c3ee..0b2dfce5f3 100644 --- a/eng/verify-nupkgs.ps1 +++ b/eng/verify-nupkgs.ps1 @@ -98,9 +98,9 @@ function Verify-Nuget-Packages { } } finally { - if ($null -ne $unzipNugetPackageDir -and (Test-Path $unzipNugetPackageDir)) { - Remove-Item -Force -Recurse $unzipNugetPackageDir | Out-Null - } + # if ($null -ne $unzipNugetPackageDir -and (Test-Path $unzipNugetPackageDir)) { + # Remove-Item -Force -Recurse $unzipNugetPackageDir | Out-Null + # } } } @@ -109,6 +109,7 @@ function Verify-Nuget-Packages { } Write-Host "Completed Verify-Nuget-Packages." + $unzipNugetPackageDirs } function Unzip { @@ -156,4 +157,149 @@ function Verify-Version { Match-VersionAgainstBranch -vsTestVersion $vsTestProductVersion -branchName $currentBranch -errors $errors } -Verify-Nuget-Packages +function Verify-NugetPackageExe { + param( + [Parameter(Mandatory)] + [ValidateSet("Debug", "Release")] + [string] $configuration, + $UnzipNugetPackages + ) + + + $exclusions = @{ + "CodeCoverage\CodeCoverage.exe" = "x86" + "Dynamic Code Coverage Tools\CodeCoverage.exe" = "x86" + "amd64\CodeCoverage.exe" = "x64" + + "IntelliTrace.exe" = "x86" + "ProcessSnapshotCleanup.exe" = "x86-64" + "TDEnvCleanup.exe" = "x86" + + "TestPlatform\SettingsMigrator.exe" = "x86" + + "dump\DumpMinitool.exe" = "x86-64" + + "QTAgent32.exe" = "x86" + "QTAgent32_35.exe" = "x86" + "QTAgent32_40.exe" = "x86" + "QTDCAgent32.exe" = "x86" + + "V1\VSTestVideoRecorder.exe" = "x86" + "VideoRecorder\VSTestVideoRecorder.exe" = "x86" + } + + $errs = @() + $exes = $UnzipNugetPackages | Get-ChildItem -Filter *.exe -Recurse -Force + if (0 -eq @($exes).Length) { + throw "No exe files were found." + } + + # use wow programfiles because they always point to x64 programfiles where VS is installed + $dumpBin = Get-ChildItem -Recurse -Force -Filter dumpbin.exe -path "$env:ProgramW6432\Microsoft Visual Studio\2022\Enterprise" | Select-Object -First 1 + if (-not $dumpBin) { + throw "Did not find dumpbin.exe in '$env:ProgramW6432\Microsoft Visual Studio\2022\Enterprise'." + } + + $corFlags = Get-ChildItem -Recurse -Force -Filter CorFlags.exe -path "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows" | Select-Object -First 1 + if (-not $corFlags) { + throw "Did not find CorFlags.exe in '${env:ProgramFiles(x86)}\Microsoft SDKs\Windows'." + } + + $exes | ForEach-Object { + $m = & $dumpBin /headers $_.FullName | Select-String "machine \((.*)\)" + if (-not $m.Matches.Success) { + $err = "Did not find the platform of the exe $fullName)." + } + + $platform = $m.Matches.Groups[1].Value + $fullName = $_.FullName + $name = $_.Name + + if ("x86" -eq $platform) { + $corFlagsOutput = & $corFlags $fullName + # this is an native x86 exe or a .net x86 that requires of prefers 32bit + $platform = if ($corFlagsOutput -like "*does not have a valid managed header*" -or $corFlagsOutput -like "*32BITREQ : 1*" -or $corFlagsOutput -like "*32BITPREF : 1*") { + # this is an native x86 exe or a .net x86 that requires of prefers 32bit + "x86" } else { + # this is a x86 executable that is built as AnyCpu and does not prefer 32-bit so it will run as x64 on 64-bit system. + "x86-64" } + } + + if (($pair = $exclusions.GetEnumerator() | Where-Object { $fullName -like "*$($_.Name)" })) { + if (1 -lt $($pair).Count) { + $err = "Too many paths matched the query, only one match is allowed. Matches: $($pair.Name)" + $errs += $err + Write-Host -ForegroundColor Red Error: $err + } + + if ($platform -ne $pair.Value) { + $err = "$fullName must have architecture $($pair.Value), but it was $platform." + $errs += $err + Write-Host -ForegroundColor Red Error: $err + } + } + elseif ("x86" -eq $platform) { + if ($name -notlike "*x86*") { + $err = "$fullName has architecture $platform, and must contain x86 in the name of the executable." + $errs += $err + Write-Host -ForegroundColor Red Error: $err + } + } + elseif ($platform -in "x64", "x86-64") { + if ($name -like "*x86*" -or $name -like "*arm64*") { + $err = "$fullName has architecture $platform, and must NOT contain x86 or arm64 in the name of the executable." + $errs += $err + Write-Host -ForegroundColor Red Error: $err + } + } + elseif ("arm64" -eq $platform) { + if ($name -notlike "*arm64*") { + $err = "$fullName has architecture $platform, and must contain arm64 in the name of the executable." + $errs += $err + Write-Host -ForegroundColor Red Error: $err + } + } + else { + $err = "$fullName has unknown architecture $platform." + $errs += $err + Write-Host -ForegroundColor Red $err + } + + "Success: $name is $platform - $fullName" + } + + if ($errs) { + throw "Fail!:`n$($errs -join "`n")" + } +} + +function Verify-NugetPackageVersion { + param( + [Parameter(Mandatory)] + [ValidateSet("Debug", "Release")] + [string] $configuration, + $UnzipNugetPackages + ) + + $exes = $UnzipNugetPackages | Get-ChildItem -Filter vstest.console.exe -Recurse -Force + if (0 -eq @($exes).Length) { + throw "No vstest.console.exe was found." + } + + $exes | ForEach-Object { + if ($_.VersionInfo.ProductVersion.Contains("+")) { + throw "Some files contain '+' in the ProductVersion, this breaks DTAAgent in AzDO." + } + else { + "$_ version $($_.VersionInfo.ProductVersion) is ok." + } + } + +} + + +$unzipNugetPackages = Verify-Nuget-Packages +Start-sleep -Seconds 10 +# skipped, it is hard to find the right dumpbin.exe and corflags tools on server +# Verify-NugetPackageExe -configuration $configuration -UnzipNugetPackages $unzipNugetPackages +Verify-NugetPackageVersion -configuration $configuration -UnzipNugetPackages $unzipNugetPackages From f5d6bbd73da8c5d5d78e7446b9f50b5e75b16b32 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 9 Jul 2024 13:44:01 +0200 Subject: [PATCH 06/94] [main] Update dependencies from dotnet/diagnostics (#5120) * Update dependencies from https://github.com/dotnet/diagnostics build 20240621.1 Microsoft.SourceBuild.Intermediate.diagnostics , Microsoft.Diagnostics.NETCore.Client From Version 8.0.0-preview.24307.1 -> To Version 8.0.0-preview.24321.1 * Update dependencies from https://github.com/dotnet/diagnostics build 20240628.1 Microsoft.SourceBuild.Intermediate.diagnostics , Microsoft.Diagnostics.NETCore.Client From Version 8.0.0-preview.24307.1 -> To Version 8.0.0-preview.24328.1 * Update dependencies from https://github.com/dotnet/diagnostics build 20240705.1 Microsoft.SourceBuild.Intermediate.diagnostics , Microsoft.Diagnostics.NETCore.Client From Version 8.0.0-preview.24307.1 -> To Version 8.0.0-preview.24355.1 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2c259d0cf4..39366adc4d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,14 +5,14 @@ https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage db16c1314168cbf73ba20ff4bc8f1256e9013b38 - + https://github.com/dotnet/diagnostics - 33d8bf23a6566cd3fb9055acfc9f1141391d5421 + bc0513ef320ee4e4d8c3981737975c18778c88bb - + https://github.com/dotnet/diagnostics - 33d8bf23a6566cd3fb9055acfc9f1141391d5421 + bc0513ef320ee4e4d8c3981737975c18778c88bb diff --git a/eng/Versions.props b/eng/Versions.props index a250a16560..42c8c210f9 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -35,7 +35,7 @@ 3.11.0-beta1.23525.2 3.11.0-beta1.23525.2 17.7.0 - 0.2.0-preview.24307.1 + 0.2.0-preview.24355.1 3.0.0 2.0.0 17.9.0-beta.24058.4 From 2f615348556adfd5c9a34665962fddbe76be0ede Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 9 Jul 2024 13:44:16 +0200 Subject: [PATCH 07/94] [main] Update dependencies from dotnet/source-build-reference-packages (#5125) * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240627.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24304.1 -> To Version 9.0.0-alpha.1.24327.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240702.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24304.1 -> To Version 9.0.0-alpha.1.24352.1 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 39366adc4d..9ac5a0e55a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -22,9 +22,9 @@ - + https://github.com/dotnet/source-build-reference-packages - 9ae78a4e6412926d19ba97cfed159bf9de70b538 + cc732c57199f725857c201da146525e3be6bc504 From 20fd1f19af411a0229cc950a20ee9a1250e4f182 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 9 Jul 2024 13:44:28 +0200 Subject: [PATCH 08/94] [main] Update dependencies from dotnet/source-build-externals (#5119) * Update dependencies from https://github.com/dotnet/source-build-externals build 20240620.1 Microsoft.SourceBuild.Intermediate.source-build-externals From Version 9.0.0-alpha.1.24303.2 -> To Version 9.0.0-alpha.1.24320.1 * Update dependencies from https://github.com/dotnet/source-build-externals build 20240624.1 Microsoft.SourceBuild.Intermediate.source-build-externals From Version 9.0.0-alpha.1.24303.2 -> To Version 9.0.0-alpha.1.24324.1 * Update dependencies from https://github.com/dotnet/source-build-externals build 20240624.1 Microsoft.SourceBuild.Intermediate.source-build-externals From Version 9.0.0-alpha.1.24303.2 -> To Version 9.0.0-alpha.1.24324.1 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9ac5a0e55a..1b2521c8af 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -16,9 +16,9 @@ - + https://github.com/dotnet/source-build-externals - 7db00527ef8fbbe61f67e9295beebddf187efff8 + 311ef7fef52828f4a70a94d13e32c394fd3292ee From 532e6ce9401a8c96c89dfbb3483ac568b1dc1d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 9 Jul 2024 14:50:30 +0200 Subject: [PATCH 09/94] Fix runtime config tests (#5137) --- .../Hosting/DotnetTestHostManager.cs | 2 +- .../Hosting/DotnetTestHostManagerTests.cs | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index 89c019556b..70c9481a8f 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -415,7 +415,7 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( // 2) making sure we still make the project executable (and so we actually do get runtimeconfig unless the user tries hard to not make the test and EXE). var suffix = _targetFramework.Version == "1.0.0.0" ? "latest" : $"{new Version(_targetFramework.Version).Major}.{new Version(_targetFramework.Version).Minor}"; var testhostRuntimeConfig = Path.Combine(Path.GetDirectoryName(testHostNextToRunner)!, $"testhost-{suffix}.runtimeconfig.json"); - if (!File.Exists(testhostRuntimeConfig)) + if (!_fileHelper.Exists(testhostRuntimeConfig)) { testhostRuntimeConfig = Path.Combine(Path.GetDirectoryName(testHostNextToRunner)!, $"testhost-latest.runtimeconfig.json"); } diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs index 130e3b4b6c..af5ee66ec3 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs @@ -669,14 +669,15 @@ public void GetTestHostProcessStartInfoShouldIncludeTestHostPathNextToTestRunner // we can't put in a "default" value, and we don't have other way to determine if this provided value is the // runtime default or the actual value that user provided, so right now the default will use the latest, instead // or the more correct 1.0, it should be okay, as that version is not supported anymore anyway - [DataRow("netcoreapp3.1", "3.1")] - [DataRow("net5.0", "5.0")] + [DataRow("netcoreapp3.1", "3.1", true)] + [DataRow("net5.0", "5.0", true)] // net6.0 is currently the latest released version, but it still has it's own runtime config, it is not the same as // "latest" which means the latest you have on system. So if you have only 5.0 SDK then net6.0 will fail because it can't find net6.0, // but latest would use net5.0 because that is the latest one on your system. - [DataRow("net6.0", "6.0")] - public void GetTestHostProcessStartInfoShouldIncludeTestHostPathNextToTestRunnerIfTesthostDllIsNoFoundAndDepsFileNotFoundWithTheCorrectTfm(string tfm, string suffix) + [DataRow("net6.0", "6.0", true)] + [DataRow("net6.0", "latest", false)] + public void GetTestHostProcessStartInfoShouldIncludeTestHostPathNextToTestRunnerIfTesthostDllIsNoFoundAndDepsFileNotFoundWithTheCorrectTfm(string tfm, string suffix, bool runtimeConfigExists) { // Absolute path to the source directory var sourcePath = Path.Combine(_temp, "test.dll"); @@ -687,6 +688,8 @@ public void GetTestHostProcessStartInfoShouldIncludeTestHostPathNextToTestRunner var testhostNextToRunner = Path.Combine(here, "testhost.dll"); _mockFileHelper.Setup(ph => ph.Exists(testhostNextToRunner)).Returns(true); + _mockFileHelper.Setup(ph => ph.Exists(It.Is(s => s.Contains($"{suffix}.runtimeconfig.json")))).Returns(runtimeConfigExists); + _dotnetHostManager.Initialize(_mockMessageLogger.Object, $"{tfm}"); var startInfo = _dotnetHostManager.GetTestHostProcessStartInfo(new[] { sourcePath }, null, _defaultConnectionInfo); From 0a598966d620ad746be971f6df3d8985ef74178a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 10 Jul 2024 08:41:39 +0200 Subject: [PATCH 10/94] Dispose helper when parsing args (#5126) * Dispose helper when parsing args * Install script web is down --- eng/common/tools.ps1 | 2 +- eng/common/tools.sh | 2 +- src/vstest.console/InProcessVsTestConsoleWrapper.cs | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 0febe696db..2cae35007a 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -262,7 +262,7 @@ function GetDotNetInstallScript([string] $dotnetRoot) { if (!(Test-Path $installScript)) { Create-Directory $dotnetRoot $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit - $uri = "https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.ps1" + $uri = "https://raw.githubusercontent.com/dotnet/install-scripts/main/src/dotnet-install.ps1" Retry({ Write-Host "GET $uri" diff --git a/eng/common/tools.sh b/eng/common/tools.sh index a4f5d1b776..03bb934a90 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -295,7 +295,7 @@ function with_retries { function GetDotNetInstallScript { local root=$1 local install_script="$root/dotnet-install.sh" - local install_script_url="https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.sh" + local install_script_url="https://raw.githubusercontent.com/dotnet/install-scripts/main/src/dotnet-install.sh" if [[ ! -a "$install_script" ]]; then mkdir -p "$root" diff --git a/src/vstest.console/InProcessVsTestConsoleWrapper.cs b/src/vstest.console/InProcessVsTestConsoleWrapper.cs index 8ba865f64c..5dbdd0ea61 100644 --- a/src/vstest.console/InProcessVsTestConsoleWrapper.cs +++ b/src/vstest.console/InProcessVsTestConsoleWrapper.cs @@ -126,7 +126,8 @@ internal InProcessVsTestConsoleWrapper( ProcessHelper.ExternalEnvironmentVariables = environmentVariableBaseline; string someExistingFile = typeof(InProcessVsTestConsoleWrapper).Assembly.Location; - var args = new VsTestConsoleProcessManager(someExistingFile).BuildArguments(consoleParameters); + using var manager = new VsTestConsoleProcessManager(someExistingFile); + var args = manager.BuildArguments(consoleParameters); // Skip vstest.console path, we are already running in process, so it would just end up // being understood as test dll to run. (it is present even though we don't provide // dotnet path, because it is a .dll file). From 3a6c0614132707c9bb6a182777317cfcac143649 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 10 Jul 2024 11:08:24 +0200 Subject: [PATCH 11/94] [main] Update dependencies from dotnet/arcade (#5118) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update dependencies from https://github.com/dotnet/arcade build 20240621.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24306.4 -> To Version 9.0.0-beta.24321.4 * Update dependencies from https://github.com/dotnet/arcade build 20240627.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24306.4 -> To Version 9.0.0-beta.24327.1 * Update dependencies from https://github.com/dotnet/arcade build 20240627.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24306.4 -> To Version 9.0.0-beta.24327.1 * Update dependencies from https://github.com/dotnet/arcade build 20240702.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24306.4 -> To Version 9.0.0-beta.24352.2 * Add arcade issue workaround * add arcade issue workaround * add arcade issue workaround --------- Co-authored-by: dotnet-maestro[bot] Co-authored-by: Jakub Jareš --- Directory.Build.targets | 6 +- eng/Version.Details.xml | 12 +- eng/common/SetupNugetSources.ps1 | 143 ++++++++++-------- eng/common/SetupNugetSources.sh | 2 +- eng/common/core-templates/job/job.yml | 24 +-- .../job/publish-build-assets.yml | 16 +- .../job/source-index-stage1.yml | 16 +- .../post-build/common-variables.yml | 2 - .../core-templates/post-build/post-build.yml | 8 +- .../post-build/setup-maestro-vars.yml | 30 ++-- .../steps/component-governance.yml | 6 +- .../steps/enable-internal-sources.yml | 50 +++--- .../core-templates/steps/source-build.yml | 10 +- eng/common/cross/arm/sources.list.bionic | 11 -- eng/common/cross/arm/sources.list.focal | 11 -- eng/common/cross/arm/sources.list.jammy | 11 -- eng/common/cross/arm/sources.list.jessie | 3 - eng/common/cross/arm/sources.list.xenial | 11 -- eng/common/cross/arm/sources.list.zesty | 11 -- eng/common/cross/arm64/sources.list.bionic | 11 -- eng/common/cross/arm64/sources.list.buster | 11 -- eng/common/cross/arm64/sources.list.focal | 11 -- eng/common/cross/arm64/sources.list.jammy | 11 -- eng/common/cross/arm64/sources.list.stretch | 12 -- eng/common/cross/arm64/sources.list.xenial | 11 -- eng/common/cross/arm64/sources.list.zesty | 11 -- eng/common/cross/armel/sources.list.jessie | 3 - eng/common/cross/armv6/sources.list.bookworm | 2 - eng/common/cross/armv6/sources.list.buster | 2 - eng/common/cross/build-rootfs.sh | 46 ++++-- eng/common/cross/ppc64le/sources.list.bionic | 11 -- eng/common/cross/riscv64/sources.list.sid | 1 - eng/common/cross/s390x/sources.list.bionic | 11 -- eng/common/cross/x64/sources.list.bionic | 11 -- eng/common/cross/x64/sources.list.xenial | 11 -- eng/common/cross/x86/sources.list.bionic | 11 -- eng/common/cross/x86/sources.list.focal | 11 -- eng/common/cross/x86/sources.list.jammy | 11 -- eng/common/cross/x86/sources.list.xenial | 11 -- eng/common/dotnet-install.sh | 3 + eng/common/native/CommonLibrary.psm1 | 3 +- eng/common/post-build/nuget-validation.ps1 | 7 + eng/common/post-build/publish-using-darc.ps1 | 15 +- eng/common/templates/job/job.yml | 26 ++++ eng/common/tools.ps1 | 2 +- eng/common/tools.sh | 8 +- global.json | 6 +- 47 files changed, 260 insertions(+), 413 deletions(-) delete mode 100644 eng/common/cross/arm/sources.list.bionic delete mode 100644 eng/common/cross/arm/sources.list.focal delete mode 100644 eng/common/cross/arm/sources.list.jammy delete mode 100644 eng/common/cross/arm/sources.list.jessie delete mode 100644 eng/common/cross/arm/sources.list.xenial delete mode 100644 eng/common/cross/arm/sources.list.zesty delete mode 100644 eng/common/cross/arm64/sources.list.bionic delete mode 100644 eng/common/cross/arm64/sources.list.buster delete mode 100644 eng/common/cross/arm64/sources.list.focal delete mode 100644 eng/common/cross/arm64/sources.list.jammy delete mode 100644 eng/common/cross/arm64/sources.list.stretch delete mode 100644 eng/common/cross/arm64/sources.list.xenial delete mode 100644 eng/common/cross/arm64/sources.list.zesty delete mode 100644 eng/common/cross/armel/sources.list.jessie delete mode 100644 eng/common/cross/armv6/sources.list.bookworm delete mode 100644 eng/common/cross/armv6/sources.list.buster delete mode 100644 eng/common/cross/ppc64le/sources.list.bionic delete mode 100644 eng/common/cross/riscv64/sources.list.sid delete mode 100644 eng/common/cross/s390x/sources.list.bionic delete mode 100644 eng/common/cross/x64/sources.list.bionic delete mode 100644 eng/common/cross/x64/sources.list.xenial delete mode 100644 eng/common/cross/x86/sources.list.bionic delete mode 100644 eng/common/cross/x86/sources.list.focal delete mode 100644 eng/common/cross/x86/sources.list.jammy delete mode 100644 eng/common/cross/x86/sources.list.xenial diff --git a/Directory.Build.targets b/Directory.Build.targets index d38dee58b5..5aee4dd768 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,6 +1,10 @@ - + + + <_NetFrameworkHostedCompilersVersion Condition="'$(_NetFrameworkHostedCompilersVersion)' == ''">4.11.0-3.24280.3 + + - + https://github.com/dotnet/arcade - 7507f80c8db285bbc9939c1dff522a761cf4edc0 + 4a7d983f833d6b86365ea1b2b4d6ee72fbdbf944 @@ -62,9 +62,9 @@ https://github.com/dotnet/symreader-converter c5ba7c88f92e2dde156c324a8c8edc04d9fa4fe0 - + https://github.com/dotnet/arcade - 7507f80c8db285bbc9939c1dff522a761cf4edc0 + 4a7d983f833d6b86365ea1b2b4d6ee72fbdbf944 diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index c07f6a5260..2b0a5c9e66 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -1,32 +1,31 @@ # This script adds internal feeds required to build commits that depend on internal package sources. For instance, # dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. In addition also enables # disabled internal Maestro (darc-int*) feeds. -# -# Optionally, this script also adds a credential entry for each of the internal feeds if supplied. This credential -# is added via the standard environment variable VSS_NUGET_EXTERNAL_FEED_ENDPOINTS. See -# https://github.com/microsoft/artifacts-credprovider/tree/v1.1.1?tab=readme-ov-file#environment-variables for more details +# +# Optionally, this script also adds a credential entry for each of the internal feeds if supplied. # # See example call for this script below. # # - task: PowerShell@2 -# displayName: Setup Internal Feeds +# displayName: Setup Private Feeds Credentials # condition: eq(variables['Agent.OS'], 'Windows_NT') # inputs: # filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 -# arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -# - task: NuGetAuthenticate@1 -# +# arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token +# env: +# Token: $(dn-bot-dnceng-artifact-feeds-rw) +# # Note that the NuGetAuthenticate task should be called after SetupNugetSources. # This ensures that: # - Appropriate creds are set for the added internal feeds (if not supplied to the scrupt) -# - The credential provider is installed +# - The credential provider is installed. # # This logic is also abstracted into enable-internal-sources.yml. [CmdletBinding()] param ( [Parameter(Mandatory = $true)][string]$ConfigFile, - [string]$Password + $Password ) $ErrorActionPreference = "Stop" @@ -35,23 +34,12 @@ Set-StrictMode -Version 2.0 . $PSScriptRoot\tools.ps1 -$feedEndpoints = $null - -# If a credential is provided, ensure that we don't overwrite the current set of -# credentials that may have been provided by a previous call to the credential provider. -if ($Password -and $null -ne $env:VSS_NUGET_EXTERNAL_FEED_ENDPOINTS) { - $feedEndpoints = $env:VSS_NUGET_EXTERNAL_FEED_ENDPOINTS | ConvertFrom-Json -} elseif ($Password) { - $feedEndpoints = @{ endpointCredentials = @() } -} - # Add source entry to PackageSources -function AddPackageSource($sources, $SourceName, $SourceEndPoint, $pwd) { +function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $pwd) { $packageSource = $sources.SelectSingleNode("add[@key='$SourceName']") - if ($null -eq $packageSource) + if ($packageSource -eq $null) { - Write-Host "`tAdding package source" $SourceName $packageSource = $doc.CreateElement("add") $packageSource.SetAttribute("key", $SourceName) $packageSource.SetAttribute("value", $SourceEndPoint) @@ -61,33 +49,63 @@ function AddPackageSource($sources, $SourceName, $SourceEndPoint, $pwd) { Write-Host "Package source $SourceName already present." } - if ($pwd) { - $feedEndpoints.endpointCredentials = AddCredential -endpointCredentials $feedEndpoints.endpointCredentials -source $SourceEndPoint -pwd $pwd - } + AddCredential -Creds $creds -Source $SourceName -Username $Username -pwd $pwd } -# Add a new feed endpoint credential -function AddCredential([array]$endpointCredentials, $source, $pwd) { - $endpointCredentials += @{ - endpoint = $source; - password = $pwd +# Add a credential node for the specified source +function AddCredential($creds, $source, $username, $pwd) { + # If no cred supplied, don't do anything. + if (!$pwd) { + return; } - return $endpointCredentials + + # Looks for credential configuration for the given SourceName. Create it if none is found. + $sourceElement = $creds.SelectSingleNode($Source) + if ($sourceElement -eq $null) + { + $sourceElement = $doc.CreateElement($Source) + $creds.AppendChild($sourceElement) | Out-Null + } + + # Add the node to the credential if none is found. + $usernameElement = $sourceElement.SelectSingleNode("add[@key='Username']") + if ($usernameElement -eq $null) + { + $usernameElement = $doc.CreateElement("add") + $usernameElement.SetAttribute("key", "Username") + $sourceElement.AppendChild($usernameElement) | Out-Null + } + $usernameElement.SetAttribute("value", $Username) + + # Add the to the credential if none is found. + # Add it as a clear text because there is no support for encrypted ones in non-windows .Net SDKs. + # -> https://github.com/NuGet/Home/issues/5526 + $passwordElement = $sourceElement.SelectSingleNode("add[@key='ClearTextPassword']") + if ($passwordElement -eq $null) + { + $passwordElement = $doc.CreateElement("add") + $passwordElement.SetAttribute("key", "ClearTextPassword") + $sourceElement.AppendChild($passwordElement) | Out-Null + } + + $passwordElement.SetAttribute("value", $pwd) } -function InsertMaestroInternalFeedCredentials($Sources, $pwd) { - $maestroInternalSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]") +function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $pwd) { + $maestroPrivateSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]") - ForEach ($PackageSource in $maestroInternalSources) { - Write-Host "`tAdding credential for Maestro's feed:" $PackageSource.Key - $feedEndpoints.endpointCredentials = AddCredential -endpointCredentials $feedEndpoints.endpointCredentials -source $PackageSource.value -pwd $pwd + Write-Host "Inserting credentials for $($maestroPrivateSources.Count) Maestro's private feeds." + + ForEach ($PackageSource in $maestroPrivateSources) { + Write-Host "`tInserting credential for Maestro's feed:" $PackageSource.Key + AddCredential -Creds $creds -Source $PackageSource.Key -Username $Username -pwd $pwd } } -function EnableInternalPackageSources($DisabledPackageSources) { - $maestroInternalSources = $DisabledPackageSources.SelectNodes("add[contains(@key,'darc-int')]") - ForEach ($DisabledPackageSource in $maestroInternalSources) { - Write-Host "`tEnsuring internal source '$($DisabledPackageSource.key)' is enabled by deleting it from disabledPackageSource" +function EnablePrivatePackageSources($DisabledPackageSources) { + $maestroPrivateSources = $DisabledPackageSources.SelectNodes("add[contains(@key,'darc-int')]") + ForEach ($DisabledPackageSource in $maestroPrivateSources) { + Write-Host "`tEnsuring private source '$($DisabledPackageSource.key)' is enabled by deleting it from disabledPackageSource" # Due to https://github.com/NuGet/Home/issues/10291, we must actually remove the disabled entries $DisabledPackageSources.RemoveChild($DisabledPackageSource) } @@ -105,27 +123,38 @@ $doc.Load($filename) # Get reference to or create one if none exist already $sources = $doc.DocumentElement.SelectSingleNode("packageSources") -if ($null -eq $sources) { +if ($sources -eq $null) { $sources = $doc.CreateElement("packageSources") $doc.DocumentElement.AppendChild($sources) | Out-Null } +$creds = $null +if ($Password) { + # Looks for a node. Create it if none is found. + $creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials") + if ($creds -eq $null) { + $creds = $doc.CreateElement("packageSourceCredentials") + $doc.DocumentElement.AppendChild($creds) | Out-Null + } +} + # Check for disabledPackageSources; we'll enable any darc-int ones we find there $disabledSources = $doc.DocumentElement.SelectSingleNode("disabledPackageSources") -if ($null -ne $disabledSources) { +if ($disabledSources -ne $null) { Write-Host "Checking for any darc-int disabled package sources in the disabledPackageSources node" - EnableInternalPackageSources -DisabledPackageSources $disabledSources + EnablePrivatePackageSources -DisabledPackageSources $disabledSources } -if ($Password) { - InsertMaestroInternalFeedCredentials -Sources $sources -pwd $Password -} +$userName = "dn-bot" + +# Insert credential nodes for Maestro's private feeds +InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Username $userName -pwd $Password # 3.1 uses a different feed url format so it's handled differently here $dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']") -if ($null -ne $dotnet31Source) { - AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v3/index.json" -pwd $Password - AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v3/index.json" -pwd $Password +if ($dotnet31Source -ne $null) { + AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username $userName -pwd $Password + AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password } $dotnetVersions = @('5','6','7','8') @@ -133,18 +162,10 @@ $dotnetVersions = @('5','6','7','8') foreach ($dotnetVersion in $dotnetVersions) { $feedPrefix = "dotnet" + $dotnetVersion; $dotnetSource = $sources.SelectSingleNode("add[@key='$feedPrefix']") - if ($dotnetSource) { - AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedprefix-internal/nuget/v3/index.json" -pwd $Password - AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal-transport/nuget/v3/index.json" -pwd $Password + if ($dotnetSource -ne $null) { + AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal/nuget/v2" -Creds $creds -Username $userName -pwd $Password + AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password } } $doc.Save($filename) - -# If any credentials were added or altered, update the VSS_NUGET_EXTERNAL_FEED_ENDPOINTS environment variable -if ($null -ne $feedEndpoints) { - # ci is set to true so vso logging commands will be used. - $ci = $true - Write-PipelineSetVariable -Name 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' -Value $($feedEndpoints | ConvertTo-Json) -IsMultiJobVariable $false - Write-PipelineSetVariable -Name 'NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED' -Value "False" -IsMultiJobVariable $false -} \ No newline at end of file diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index 16c1e29ea3..b493479a1d 100644 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# This script adds internal feeds required to build commits that depend on intenral package sources. For instance, +# This script adds internal feeds required to build commits that depend on internal package sources. For instance, # dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. In addition also enables # disabled internal Maestro (darc-int*) feeds. # diff --git a/eng/common/core-templates/job/job.yml b/eng/common/core-templates/job/job.yml index 7df5852797..c732bee9f4 100644 --- a/eng/common/core-templates/job/job.yml +++ b/eng/common/core-templates/job/job.yml @@ -24,12 +24,11 @@ parameters: enablePublishTestResults: false enablePublishUsingPipelines: false enableBuildRetry: false - disableComponentGovernance: '' - componentGovernanceIgnoreDirectories: '' mergeTestResults: false testRunTitle: '' testResultsFormat: '' name: '' + componentGovernanceSteps: [] preSteps: [] artifactPublishSteps: [] runAsPublic: false @@ -170,17 +169,8 @@ jobs: uploadRichNavArtifacts: ${{ coalesce(parameters.richCodeNavigationUploadArtifacts, false) }} continueOnError: true - - template: /eng/common/core-templates/steps/component-governance.yml - parameters: - is1ESPipeline: ${{ parameters.is1ESPipeline }} - ${{ if eq(parameters.disableComponentGovernance, '') }}: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: - disableComponentGovernance: false - ${{ else }}: - disableComponentGovernance: true - ${{ else }}: - disableComponentGovernance: ${{ parameters.disableComponentGovernance }} - componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} + - ${{ each step in parameters.componentGovernanceSteps }}: + - ${{ step }} - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: @@ -190,14 +180,6 @@ jobs: continueOnError: ${{ parameters.continueOnError }} env: TeamName: $(_TeamName) - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: - - template: /eng/common/core-templates/steps/generate-sbom.yml - parameters: - is1ESPipeline: ${{ parameters.is1ESPipeline }} - PackageVersion: ${{ parameters.packageVersion}} - BuildDropPath: ${{ parameters.buildDropPath }} - IgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} - publishArtifacts: false # Publish test results - ${{ if or(and(eq(parameters.enablePublishTestResults, 'true'), eq(parameters.testResultsFormat, '')), eq(parameters.testResultsFormat, 'xunit')) }}: diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml index 8fe9299542..d99a1a3b28 100644 --- a/eng/common/core-templates/job/publish-build-assets.yml +++ b/eng/common/core-templates/job/publish-build-assets.yml @@ -87,13 +87,15 @@ jobs: - task: NuGetAuthenticate@1 - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Build Assets inputs: - filePath: eng\common\sdk-task.ps1 + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/sdk-task.ps1 arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' - /p:BuildAssetRegistryToken=$(MaestroAccessToken) /p:MaestroApiEndpoint=https://maestro.dot.net /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} /p:OfficialBuildId=$(Build.BuildNumber) @@ -153,14 +155,16 @@ jobs: PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} is1ESPipeline: ${{ parameters.is1ESPipeline }} - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Using Darc inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: -BuildId $(BARBuildId) -PublishingInfraVersion 3 -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' - -MaestroToken '$(MaestroApiAccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/core-templates/job/source-index-stage1.yml b/eng/common/core-templates/job/source-index-stage1.yml index 8328e52ab1..945c1c19e8 100644 --- a/eng/common/core-templates/job/source-index-stage1.yml +++ b/eng/common/core-templates/job/source-index-stage1.yml @@ -69,23 +69,11 @@ jobs: - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: AzureCLI@2 - displayName: Get stage 1 auth token + displayName: Log in to Azure and upload stage1 artifacts to source index inputs: azureSubscription: 'SourceDotNet Stage1 Publish' addSpnToEnvironment: true scriptType: 'ps' scriptLocation: 'inlineScript' inlineScript: | - echo "##vso[task.setvariable variable=ARM_CLIENT_ID]$env:servicePrincipalId" - echo "##vso[task.setvariable variable=ARM_ID_TOKEN]$env:idToken" - echo "##vso[task.setvariable variable=ARM_TENANT_ID]$env:tenantId" - - - script: | - echo "Client ID: $(ARM_CLIENT_ID)" - echo "ID Token: $(ARM_ID_TOKEN)" - echo "Tenant ID: $(ARM_TENANT_ID)" - az login --service-principal -u $(ARM_CLIENT_ID) --tenant $(ARM_TENANT_ID) --allow-no-subscriptions --federated-token $(ARM_ID_TOKEN) - displayName: "Login to Azure" - - - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) -s netsourceindexstage1 -b stage1 - displayName: Upload stage1 artifacts to source index + $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) -s netsourceindexstage1 -b stage1 diff --git a/eng/common/core-templates/post-build/common-variables.yml b/eng/common/core-templates/post-build/common-variables.yml index b9ede10bf0..d5627a994a 100644 --- a/eng/common/core-templates/post-build/common-variables.yml +++ b/eng/common/core-templates/post-build/common-variables.yml @@ -8,8 +8,6 @@ variables: # Default Maestro++ API Endpoint and API Version - name: MaestroApiEndPoint value: "https://maestro.dot.net" - - name: MaestroApiAccessToken - value: $(MaestroAccessToken) - name: MaestroApiVersion value: "2020-02-20" diff --git a/eng/common/core-templates/post-build/post-build.yml b/eng/common/core-templates/post-build/post-build.yml index fb15c40c03..20924366b8 100644 --- a/eng/common/core-templates/post-build/post-build.yml +++ b/eng/common/core-templates/post-build/post-build.yml @@ -300,14 +300,16 @@ stages: - task: NuGetAuthenticate@1 - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Using Darc inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: -BuildId $(BARBuildId) -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' - -MaestroToken '$(MaestroApiAccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/core-templates/post-build/setup-maestro-vars.yml b/eng/common/core-templates/post-build/setup-maestro-vars.yml index 8d56b57267..f7602980db 100644 --- a/eng/common/core-templates/post-build/setup-maestro-vars.yml +++ b/eng/common/core-templates/post-build/setup-maestro-vars.yml @@ -15,19 +15,20 @@ steps: artifactName: ReleaseConfigs checkDownloadedFiles: true - - task: PowerShell@2 + - task: AzureCLI@2 name: setReleaseVars displayName: Set Release Configs Vars inputs: - targetType: inline - pwsh: true - script: | + azureSubscription: "Darc: Maestro Production" + scriptType: pscore + scriptLocation: inlineScript + inlineScript: | try { if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt $BarId = $Content | Select -Index 0 - $Channels = $Content | Select -Index 1 + $Channels = $Content | Select -Index 1 $IsStableBuild = $Content | Select -Index 2 $AzureDevOpsProject = $Env:System_TeamProject @@ -35,15 +36,16 @@ steps: $AzureDevOpsBuildId = $Env:Build_BuildId } else { - $buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}" + . $(Build.SourcesDirectory)\eng\common\tools.ps1 + $darc = Get-Darc + $buildInfo = & $darc get-build ` + --id ${{ parameters.BARBuildId }} ` + --extended ` + --output-format json ` + --ci ` + | convertFrom-Json - $apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' - $apiHeaders.Add('Accept', 'application/json') - $apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}") - - $buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } - - $BarId = $Env:BARBuildId + $BarId = ${{ parameters.BARBuildId }} $Channels = $Env:PromoteToMaestroChannels -split "," $Channels = $Channels -join "][" $Channels = "[$Channels]" @@ -69,6 +71,4 @@ steps: exit 1 } env: - MAESTRO_API_TOKEN: $(MaestroApiAccessToken) - BARBuildId: ${{ parameters.BARBuildId }} PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }} diff --git a/eng/common/core-templates/steps/component-governance.yml b/eng/common/core-templates/steps/component-governance.yml index df449a34c1..cf0649aa95 100644 --- a/eng/common/core-templates/steps/component-governance.yml +++ b/eng/common/core-templates/steps/component-governance.yml @@ -2,7 +2,8 @@ parameters: disableComponentGovernance: false componentGovernanceIgnoreDirectories: '' is1ESPipeline: false - + displayName: 'Component Detection' + steps: - ${{ if eq(parameters.disableComponentGovernance, 'true') }}: - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" @@ -10,5 +11,6 @@ steps: - ${{ if ne(parameters.disableComponentGovernance, 'true') }}: - task: ComponentGovernanceComponentDetection@0 continueOnError: true + displayName: ${{ parameters.displayName }} inputs: - ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} \ No newline at end of file + ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} diff --git a/eng/common/core-templates/steps/enable-internal-sources.yml b/eng/common/core-templates/steps/enable-internal-sources.yml index 80deddafb1..64f881bffc 100644 --- a/eng/common/core-templates/steps/enable-internal-sources.yml +++ b/eng/common/core-templates/steps/enable-internal-sources.yml @@ -6,30 +6,42 @@ parameters: - name: is1ESPipeline type: boolean default: false +# Legacy parameters to allow for PAT usage +- name: legacyCredential + type: string + default: '' steps: - ${{ if ne(variables['System.TeamProject'], 'public') }}: - # If running on dnceng (internal project), just use the default behavior for NuGetAuthenticate. - # If running on DevDiv, NuGetAuthenticate is not really an option. It's scoped to a single feed, and we have many feeds that - # may be added. Instead, we'll use the traditional approach (add cred to nuget.config), but use an account token. - - ${{ if eq(variables['System.TeamProject'], 'internal') }}: + - ${{ if ne(parameters.legacyCredential, '') }}: - task: PowerShell@2 displayName: Setup Internal Feeds inputs: filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 - arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config - - task: NuGetAuthenticate@1 + arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token + env: + Token: ${{ parameters.legacyCredential }} + # If running on dnceng (internal project), just use the default behavior for NuGetAuthenticate. + # If running on DevDiv, NuGetAuthenticate is not really an option. It's scoped to a single feed, and we have many feeds that + # may be added. Instead, we'll use the traditional approach (add cred to nuget.config), but use an account token. - ${{ else }}: - - template: /eng/common/templates/steps/get-federated-access-token.yml - parameters: - federatedServiceConnection: ${{ parameters.nugetFederatedServiceConnection }} - outputVariableName: 'dnceng-artifacts-feeds-read-access-token' - - task: PowerShell@2 - displayName: Setup Internal Feeds - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 - arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $(dnceng-artifacts-feeds-read-access-token) - # This is required in certain scenarios to install the ADO credential provider. - # It installed by default in some msbuild invocations (e.g. VS msbuild), but needs to be installed for others - # (e.g. dotnet msbuild). - - task: NuGetAuthenticate@1 + - ${{ if eq(variables['System.TeamProject'], 'internal') }}: + - task: PowerShell@2 + displayName: Setup Internal Feeds + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config + - ${{ else }}: + - template: /eng/common/templates/steps/get-federated-access-token.yml + parameters: + federatedServiceConnection: ${{ parameters.nugetFederatedServiceConnection }} + outputVariableName: 'dnceng-artifacts-feeds-read-access-token' + - task: PowerShell@2 + displayName: Setup Internal Feeds + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1 + arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $(dnceng-artifacts-feeds-read-access-token) + # This is required in certain scenarios to install the ADO credential provider. + # It installed by default in some msbuild invocations (e.g. VS msbuild), but needs to be installed for others + # (e.g. dotnet msbuild). + - task: NuGetAuthenticate@1 diff --git a/eng/common/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml index 16c778d92c..2915d29bb7 100644 --- a/eng/common/core-templates/steps/source-build.yml +++ b/eng/common/core-templates/steps/source-build.yml @@ -121,7 +121,9 @@ steps: # a nupkg cache of input packages (a local feed). # This path must match the upstream cache path in property 'CurrentRepoSourceBuiltNupkgCacheDir' # in src\Microsoft.DotNet.Arcade.Sdk\tools\SourceBuild\SourceBuildArcade.targets -- task: ComponentGovernanceComponentDetection@0 - displayName: Component Detection (Exclude upstream cache) - inputs: - ignoreDirectories: '$(Build.SourcesDirectory)/artifacts/sb/src/artifacts/obj/source-built-upstream-cache' +- template: /eng/common/core-templates/steps/component-governance.yml + parameters: + displayName: Component Detection (Exclude upstream cache) + is1ESPipeline: ${{ parameters.is1ESPipeline }} + componentGovernanceIgnoreDirectories: '$(Build.SourcesDirectory)/artifacts/sb/src/artifacts/obj/source-built-upstream-cache' + disableComponentGovernance: ${{ eq(variables['System.TeamProject'], 'public') }} diff --git a/eng/common/cross/arm/sources.list.bionic b/eng/common/cross/arm/sources.list.bionic deleted file mode 100644 index 2109557409..0000000000 --- a/eng/common/cross/arm/sources.list.bionic +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/arm/sources.list.focal b/eng/common/cross/arm/sources.list.focal deleted file mode 100644 index 4de2600c17..0000000000 --- a/eng/common/cross/arm/sources.list.focal +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse diff --git a/eng/common/cross/arm/sources.list.jammy b/eng/common/cross/arm/sources.list.jammy deleted file mode 100644 index 6bb0453029..0000000000 --- a/eng/common/cross/arm/sources.list.jammy +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse diff --git a/eng/common/cross/arm/sources.list.jessie b/eng/common/cross/arm/sources.list.jessie deleted file mode 100644 index 4d142ac9b1..0000000000 --- a/eng/common/cross/arm/sources.list.jessie +++ /dev/null @@ -1,3 +0,0 @@ -# Debian (sid) # UNSTABLE -deb http://ftp.debian.org/debian/ sid main contrib non-free -deb-src http://ftp.debian.org/debian/ sid main contrib non-free diff --git a/eng/common/cross/arm/sources.list.xenial b/eng/common/cross/arm/sources.list.xenial deleted file mode 100644 index 56fbb36a59..0000000000 --- a/eng/common/cross/arm/sources.list.xenial +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse diff --git a/eng/common/cross/arm/sources.list.zesty b/eng/common/cross/arm/sources.list.zesty deleted file mode 100644 index ea2c14a787..0000000000 --- a/eng/common/cross/arm/sources.list.zesty +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse diff --git a/eng/common/cross/arm64/sources.list.bionic b/eng/common/cross/arm64/sources.list.bionic deleted file mode 100644 index 2109557409..0000000000 --- a/eng/common/cross/arm64/sources.list.bionic +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse diff --git a/eng/common/cross/arm64/sources.list.buster b/eng/common/cross/arm64/sources.list.buster deleted file mode 100644 index 7194ac64a9..0000000000 --- a/eng/common/cross/arm64/sources.list.buster +++ /dev/null @@ -1,11 +0,0 @@ -deb http://deb.debian.org/debian buster main -deb-src http://deb.debian.org/debian buster main - -deb http://deb.debian.org/debian-security/ buster/updates main -deb-src http://deb.debian.org/debian-security/ buster/updates main - -deb http://deb.debian.org/debian buster-updates main -deb-src http://deb.debian.org/debian buster-updates main - -deb http://deb.debian.org/debian buster-backports main contrib non-free -deb-src http://deb.debian.org/debian buster-backports main contrib non-free diff --git a/eng/common/cross/arm64/sources.list.focal b/eng/common/cross/arm64/sources.list.focal deleted file mode 100644 index 4de2600c17..0000000000 --- a/eng/common/cross/arm64/sources.list.focal +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse diff --git a/eng/common/cross/arm64/sources.list.jammy b/eng/common/cross/arm64/sources.list.jammy deleted file mode 100644 index 6bb0453029..0000000000 --- a/eng/common/cross/arm64/sources.list.jammy +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse diff --git a/eng/common/cross/arm64/sources.list.stretch b/eng/common/cross/arm64/sources.list.stretch deleted file mode 100644 index 0e12157743..0000000000 --- a/eng/common/cross/arm64/sources.list.stretch +++ /dev/null @@ -1,12 +0,0 @@ -deb http://deb.debian.org/debian stretch main -deb-src http://deb.debian.org/debian stretch main - -deb http://deb.debian.org/debian-security/ stretch/updates main -deb-src http://deb.debian.org/debian-security/ stretch/updates main - -deb http://deb.debian.org/debian stretch-updates main -deb-src http://deb.debian.org/debian stretch-updates main - -deb http://deb.debian.org/debian stretch-backports main contrib non-free -deb-src http://deb.debian.org/debian stretch-backports main contrib non-free - diff --git a/eng/common/cross/arm64/sources.list.xenial b/eng/common/cross/arm64/sources.list.xenial deleted file mode 100644 index 56fbb36a59..0000000000 --- a/eng/common/cross/arm64/sources.list.xenial +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse diff --git a/eng/common/cross/arm64/sources.list.zesty b/eng/common/cross/arm64/sources.list.zesty deleted file mode 100644 index ea2c14a787..0000000000 --- a/eng/common/cross/arm64/sources.list.zesty +++ /dev/null @@ -1,11 +0,0 @@ -deb http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-updates main restricted universe - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-backports main restricted - -deb http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse -deb-src http://ports.ubuntu.com/ubuntu-ports/ zesty-security main restricted universe multiverse diff --git a/eng/common/cross/armel/sources.list.jessie b/eng/common/cross/armel/sources.list.jessie deleted file mode 100644 index 3d9c3059d8..0000000000 --- a/eng/common/cross/armel/sources.list.jessie +++ /dev/null @@ -1,3 +0,0 @@ -# Debian (jessie) # Stable -deb http://ftp.debian.org/debian/ jessie main contrib non-free -deb-src http://ftp.debian.org/debian/ jessie main contrib non-free diff --git a/eng/common/cross/armv6/sources.list.bookworm b/eng/common/cross/armv6/sources.list.bookworm deleted file mode 100644 index 1016113526..0000000000 --- a/eng/common/cross/armv6/sources.list.bookworm +++ /dev/null @@ -1,2 +0,0 @@ -deb http://raspbian.raspberrypi.org/raspbian/ bookworm main contrib non-free rpi -deb-src http://raspbian.raspberrypi.org/raspbian/ bookworm main contrib non-free rpi diff --git a/eng/common/cross/armv6/sources.list.buster b/eng/common/cross/armv6/sources.list.buster deleted file mode 100644 index f27fc4fb34..0000000000 --- a/eng/common/cross/armv6/sources.list.buster +++ /dev/null @@ -1,2 +0,0 @@ -deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi -deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 7455dcb6af..eb1a908046 100644 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -30,7 +30,8 @@ __IllumosArch=arm7 __HaikuArch=arm __QEMUArch=arm __UbuntuArch=armhf -__UbuntuRepo="http://ports.ubuntu.com/" +__UbuntuRepo= +__UbuntuSuites="updates security backports" __LLDB_Package="liblldb-3.9-dev" __SkipUnmount=0 @@ -129,6 +130,7 @@ __AlpineKeys=' 616db30d:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnpUpyWDWjlUk3smlWeA0\nlIMW+oJ38t92CRLHH3IqRhyECBRW0d0aRGtq7TY8PmxjjvBZrxTNDpJT6KUk4LRm\na6A6IuAI7QnNK8SJqM0DLzlpygd7GJf8ZL9SoHSH+gFsYF67Cpooz/YDqWrlN7Vw\ntO00s0B+eXy+PCXYU7VSfuWFGK8TGEv6HfGMALLjhqMManyvfp8hz3ubN1rK3c8C\nUS/ilRh1qckdbtPvoDPhSbTDmfU1g/EfRSIEXBrIMLg9ka/XB9PvWRrekrppnQzP\nhP9YE3x/wbFc5QqQWiRCYyQl/rgIMOXvIxhkfe8H5n1Et4VAorkpEAXdsfN8KSVv\nLSMazVlLp9GYq5SUpqYX3KnxdWBgN7BJoZ4sltsTpHQ/34SXWfu3UmyUveWj7wp0\nx9hwsPirVI00EEea9AbP7NM2rAyu6ukcm4m6ATd2DZJIViq2es6m60AE6SMCmrQF\nwmk4H/kdQgeAELVfGOm2VyJ3z69fQuywz7xu27S6zTKi05Qlnohxol4wVb6OB7qG\nLPRtK9ObgzRo/OPumyXqlzAi/Yvyd1ZQk8labZps3e16bQp8+pVPiumWioMFJDWV\nGZjCmyMSU8V6MB6njbgLHoyg2LCukCAeSjbPGGGYhnKLm1AKSoJh3IpZuqcKCk5C\n8CM1S15HxV78s9dFntEqIokCAwEAAQ== ' __Keyring= +__KeyringFile="/usr/share/keyrings/ubuntu-archive-keyring.gpg" __SkipSigCheck=0 __UseMirror=0 @@ -162,6 +164,7 @@ while :; do __UbuntuArch=armel __UbuntuRepo="http://ftp.debian.org/debian/" __CodeName=jessie + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" ;; armv6) __BuildArch=armv6 @@ -169,10 +172,12 @@ while :; do __QEMUArch=arm __UbuntuRepo="http://raspbian.raspberrypi.org/raspbian/" __CodeName=buster + __KeyringFile="/usr/share/keyrings/raspbian-archive-keyring.gpg" __LLDB_Package="liblldb-6.0-dev" + __UbuntuSuites= - if [[ -e "/usr/share/keyrings/raspbian-archive-keyring.gpg" ]]; then - __Keyring="--keyring /usr/share/keyrings/raspbian-archive-keyring.gpg" + if [[ -e "$__KeyringFile" ]]; then + __Keyring="--keyring $__KeyringFile" fi ;; riscv64) @@ -181,13 +186,8 @@ while :; do __AlpinePackages="${__AlpinePackages// lldb-dev/}" __QEMUArch=riscv64 __UbuntuArch=riscv64 - __UbuntuRepo="http://deb.debian.org/debian" __UbuntuPackages="${__UbuntuPackages// libunwind8-dev/}" unset __LLDB_Package - - if [[ -e "/usr/share/keyrings/debian-archive-keyring.gpg" ]]; then - __Keyring="--keyring /usr/share/keyrings/debian-archive-keyring.gpg --include=debian-archive-keyring" - fi ;; ppc64le) __BuildArch=ppc64le @@ -288,8 +288,17 @@ while :; do __CodeName=jammy fi ;; + noble) # Ubuntu 24.04 + if [[ "$__CodeName" != "jessie" ]]; then + __CodeName=noble + fi + if [[ -n "$__LLDB_Package" ]]; then + __LLDB_Package="liblldb-18-dev" + fi + ;; jessie) # Debian 8 __CodeName=jessie + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" if [[ -z "$__UbuntuRepo" ]]; then __UbuntuRepo="http://ftp.debian.org/debian/" @@ -298,6 +307,7 @@ while :; do stretch) # Debian 9 __CodeName=stretch __LLDB_Package="liblldb-6.0-dev" + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" if [[ -z "$__UbuntuRepo" ]]; then __UbuntuRepo="http://ftp.debian.org/debian/" @@ -306,6 +316,7 @@ while :; do buster) # Debian 10 __CodeName=buster __LLDB_Package="liblldb-6.0-dev" + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" if [[ -z "$__UbuntuRepo" ]]; then __UbuntuRepo="http://ftp.debian.org/debian/" @@ -313,6 +324,7 @@ while :; do ;; bullseye) # Debian 11 __CodeName=bullseye + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" if [[ -z "$__UbuntuRepo" ]]; then __UbuntuRepo="http://ftp.debian.org/debian/" @@ -320,6 +332,7 @@ while :; do ;; bookworm) # Debian 12 __CodeName=bookworm + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" if [[ -z "$__UbuntuRepo" ]]; then __UbuntuRepo="http://ftp.debian.org/debian/" @@ -327,6 +340,7 @@ while :; do ;; sid) # Debian sid __CodeName=sid + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" if [[ -z "$__UbuntuRepo" ]]; then __UbuntuRepo="http://ftp.debian.org/debian/" @@ -436,6 +450,10 @@ fi __UbuntuPackages+=" ${__LLDB_Package:-}" +if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ports.ubuntu.com/" +fi + if [[ -n "$__LLVM_MajorVersion" ]]; then __UbuntuPackages+=" libclang-common-${__LLVM_MajorVersion}${__LLVM_MinorVersion:+.$__LLVM_MinorVersion}-dev" fi @@ -732,8 +750,18 @@ elif [[ -n "$__CodeName" ]]; then fi # shellcheck disable=SC2086 + echo running debootstrap "--variant=minbase" $__Keyring --arch "$__UbuntuArch" "$__CodeName" "$__RootfsDir" "$__UbuntuRepo" debootstrap "--variant=minbase" $__Keyring --arch "$__UbuntuArch" "$__CodeName" "$__RootfsDir" "$__UbuntuRepo" - cp "$__CrossDir/$__BuildArch/sources.list.$__CodeName" "$__RootfsDir/etc/apt/sources.list" + + mkdir -p "$__RootfsDir/etc/apt/sources.list.d/" + cat > "$__RootfsDir/etc/apt/sources.list.d/$__CodeName.sources" < Date: Wed, 10 Jul 2024 05:08:54 -0400 Subject: [PATCH 12/94] Dipose XmlReaders in Microsoft.TestPlatform.Common.RunSettings (#5100) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It probably makes no impact, but the XmlReaders are declared as IDisposable, so we should Dispose() them when done using them. Co-authored-by: Jakub Jareš --- src/Microsoft.TestPlatform.Common/RunSettings.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.TestPlatform.Common/RunSettings.cs b/src/Microsoft.TestPlatform.Common/RunSettings.cs index 5568afa46d..42eadcd8a4 100644 --- a/src/Microsoft.TestPlatform.Common/RunSettings.cs +++ b/src/Microsoft.TestPlatform.Common/RunSettings.cs @@ -80,7 +80,7 @@ public void LoadSettingsXml(string settings) } using var stringReader = new StringReader(settings); - var reader = XmlReader.Create(stringReader, XmlRunSettingsUtilities.ReaderSettings); + using var reader = XmlReader.Create(stringReader, XmlRunSettingsUtilities.ReaderSettings); ValidateAndSaveSettings(reader); } @@ -91,7 +91,7 @@ public void LoadSettingsXml(string settings) public void InitializeSettingsProviders(string settings) { using var stringReader = new StringReader(settings); - var reader = XmlReader.Create(stringReader, XmlRunSettingsUtilities.ReaderSettings); + using var reader = XmlReader.Create(stringReader, XmlRunSettingsUtilities.ReaderSettings); ReadRunSettings(reader); } From c211b201172a3676ddf6c957aab93670b3eeb2fa Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Wed, 10 Jul 2024 20:28:08 +1000 Subject: [PATCH 13/94] use some collection expressions (#5055) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * use some collection expressions * Update RunSpecificTestsArgumentProcessor.cs * Update Converter.cs * Update RunSettingsUtilities.cs * Update DiscovererEnumerator.cs * Update PostProcessingTestRunAttachmentsProcessingEventsHandler.cs * Update RunSpecificTestsArgumentProcessor.cs * Update TestTaskUtilsTests.cs * Update GenerateFakesUtilitiesTests.cs * Update ProxyOperationManagerTests.cs * Update InProcessProxyDiscoveryManagerTests.cs * Update InProcessProxyexecutionManagerTests.cs * Update ProxyDiscoveryManagerTests.cs * Update ProxyDiscoveryManagerTests.cs * Update CLIRunSettingsArgumentProcessorTests.cs * Fix code style * Fix tests --------- Co-authored-by: Jakub Jareš --- shared/NullableAttributes.cs | 4 +- .../EventLogDataCollector.cs | 2 +- .../Tasks/VSTestTask2.cs | 4 +- .../DesignMode/DesignModeClient.cs | 4 +- .../TestPlatform.cs | 8 +- .../ExtensionFramework/VSExtensionManager.cs | 6 +- .../Filtering/FilterExpression.cs | 4 +- .../Utilities/AssemblyResolver.cs | 2 +- .../Utilities/FakesUtilities.cs | 4 +- .../Utilities/InstallationContext.cs | 6 +- .../Utilities/MetadataReaderHelper.cs | 2 +- .../Utilities/RunSettingsUtilities.cs | 5 +- .../Serialization/TestObjectConverter.cs | 4 +- .../TestRequestSender.cs | 2 +- .../Helpers/FileHelper.cs | 2 +- ...taCollectorAttachmentProcessorAppDomain.cs | 2 +- .../Client/InProcessProxyDiscoveryManager.cs | 6 +- .../Client/InProcessProxyexecutionManager.cs | 4 +- .../Parallel/ParallelOperationManager.cs | 2 +- .../Parallel/ParallelProxyDiscoveryManager.cs | 2 +- .../Parallel/ParallelProxyExecutionManager.cs | 4 +- .../Client/TestLoggerManager.cs | 2 +- .../DataCollection/InProcDataCollector.cs | 14 +- .../Execution/BaseRunTests.cs | 2 +- .../Execution/RunTestsWithTests.cs | 2 +- ...stRunAttachmentsProcessingEventsHandler.cs | 3 +- .../BlameCollector.cs | 2 +- .../NetClientCrashDumper.cs | 2 +- .../ProcDumpDumper.cs | 2 +- .../ProcessDumpUtility.cs | 2 +- .../TrxLogger.cs | 8 +- .../Utility/Converter.cs | 4 +- .../Utility/TrxFileHelper.cs | 2 +- .../XML/XmlPersistence.cs | 4 +- .../DataCollector/Common/RequestId.cs | 2 +- .../FileTransferInformation.cs | 2 +- .../Navigation/DiaSession.cs | 2 +- .../DefaultFrameworkMappings.cs | 75 +++++----- .../DefaultPortableFrameworkMappings.cs | 20 +-- .../Nuget.Frameworks/FrameworkNameProvider.cs | 16 +- .../Nuget.Frameworks/FrameworkReducer.cs | 2 +- .../Nuget.Frameworks/NuGetFrameworkFactory.cs | 2 +- .../TestCase.cs | 4 +- .../TestProperty/CustomKeyValueConverter.cs | 2 +- .../TestResult.cs | 4 +- .../Utilities/AssemblyLoadWorker.cs | 2 +- .../Utilities/FilterHelper.cs | 2 +- .../CodeCoverageDataAttachmentsHandler.cs | 4 +- .../InferRunSettingsHelper.cs | 6 +- .../VsTestConsoleWrapper.cs | 2 +- src/testhost.x86/AppDomainEngineInvoker.cs | 4 +- src/testhost.x86/UnitTestClient.cs | 2 +- src/vstest.console/CommandLine/Executor.cs | 2 +- .../Internal/FilePatternParser.cs | 2 +- .../Processors/CollectArgumentProcessor.cs | 2 +- .../EnableCodeCoverageArgumentProcessor.cs | 5 +- ...AdapterLoadingStrategyArgumentProcessor.cs | 2 +- .../TestAdapterPathArgumentProcessor.cs | 6 +- .../Utilities/ArgumentProcessorUtilities.cs | 4 +- .../EventLogDataCollectorTests.cs | 28 ++-- test/Intent/Runner.cs | 2 +- .../BlameDataCollectorTests.cs | 2 +- .../DataCollectionTests.cs | 2 +- ...lectorAttachmentsProcessorsFactoryTests.cs | 30 ++-- .../DiscoveryTests.cs | 11 +- .../EventLogCollectorTests.cs | 8 +- .../Extension/CompatibilityRowsBuilder.cs | 4 +- .../Extension/NetCoreRunnerAttribute.cs | 4 +- ...tCoreTargetFrameworkDataSourceAttribute.cs | 4 +- .../Extension/NetFrameworkRunnerAttribute.cs | 4 +- ...tFullTargetFrameworkDataSourceAttribute.cs | 8 +- .../Extension/TestDataSourceAttribute.cs | 10 +- .../FilePatternParserTests.cs | 2 +- .../LoggerTests.cs | 2 +- .../RunsettingsTests.cs | 20 +-- .../ManagedNameParserTests.cs | 10 +- .../TestIdProvider/CompatibilityTests.cs | 20 +-- .../TestTaskUtilsTests.cs | 17 +-- .../Discovery/DiscoveryRequestTests.cs | 12 +- .../Execution/TestRunRequestTests.cs | 2 +- .../ExtensionDecoratorTests.cs | 2 +- .../TestPluginCacheTests.cs | 2 +- .../Utilities/TestExtensionsTests.cs | 26 ++-- .../Logging/InternalTestLoggerEventsTests.cs | 4 +- .../Utilities/FakesUtilitiesTests.cs | 4 +- .../Utilities/RunSettingsUtilitiesTests.cs | 2 +- .../SocketCommunicationManagerTests.cs | 2 +- .../DataCollectionRequestSenderTests.cs | 4 +- .../TestRequestSenderTests.cs | 2 +- .../CommandLineArgumentsHelperTests.cs | 4 +- ...estRunAttachmentsProcessingManagerTests.cs | 138 ++++++------------ .../InProcessProxyDiscoveryManagerTests.cs | 4 +- .../InProcessProxyexecutionManagerTests.cs | 2 +- .../ParallelProxyDiscoveryManagerTests.cs | 7 +- .../ParallelProxyExecutionManagerTests.cs | 7 +- .../Client/ProxyDiscoveryManagerTests.cs | 2 +- .../Client/ProxyExecutionManagerTests.cs | 2 +- .../Client/ProxyOperationManagerTests.cs | 61 ++++---- .../Client/ProxyTestSessionManagerTests.cs | 8 +- ...arallelDataCollectionEventsHandlerTests.cs | 17 +-- .../Discovery/DiscovererEnumeratorTests.cs | 29 ++-- .../Discovery/DiscoveryManagerTests.cs | 10 +- .../EventHandlers/TestRequestHandlerTests.cs | 2 +- .../Execution/BaseRunTestsTests.cs | 4 +- .../Execution/ExecutionManagerTests.cs | 6 +- .../Execution/RunTestsWithSourcesTests.cs | 2 +- .../PostProcessing/ArtifactProcessingTests.cs | 8 +- .../TestEngineTests.cs | 12 +- .../TestLoggerManagerTests.cs | 6 +- .../ProcessDumpUtilityTests.cs | 2 +- .../TrxLoggerTests.cs | 12 +- .../Utility/ConverterTests.cs | 9 +- .../Hosting/DefaultTestHostManagerTests.cs | 54 +++---- .../Hosting/DotnetTestHostManagerTests.cs | 10 +- .../IntegrationTestBase.cs | 2 +- .../TestPluginCacheHelper.cs | 4 +- ...CodeCoverageDataAttachmentsHandlerTests.cs | 16 +- .../CommandLineUtilitiesTest.cs | 8 +- .../PathResolverTests.cs | 14 +- .../ProgramTests.cs | 4 +- .../TestSessionTests.cs | 8 +- .../VsTestConsoleRequestSenderTests.cs | 6 +- .../VsTestConsoleWrapperTests.cs | 8 +- .../DataCollectionManagerTests.cs | 4 +- .../DataCollectorMainTests.cs | 6 +- .../Fakes/StringExtensions.cs | 2 +- .../MultiTFMRunAndDiscovery.cs | 2 +- test/vstest.ProgrammerTests/Program.cs | 2 +- .../GenerateFakesUtilitiesTests.cs | 2 +- .../ExecutorUnitTests.cs | 8 +- ...tProcessingPostProcessModeProcessorTest.cs | 8 +- .../CLIRunSettingsArgumentProcessorTests.cs | 93 ++++++------ .../RunSpecificTestsArgumentProcessorTests.cs | 66 ++++----- .../RunTestsArgumentProcessorTests.cs | 6 +- .../ArgumentProcessorFactoryTests.cs | 4 +- .../ArgumentProcessorUtilitiesTests.cs | 2 +- 136 files changed, 591 insertions(+), 656 deletions(-) diff --git a/shared/NullableAttributes.cs b/shared/NullableAttributes.cs index ded53a2c9f..845ee9bdfa 100644 --- a/shared/NullableAttributes.cs +++ b/shared/NullableAttributes.cs @@ -96,7 +96,7 @@ internal sealed class MemberNotNullAttribute : Attribute /// /// The field or property member that is promised to be not-null. /// - public MemberNotNullAttribute(string member) => Members = new[] { member }; + public MemberNotNullAttribute(string member) => Members = [member]; /// Initializes the attribute with the list of field and property members. /// @@ -122,7 +122,7 @@ internal sealed class MemberNotNullWhenAttribute : Attribute public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; - Members = new[] { member }; + Members = [member]; } /// Initializes the attribute with the specified return value condition and list of field and property members. diff --git a/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/EventLogDataCollector.cs b/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/EventLogDataCollector.cs index 6d93832971..9296983499 100644 --- a/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/EventLogDataCollector.cs +++ b/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/EventLogDataCollector.cs @@ -326,7 +326,7 @@ protected override void Dispose(bool disposing) private static ISet ParseCommaSeparatedList(string commaSeparatedList) { ISet strings = new HashSet(); - string[] items = commaSeparatedList.Split(new char[] { ',' }); + string[] items = commaSeparatedList.Split([',']); foreach (string item in items) { strings.Add(item.Trim()); diff --git a/src/Microsoft.TestPlatform.Build/Tasks/VSTestTask2.cs b/src/Microsoft.TestPlatform.Build/Tasks/VSTestTask2.cs index 1443725e62..cbc866d928 100644 --- a/src/Microsoft.TestPlatform.Build/Tasks/VSTestTask2.cs +++ b/src/Microsoft.TestPlatform.Build/Tasks/VSTestTask2.cs @@ -48,7 +48,7 @@ public class VSTestTask2 : ToolTask, ITestTask protected override Encoding StandardOutputEncoding => _disableUtf8ConsoleEncoding ? base.StandardOutputEncoding : Encoding.UTF8; private readonly string _messageSplitter = "||||"; - private readonly string[] _messageSplitterArray = new[] { "||||" }; + private readonly string[] _messageSplitterArray = ["||||"]; private readonly string _ansiReset = "\x1b[39;49m"; private readonly bool _disableUtf8ConsoleEncoding; @@ -271,7 +271,7 @@ private bool TryGetMessage(string singleLine, out string name, out string?[] dat } name = string.Empty; - data = Array.Empty(); + data = []; return false; } diff --git a/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs b/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs index b3e59ba1c5..f64f20374e 100644 --- a/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs +++ b/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs @@ -334,7 +334,7 @@ public int LaunchCustomHost(TestProcessStartInfo testProcessStartInfo, Cancellat // Even if TP has a timeout here, there is no way TP can abort or stop the thread/task that is hung in IDE or LUT // Even if TP can abort the API somehow, TP is essentially putting IDEs or Clients in inconsistent state without having info on // Since the IDEs own user-UI-experience here, TP will let the custom host launch as much time as IDEs define it for their users - WaitHandle.WaitAny(new WaitHandle[] { waitHandle, cancellationToken.WaitHandle }); + WaitHandle.WaitAny([waitHandle, cancellationToken.WaitHandle]); cancellationToken.ThrowTestPlatformExceptionIfCancellationRequested(); @@ -387,7 +387,7 @@ public bool AttachDebuggerToProcess(AttachDebuggerInfo attachDebuggerInfo, Cance _communicationManager.SendMessage(MessageType.EditorAttachDebugger2, payload); } - WaitHandle.WaitAny(new WaitHandle[] { waitHandle, cancellationToken.WaitHandle }); + WaitHandle.WaitAny([waitHandle, cancellationToken.WaitHandle]); cancellationToken.ThrowTestPlatformExceptionIfCancellationRequested(); onAttachDebuggerAckRecieved = null; diff --git a/src/Microsoft.TestPlatform.Client/TestPlatform.cs b/src/Microsoft.TestPlatform.Client/TestPlatform.cs index 45ee1303a1..73b7a47627 100644 --- a/src/Microsoft.TestPlatform.Client/TestPlatform.cs +++ b/src/Microsoft.TestPlatform.Client/TestPlatform.cs @@ -283,7 +283,7 @@ private static void AddExtensionAssembliesFromExtensionDirectory() TestAdapterLoadingStrategy strategy = runConfiguration.TestAdapterLoadingStrategy; FileHelper fileHelper = new(); - IEnumerable defaultExtensionPaths = Enumerable.Empty(); + IEnumerable defaultExtensionPaths = []; // Explicit adapter loading if (strategy.HasFlag(TestAdapterLoadingStrategy.Explicit)) @@ -354,7 +354,7 @@ private static IEnumerable ExpandAdaptersWithExplicitStrategy(string pat { if (!strategy.HasFlag(TestAdapterLoadingStrategy.Explicit)) { - return Enumerable.Empty(); + return []; } if (fileHelper.Exists(path)) @@ -377,7 +377,7 @@ private static IEnumerable ExpandAdaptersWithExplicitStrategy(string pat } EqtTrace.Warning($"{nameof(TestPlatform)}.{nameof(ExpandAdaptersWithExplicitStrategy)} AdapterPath Not Found: {path}"); - return Enumerable.Empty(); + return []; } private static IEnumerable ExpandAdaptersWithDefaultStrategy(string path, IFileHelper fileHelper) @@ -388,7 +388,7 @@ private static IEnumerable ExpandAdaptersWithDefaultStrategy(string path { EqtTrace.Warning($"{nameof(TestPlatform)}.{nameof(ExpandAdaptersWithDefaultStrategy)} AdapterPath Not Found: {path}"); - return Enumerable.Empty(); + return []; } return fileHelper.EnumerateFiles( diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/VSExtensionManager.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/VSExtensionManager.cs index cec8312fe0..d4e5224d26 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/VSExtensionManager.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/VSExtensionManager.cs @@ -85,7 +85,7 @@ private IEnumerable GetTestExtensionsInternal(string extensionType) var resolutionPaths = installContext.GetVisualStudioCommonLocations(vsInstallPath); using (var assemblyResolver = new AssemblyResolver(resolutionPaths)) { - var settingsManager = SettingsManagerType.GetMethod("CreateForApplication", new Type[] { typeof(string) })?.Invoke(null, new object[] { installContext.GetVisualStudioPath(vsInstallPath) }); + var settingsManager = SettingsManagerType.GetMethod("CreateForApplication", [typeof(string)])?.Invoke(null, [installContext.GetVisualStudioPath(vsInstallPath)]); if (settingsManager == null) { EqtTrace.Warning("VSExtensionManager : Unable to create settings manager"); @@ -99,8 +99,8 @@ private IEnumerable GetTestExtensionsInternal(string extensionType) if (extensionManager != null) { - installedExtensions = ExtensionManagerServiceType.GetMethod("GetEnabledExtensionContentLocations", new Type[] { typeof(string) })?.Invoke( - extensionManager, new object[] { extensionType }) as IEnumerable; + installedExtensions = ExtensionManagerServiceType.GetMethod("GetEnabledExtensionContentLocations", [typeof(string)])?.Invoke( + extensionManager, [extensionType]) as IEnumerable; } else { diff --git a/src/Microsoft.TestPlatform.Common/Filtering/FilterExpression.cs b/src/Microsoft.TestPlatform.Common/Filtering/FilterExpression.cs index 417d10fae4..a587d1a98d 100644 --- a/src/Microsoft.TestPlatform.Common/Filtering/FilterExpression.cs +++ b/src/Microsoft.TestPlatform.Common/Filtering/FilterExpression.cs @@ -122,7 +122,7 @@ private static void ProcessOperator(Stack filterStack, Operato if (null == properties) { // if null, initialize to empty list so that invalid properties can be found. - properties = Enumerable.Empty(); + properties = []; } return IterateFilterExpression((current, result) => @@ -132,7 +132,7 @@ private static void ProcessOperator(Stack filterStack, Operato { var valid = current._condition.ValidForProperties(properties, propertyProvider); // If it's not valid will add it to the function's return array. - return !valid ? new string[1] { current._condition.Name } : null; + return !valid ? [current._condition.Name] : null; } // Concatenate the children node's result to get their parent result. diff --git a/src/Microsoft.TestPlatform.Common/Utilities/AssemblyResolver.cs b/src/Microsoft.TestPlatform.Common/Utilities/AssemblyResolver.cs index 6181dcd5b4..6682231730 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/AssemblyResolver.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/AssemblyResolver.cs @@ -40,7 +40,7 @@ internal class AssemblyResolver : IDisposable private readonly IAssemblyLoadContext _platformAssemblyLoadContext; - private static readonly string[] SupportedFileExtensions = { ".dll", ".exe" }; + private static readonly string[] SupportedFileExtensions = [".dll", ".exe"]; /// /// Initializes a new instance of the class. diff --git a/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs b/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs index c493b0c380..feac1e682c 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs @@ -231,7 +231,7 @@ private static void EnsureSettingsNode(XmlDocument settings, TestRunSettings set { var assembly = LoadTestPlatformAssembly(); var type = assembly?.GetType(ConfiguratorAssemblyQualifiedName, false); - var method = type?.GetMethod(NetFrameworkConfiguratorMethodName, new Type[] { typeof(IEnumerable) }); + var method = type?.GetMethod(NetFrameworkConfiguratorMethodName, [typeof(IEnumerable)]); if (method != null) { return (Func, string>)method.CreateDelegate(typeof(Func, string>)); @@ -251,7 +251,7 @@ private static void EnsureSettingsNode(XmlDocument settings, TestRunSettings set { var assembly = LoadTestPlatformAssembly(); var type = assembly?.GetType(ConfiguratorAssemblyQualifiedName, false, false); - var method = type?.GetMethod(CrossPlatformConfiguratorMethodName, new Type[] { typeof(IDictionary) }); + var method = type?.GetMethod(CrossPlatformConfiguratorMethodName, [typeof(IDictionary)]); if (method != null) { return (Func, DataCollectorSettings>)method.CreateDelegate(typeof(Func, DataCollectorSettings>)); diff --git a/src/Microsoft.TestPlatform.Common/Utilities/InstallationContext.cs b/src/Microsoft.TestPlatform.Common/Utilities/InstallationContext.cs index 6c0c0bebaa..4783921204 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/InstallationContext.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/InstallationContext.cs @@ -48,13 +48,13 @@ public string GetVisualStudioPath(string visualStudioDirectory) [SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Part of the public API")] public string[] GetVisualStudioCommonLocations(string visualStudioDirectory) { - return new[] - { + return + [ Path.Combine(visualStudioDirectory, PrivateAssembliesDirName), Path.Combine(visualStudioDirectory, PublicAssembliesDirName), Path.Combine(visualStudioDirectory, "CommonExtensions", "Microsoft", "TestWindow"), Path.Combine(visualStudioDirectory, "CommonExtensions", "Microsoft", "TeamFoundation", "Team Explorer"), visualStudioDirectory - }; + ]; } } diff --git a/src/Microsoft.TestPlatform.Common/Utilities/MetadataReaderHelper.cs b/src/Microsoft.TestPlatform.Common/Utilities/MetadataReaderHelper.cs index e515ab5950..a8a6887df7 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/MetadataReaderHelper.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/MetadataReaderHelper.cs @@ -42,7 +42,7 @@ internal static class MetadataReaderExtensionsHelper { private const string TestExtensionTypesAttributeV2 = "Microsoft.VisualStudio.TestPlatform.TestExtensionTypesV2Attribute"; private static readonly ConcurrentDictionary AssemblyCache = new(); - private static readonly Type[] EmptyTypeArray = new Type[0]; + private static readonly Type[] EmptyTypeArray = []; public static Type[] DiscoverTestExtensionTypesV2Attribute(Assembly loadedAssembly, string assemblyFilePath) => AssemblyCache.GetOrAdd(assemblyFilePath, DiscoverTestExtensionTypesV2AttributeInternal(loadedAssembly, assemblyFilePath)); diff --git a/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsUtilities.cs b/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsUtilities.cs index a66a6ec57b..f9fb02e684 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsUtilities.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsUtilities.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using System.Linq; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; @@ -176,12 +175,12 @@ public static IEnumerable GetTestAdaptersPaths(string? runSettings) { var runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(runSettings); - IEnumerable testAdaptersPaths = Enumerable.Empty(); + IEnumerable testAdaptersPaths = []; if (runConfiguration != null) { if (runConfiguration.TestAdaptersPathsSet) { - testAdaptersPaths = runConfiguration.TestAdaptersPaths.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); + testAdaptersPaths = runConfiguration.TestAdaptersPaths.Split([';'], StringSplitOptions.RemoveEmptyEntries); } } diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Serialization/TestObjectConverter.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Serialization/TestObjectConverter.cs index f7fabcdbf7..fdc615a411 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Serialization/TestObjectConverter.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Serialization/TestObjectConverter.cs @@ -102,12 +102,12 @@ internal class TestObjectConverter7 : JsonConverter { // Empty is not present everywhere #pragma warning disable CA1825 // Avoid zero-length array allocations - private static readonly object[] EmptyObjectArray = new object[0]; + private static readonly object[] EmptyObjectArray = []; #pragma warning restore CA1825 // Avoid zero-length array allocations public TestObjectConverter7() { - TestPropertyCtor = typeof(TestProperty).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[0], null); + TestPropertyCtor = typeof(TestProperty).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, [], null); } /// diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs index ad0b614463..89f7369dbd 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs @@ -217,7 +217,7 @@ public bool WaitForRequestHandlerConnection(int connectionTimeout, CancellationT // Wait until either connection is successful, handled by connected.WaitHandle // or operation is canceled, handled by cancellationToken.WaitHandle // or testhost exits unexpectedly, handled by clientExited.WaitHandle - var waitIndex = WaitHandle.WaitAny(new WaitHandle[] { _connected.WaitHandle, cancellationToken.WaitHandle, _clientExited.WaitHandle }, connectionTimeout); + var waitIndex = WaitHandle.WaitAny([_connected.WaitHandle, cancellationToken.WaitHandle, _clientExited.WaitHandle], connectionTimeout); EqtTrace.Verbose("TestRequestSender.WaitForRequestHandlerConnection: waiting took {0} ms, with timeout {1} ms, and result {2}, which is {3}.", sw.ElapsedMilliseconds, connectionTimeout, waitIndex, waitIndex == 0 ? "success" : "failure"); diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Helpers/FileHelper.cs b/src/Microsoft.TestPlatform.CoreUtilities/Helpers/FileHelper.cs index 6b75f6b8a1..7179155386 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Helpers/FileHelper.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Helpers/FileHelper.cs @@ -50,7 +50,7 @@ public IEnumerable EnumerateFiles( { if (endsWithSearchPatterns == null || endsWithSearchPatterns.Length == 0) { - return Enumerable.Empty(); + return []; } var files = Directory.EnumerateFiles(directory, "*", searchOption); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/AttachmentsProcessing/DataCollectorAttachmentProcessorAppDomain.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/AttachmentsProcessing/DataCollectorAttachmentProcessorAppDomain.cs index 28ef57dbd8..744b346976 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/AttachmentsProcessing/DataCollectorAttachmentProcessorAppDomain.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/AttachmentsProcessing/DataCollectorAttachmentProcessorAppDomain.cs @@ -63,7 +63,7 @@ public DataCollectorAttachmentProcessorAppDomain(InvokedDataCollector invokedDat false, BindingFlags.Default, null, - new[] { _pipeShutdownMessagePrefix }, + [_pipeShutdownMessagePrefix], null, null); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyDiscoveryManager.cs index a416e5a2f6..093664b8c7 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyDiscoveryManager.cs @@ -74,7 +74,7 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve var discoveryCompeleteEventsArg = new DiscoveryCompleteEventArgs(-1, true); - eventHandler.HandleDiscoveryComplete(discoveryCompeleteEventsArg, Enumerable.Empty()); + eventHandler.HandleDiscoveryComplete(discoveryCompeleteEventsArg, []); } }); } @@ -103,7 +103,7 @@ public void Abort(ITestDiscoveryEventsHandler2 eventHandler) private void InitializeExtensions(IEnumerable sources) { - var extensionsFromSource = _testHostManager.GetTestPlatformExtensions(sources, Enumerable.Empty()); + var extensionsFromSource = _testHostManager.GetTestPlatformExtensions(sources, []); if (extensionsFromSource.Any()) { TestPluginCache.Instance.UpdateExtensions(extensionsFromSource, false); @@ -111,7 +111,7 @@ private void InitializeExtensions(IEnumerable sources) // We don't need to pass list of extension as we are running inside vstest.console and // it will use TestPluginCache of vstest.console - _discoveryManager.Initialize(Enumerable.Empty(), null); + _discoveryManager.Initialize([], null); } public void InitializeDiscovery(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler2 eventHandler, bool skipDefaultAdapters) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyexecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyexecutionManager.cs index 27def5dde1..4dd1772c99 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyexecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyexecutionManager.cs @@ -135,7 +135,7 @@ public void Close() private void InitializeExtensions(IEnumerable sources) { - var extensionsFromSource = _testHostManager.GetTestPlatformExtensions(sources, Enumerable.Empty()); + var extensionsFromSource = _testHostManager.GetTestPlatformExtensions(sources, []); if (extensionsFromSource.Any()) { TestPluginCache.Instance.UpdateExtensions(extensionsFromSource, false); @@ -143,7 +143,7 @@ private void InitializeExtensions(IEnumerable sources) // We don't need to pass list of extension as we are running inside vstest.console and // it will use TestPluginCache of vstest.console - _executionManager.Initialize(Enumerable.Empty(), null); + _executionManager.Initialize([], null); } public void InitializeTestRun(TestRunCriteria testRunCriteria, IInternalTestRunEventsHandler eventHandler) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelOperationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelOperationManager.cs index df2ef9133a..9003a84790 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelOperationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelOperationManager.cs @@ -312,7 +312,7 @@ private void ClearCompletedSlot(TManager completedManager) private static string GetSourcesForSlotExpensive(ParallelOperationManager.Slot slot) { - return string.Join(", ", (slot.Work as DiscoveryCriteria)?.Sources ?? (slot.Work as TestRunCriteria)?.Sources ?? Array.Empty()); + return string.Join(", ", (slot.Work as DiscoveryCriteria)?.Sources ?? (slot.Work as TestRunCriteria)?.Sources ?? []); } public void DoActionOnAllManagers(Action action, bool doActionsInParallel = false) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs index 7b871e4e91..5cae5c4eea 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs @@ -222,7 +222,7 @@ private List> SplitToWorkloads(Disco if (!_isParallel && testhostProviderInfo.Shared) { // Create one big source batch that will be single workload for single testhost. - sourceBatches = new List { group.Select(w => w.Work).ToArray() }; + sourceBatches = [group.Select(w => w.Work).ToArray()]; } else { diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs index b586cfe934..4329d4620f 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs @@ -261,7 +261,7 @@ private List> SplitToWorkloads(TestRun if (!_isParallel && testhostProviderInfo.Shared) { // Create one big batch of testcases that will be single workload for single testhost. - testCaseBatches = new List { group.SelectMany(w => sourceToTestCasesMap[w.Work]).ToArray() }; + testCaseBatches = [group.SelectMany(w => sourceToTestCasesMap[w.Work]).ToArray()]; } else { @@ -319,7 +319,7 @@ private List> SplitToWorkloads(TestRun if (!_isParallel && testhostProviderInfo.Shared) { // Create one big source batch that will be single workload for single testhost. - sourceBatches = new List { group.Select(w => w.Work).ToArray() }; + sourceBatches = [group.Select(w => w.Work).ToArray()]; } else { diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/TestLoggerManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/TestLoggerManager.cs index 947c1bad04..232a31145e 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/TestLoggerManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/TestLoggerManager.cs @@ -543,7 +543,7 @@ private bool InitializeLoggerByType(string assemblyQualifiedName, string codeBas // Create logger instance var constructorInfo = loggerType?.GetConstructor(Type.EmptyTypes); - var logger = constructorInfo?.Invoke(new object[] { }); + var logger = constructorInfo?.Invoke([]); // Handle logger null scenario. if (logger == null) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs index f8cdcf9837..466b8d16b4 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs @@ -79,7 +79,7 @@ internal InProcDataCollector(string codeBase, string assemblyQualifiedName, Type // Coverlet collector is consumed as nuget package we need to add assemblies directory to resolver to correctly load references. TPDebug.Assert(Path.IsPathRooted(codeBase), "Absolute path expected"); - testPluginCache.AddResolverSearchDirectories(new string[] { Path.GetDirectoryName(codeBase)! }); + testPluginCache.AddResolverSearchDirectories([Path.GetDirectoryName(codeBase)!]); } else { @@ -112,24 +112,24 @@ public void LoadDataCollector(IDataCollectionSink inProcDataCollectionSink) /// Arguments for the method public void TriggerInProcDataCollectionMethod(string methodName, InProcDataCollectionArgs methodArg) { - var methodInfo = GetMethodInfoFromType(_dataCollectorObject?.GetType(), methodName, new[] { methodArg.GetType() }); + var methodInfo = GetMethodInfoFromType(_dataCollectorObject?.GetType(), methodName, [methodArg.GetType()]); if (methodName.Equals(Constants.TestSessionStartMethodName)) { var testSessionStartArgs = (TestSessionStartArgs)methodArg; testSessionStartArgs.Configuration = _configXml!; - methodInfo?.Invoke(_dataCollectorObject, new object[] { testSessionStartArgs }); + methodInfo?.Invoke(_dataCollectorObject, [testSessionStartArgs]); } else { - methodInfo?.Invoke(_dataCollectorObject, new object[] { methodArg }); + methodInfo?.Invoke(_dataCollectorObject, [methodArg]); } } private static void InitializeDataCollector(object? obj, IDataCollectionSink inProcDataCollectionSink) { - var initializeMethodInfo = GetMethodInfoFromType(obj?.GetType(), "Initialize", new Type[] { typeof(IDataCollectionSink) }); - initializeMethodInfo?.Invoke(obj, new object[] { inProcDataCollectionSink }); + var initializeMethodInfo = GetMethodInfoFromType(obj?.GetType(), "Initialize", [typeof(IDataCollectionSink)]); + initializeMethodInfo?.Invoke(obj, [inProcDataCollectionSink]); } private static MethodInfo? GetMethodInfoFromType(Type? type, string funcName, Type[] argumentTypes) @@ -140,7 +140,7 @@ private static void InitializeDataCollector(object? obj, IDataCollectionSink inP private static object? CreateObjectFromType(Type? type) { var constructorInfo = type?.GetConstructor(Type.EmptyTypes); - object? obj = constructorInfo?.Invoke(new object[] { }); + object? obj = constructorInfo?.Invoke([]); return obj; } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs index 4600200c39..87c19a472e 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/BaseRunTests.cs @@ -619,7 +619,7 @@ private void RaiseTestRunComplete( UpdateTestCaseSourceToPackage(lastChunkTestResults, null, out lastChunkTestResults, out _); } - var testRunChangedEventArgs = new TestRunChangedEventArgs(runStats, lastChunkTestResults, Enumerable.Empty()); + var testRunChangedEventArgs = new TestRunChangedEventArgs(runStats, lastChunkTestResults, []); // Adding Metrics along with Test Run Complete Event Args Collection? attachments = FrameworkHandle?.Attachments; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithTests.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithTests.cs index 291e7a5671..2049a17bcf 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithTests.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithTests.cs @@ -131,7 +131,7 @@ private static Dictionary, List> GetExecutorVsTestC } else { - testList = new List { test }; + testList = [test]; result.Add(executorUriExtensionTuple, testList); } } diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/PostProcessing/PostProcessingTestRunAttachmentsProcessingEventsHandler.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/PostProcessing/PostProcessingTestRunAttachmentsProcessingEventsHandler.cs index 686a83d0d0..668f5d4cf4 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/PostProcessing/PostProcessingTestRunAttachmentsProcessingEventsHandler.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/PostProcessing/PostProcessingTestRunAttachmentsProcessingEventsHandler.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.Linq; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; @@ -50,7 +49,7 @@ public void HandleProcessedAttachmentsChunk(IEnumerable attachmen public void HandleTestRunAttachmentsProcessingComplete(TestRunAttachmentsProcessingCompleteEventArgs attachmentsProcessingCompleteEventArgs, IEnumerable? lastChunk) { - foreach (var attachment in lastChunk ?? Enumerable.Empty()) + foreach (var attachment in lastChunk ?? []) { _attachmentsSet.Add(attachment); } diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs index 1f3f483d29..3628a29c89 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs @@ -356,7 +356,7 @@ private void ValidateAndAddCrashProcessDumpParameters(XmlElement collectDumpNode && !string.Equals(attribute.Value, Constants.FalseConfigurationValue, StringComparison.OrdinalIgnoreCase)) || !bool.TryParse(attribute.Value, out _collectDumpAlways)) { - _logger.LogWarning(_context.SessionDataCollectionContext, FormatBlameParameterValueIncorrectMessage(attribute, new[] { Constants.TrueConfigurationValue, Constants.FalseConfigurationValue })); + _logger.LogWarning(_context.SessionDataCollectionContext, FormatBlameParameterValueIncorrectMessage(attribute, [Constants.TrueConfigurationValue, Constants.FalseConfigurationValue])); } break; diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/NetClientCrashDumper.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/NetClientCrashDumper.cs index 333a123a21..f705eadf19 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/NetClientCrashDumper.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/NetClientCrashDumper.cs @@ -35,7 +35,7 @@ public IEnumerable GetDumpFiles(bool _) { return _fileHelper.DirectoryExists(_outputDirectory) ? _fileHelper.GetFiles(_outputDirectory, "*_crashdump*.dmp", SearchOption.AllDirectories) - : Array.Empty(); + : []; } public void WaitForDumpToFinish() diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpDumper.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpDumper.cs index a4130d6d2c..1c6e39a935 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpDumper.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcDumpDumper.cs @@ -241,7 +241,7 @@ public IEnumerable GetDumpFiles(bool processCrashed) { var allDumps = _fileHelper.DirectoryExists(_outputDirectory) ? _fileHelper.GetFiles(_outputDirectory, "*_crashdump*.dmp", SearchOption.AllDirectories) - : Array.Empty(); + : []; // We are always collecting dump on exit even when collectAlways option is false, to make sure we collect // dump for Environment.FailFast. So there always can be a dump if the process already exited. In most cases diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcessDumpUtility.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcessDumpUtility.cs index fc42574303..e5eb1be159 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcessDumpUtility.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/ProcessDumpUtility.cs @@ -60,7 +60,7 @@ public IEnumerable GetDumpFiles(bool warnOnNoDumpFiles, bool processCras IEnumerable hangDumps = _fileHelper.DirectoryExists(_hangDumpDirectory) ? _fileHelper.GetFiles(_hangDumpDirectory, "*_hangdump*.dmp", SearchOption.TopDirectoryOnly) - : Array.Empty(); + : []; var foundDumps = new List(); foreach (var dumpPath in crashDumps.Concat(hangDumps)) diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs index bcef64a85f..2b37511660 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs @@ -342,11 +342,11 @@ internal void TestRunCompleteHandler(object? sender, TestRunCompleteEventArgs e) helper.SaveIEnumerable(_entries.Values, rootElement, "TestEntries", ".", "TestEntry", parameters); // Save default categories - List categories = new() - { + List categories = + [ TestListCategory.UncategorizedResults, TestListCategory.AllResults - }; + ]; helper.SaveList(categories, rootElement, "TestLists", ".", "TestList", parameters); // Save summary @@ -357,7 +357,7 @@ internal void TestRunCompleteHandler(object? sender, TestRunCompleteEventArgs e) TestResultOutcome = ChangeTestOutcomeIfNecessary(TestResultOutcome); - List errorMessages = new(); + List errorMessages = []; List collectorEntries = _converter.ToCollectionEntries(e.AttachmentSets, LoggerTestRun, _testResultsDirPath); IList resultFiles = _converter.ToResultFiles(e.AttachmentSets, LoggerTestRun, _testResultsDirPath, errorMessages); diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs index bddab2bb64..3a8a7b69c1 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs @@ -278,10 +278,10 @@ public static List GetCustomPropertyValueFromTestCase(TestCase testCase, if (customProperty != null) { var cateogryValues = (string[]?)testCase.GetPropertyValue(customProperty); - return cateogryValues != null ? cateogryValues.ToList() : Enumerable.Empty().ToList(); + return cateogryValues != null ? cateogryValues.ToList() : []; } - return Enumerable.Empty().ToList(); + return []; } /// diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/TrxFileHelper.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/TrxFileHelper.cs index 58b2f6df05..8104df9806 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/TrxFileHelper.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/TrxFileHelper.cs @@ -183,7 +183,7 @@ public static string MakePathRelative(string path, string basePath) path = Path.GetFullPath(path); basePath = Path.GetFullPath(basePath); - char[] delimiters = new char[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }; + char[] delimiters = [Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar]; basePath = basePath.TrimEnd(delimiters); path = path.TrimEnd(delimiters); diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs index 8808c57314..1bae61bb92 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs @@ -706,7 +706,7 @@ private static string ReplaceInvalidCharacterWithUniCodeEscapeSequence(Match mat } else { - string[] parts = location.Split(new char[] { '/' }, 2); + string[] parts = location.Split(['/'], 2); string firstPart = parts[0]; XmlNode? firstChild = LocationToXmlNode(xml, firstPart); @@ -805,7 +805,7 @@ private string ProcessXPathQuery(string queryIn) } // fix the empty namespaces to a temp prefix, so xpath query can understand them - string[] parts = queryIn.Split(new char[] { '/' }, StringSplitOptions.None); + string[] parts = queryIn.Split(['/'], StringSplitOptions.None); StringBuilder query = new(); diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Common/RequestId.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Common/RequestId.cs index 583f2882c8..0f882551bd 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Common/RequestId.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Common/RequestId.cs @@ -133,7 +133,7 @@ public int CompareTo(object? obj) RequestId? other = obj as RequestId; return other == null - ? throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.Resources.Common_ObjectMustBeOfType, new object[] { typeof(RequestId).Name }), nameof(obj)) + ? throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.Resources.Common_ObjectMustBeOfType, [typeof(RequestId).Name]), nameof(obj)) : Id.CompareTo(other.Id); } diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/TransferInformation/FileTransferInformation.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/TransferInformation/FileTransferInformation.cs index 9f691969a4..45aed5c42c 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/TransferInformation/FileTransferInformation.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/TransferInformation/FileTransferInformation.cs @@ -60,7 +60,7 @@ public FileTransferInformation(DataCollectionContext context, string path, bool // Make sure the file exists. if (!_fileHelper.Exists(path)) { - throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.Resources.Common_FileNotExist, new object[] { path }), path); + throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.Resources.Common_FileNotExist, [path]), path); } // Make sure the path we have is a full path (not relative). diff --git a/src/Microsoft.TestPlatform.ObjectModel/Navigation/DiaSession.cs b/src/Microsoft.TestPlatform.ObjectModel/Navigation/DiaSession.cs index d247c22514..1130173962 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Navigation/DiaSession.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Navigation/DiaSession.cs @@ -20,7 +20,7 @@ public class DiaSession : INavigationSession /// /// Characters that should be stripped off the end of test names. /// - private static readonly char[] TestNameStripChars = { '(', ')', ' ' }; + private static readonly char[] TestNameStripChars = ['(', ')', ' ']; /// /// The symbol reader. diff --git a/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/DefaultFrameworkMappings.cs b/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/DefaultFrameworkMappings.cs index b1492de902..cc943d021a 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/DefaultFrameworkMappings.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/DefaultFrameworkMappings.cs @@ -11,7 +11,8 @@ internal sealed class DefaultFrameworkMappings : IFrameworkMappings { private static Lazy[]> IdentifierSynonymsLazy = new(() => { - return new[]{ + return + [ // .NET new KeyValuePair("NETFramework", FrameworkConstants.FrameworkIdentifiers.Net), new KeyValuePair(".NET", FrameworkConstants.FrameworkIdentifiers.Net), @@ -31,8 +32,8 @@ internal sealed class DefaultFrameworkMappings : IFrameworkMappings new KeyValuePair("XamarinPlayStationThree", FrameworkConstants.FrameworkIdentifiers.XamarinPlayStation3), new KeyValuePair("Xamarin.PlayStationFour", FrameworkConstants.FrameworkIdentifiers.XamarinPlayStation4), new KeyValuePair("XamarinPlayStationFour", FrameworkConstants.FrameworkIdentifiers.XamarinPlayStation4), - new KeyValuePair("XamarinPlayStationVita", FrameworkConstants.FrameworkIdentifiers.XamarinPlayStationVita), - }; + new KeyValuePair("XamarinPlayStationVita", FrameworkConstants.FrameworkIdentifiers.XamarinPlayStationVita) + ]; }); public IEnumerable> IdentifierSynonyms @@ -45,8 +46,8 @@ public IEnumerable> IdentifierSynonyms private static readonly Lazy[]> IdentifierShortNamesLazy = new(() => { - return new[] - { + return + [ new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.NetCoreApp, "netcoreapp"), new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.NetStandardApp, "netstandardapp"), new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.NetStandard, "netstandard"), @@ -79,8 +80,8 @@ public IEnumerable> IdentifierSynonyms new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.WinRT, "winrt"), // legacy new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.UAP, "uap"), new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.Tizen, "tizen"), - new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.NanoFramework, "netnano"), - }; + new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.NanoFramework, "netnano") + ]; }); public IEnumerable> IdentifierShortNames @@ -93,14 +94,14 @@ public IEnumerable> IdentifierShortNames private static readonly Lazy ProfileShortNamesLazy = new(() => { - return new[] - { + return + [ new FrameworkSpecificMapping(FrameworkConstants.FrameworkIdentifiers.Net, "Client", "Client"), new FrameworkSpecificMapping(FrameworkConstants.FrameworkIdentifiers.Net, "CF", "CompactFramework"), new FrameworkSpecificMapping(FrameworkConstants.FrameworkIdentifiers.Net, "Full", string.Empty), new FrameworkSpecificMapping(FrameworkConstants.FrameworkIdentifiers.Silverlight, "WP", "WindowsPhone"), - new FrameworkSpecificMapping(FrameworkConstants.FrameworkIdentifiers.Silverlight, "WP71", "WindowsPhone71"), - }; + new FrameworkSpecificMapping(FrameworkConstants.FrameworkIdentifiers.Silverlight, "WP71", "WindowsPhone71") + ]; }); public IEnumerable ProfileShortNames @@ -113,8 +114,8 @@ public IEnumerable ProfileShortNames private static readonly Lazy[]> EquivalentFrameworksLazy = new(() => { - return new[] - { + return + [ // UAP 0.0 <-> UAP 10.0 new KeyValuePair( new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.UAP, FrameworkConstants.EmptyVersion), @@ -219,8 +220,8 @@ public IEnumerable ProfileShortNames // dnxcore50 <-> aspnetcore50 new KeyValuePair( FrameworkConstants.CommonFrameworks.DnxCore50, - FrameworkConstants.CommonFrameworks.AspNetCore50), - }; + FrameworkConstants.CommonFrameworks.AspNetCore50) + ]; }); public IEnumerable> EquivalentFrameworks @@ -233,14 +234,14 @@ public IEnumerable> EquivalentFrame private static readonly Lazy EquivalentProfilesLazy = new(() => { - return new[] - { + return + [ // The client profile, for the purposes of NuGet, is the same as the full framework new FrameworkSpecificMapping(FrameworkConstants.FrameworkIdentifiers.Net, "Client", string.Empty), new FrameworkSpecificMapping(FrameworkConstants.FrameworkIdentifiers.Net, "Full", string.Empty), new FrameworkSpecificMapping(FrameworkConstants.FrameworkIdentifiers.Silverlight, "WindowsPhone71", "WindowsPhone"), - new FrameworkSpecificMapping(FrameworkConstants.FrameworkIdentifiers.WindowsPhone, "WindowsPhone71", "WindowsPhone"), - }; + new FrameworkSpecificMapping(FrameworkConstants.FrameworkIdentifiers.WindowsPhone, "WindowsPhone71", "WindowsPhone") + ]; }); public IEnumerable EquivalentProfiles @@ -253,8 +254,8 @@ public IEnumerable EquivalentProfiles private static readonly Lazy[]> SubSetFrameworksLazy = new(() => { - return new[] - { + return + [ // .NET is a subset of DNX new KeyValuePair( FrameworkConstants.FrameworkIdentifiers.Net, @@ -269,7 +270,7 @@ public IEnumerable EquivalentProfiles new KeyValuePair( FrameworkConstants.FrameworkIdentifiers.NetStandard, FrameworkConstants.FrameworkIdentifiers.NetStandardApp) - }; + ]; }); public IEnumerable> SubSetFrameworks @@ -553,13 +554,13 @@ private static IEnumerable CreateGenerationAndS private static readonly Lazy NonPackageBasedFrameworkPrecedenceLazy = new(() => { - return new[] - { + return + [ FrameworkConstants.FrameworkIdentifiers.Net, FrameworkConstants.FrameworkIdentifiers.NetCore, FrameworkConstants.FrameworkIdentifiers.Windows, FrameworkConstants.FrameworkIdentifiers.WindowsPhoneApp - }; + ]; }); public IEnumerable NonPackageBasedFrameworkPrecedence @@ -572,13 +573,13 @@ public IEnumerable NonPackageBasedFrameworkPrecedence private static readonly Lazy PackageBasedFrameworkPrecedenceLazy = new(() => { - return new[] - { + return + [ FrameworkConstants.FrameworkIdentifiers.NetCoreApp, FrameworkConstants.FrameworkIdentifiers.NetStandardApp, FrameworkConstants.FrameworkIdentifiers.NetStandard, FrameworkConstants.FrameworkIdentifiers.NetPlatform - }; + ]; }); public IEnumerable PackageBasedFrameworkPrecedence @@ -591,8 +592,8 @@ public IEnumerable PackageBasedFrameworkPrecedence private static readonly Lazy EquivalentFrameworkPrecedenceLazy = new(() => { - return new[] - { + return + [ FrameworkConstants.FrameworkIdentifiers.Windows, FrameworkConstants.FrameworkIdentifiers.NetCore, FrameworkConstants.FrameworkIdentifiers.WinRT, @@ -605,7 +606,7 @@ public IEnumerable PackageBasedFrameworkPrecedence FrameworkConstants.FrameworkIdentifiers.Dnx, FrameworkConstants.FrameworkIdentifiers.AspNet - }; + ]; }); public IEnumerable EquivalentFrameworkPrecedence @@ -618,10 +619,10 @@ public IEnumerable EquivalentFrameworkPrecedence private static readonly Lazy[]> ShortNameReplacementsLazy = new(() => { - return new[] - { + return + [ new KeyValuePair(FrameworkConstants.CommonFrameworks.DotNet50, FrameworkConstants.CommonFrameworks.DotNet) - }; + ]; }); public IEnumerable> ShortNameReplacements @@ -634,10 +635,10 @@ public IEnumerable> ShortNameReplac private static readonly Lazy[]> FullNameReplacementsLazy = new(() => { - return new[] - { + return + [ new KeyValuePair(FrameworkConstants.CommonFrameworks.DotNet, FrameworkConstants.CommonFrameworks.DotNet50) - }; + ]; }); public IEnumerable> FullNameReplacements diff --git a/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/DefaultPortableFrameworkMappings.cs b/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/DefaultPortableFrameworkMappings.cs index d36320d326..bcb22c4a3e 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/DefaultPortableFrameworkMappings.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/DefaultPortableFrameworkMappings.cs @@ -32,8 +32,8 @@ internal class DefaultPortableFrameworkMappings : IPortableFrameworkMappings var wpa81 = FrameworkConstants.CommonFrameworks.WPA81; - return new[] - { + return + [ // v4.6 CreateProfileFrameworks(31, win81, wp81), CreateProfileFrameworks(32, win81, wpa81), @@ -82,8 +82,8 @@ internal class DefaultPortableFrameworkMappings : IPortableFrameworkMappings CreateProfileFrameworks(255, net45, sl5, win8, wpa81), CreateProfileFrameworks(328, net4, sl5, win8, wpa81, wp8), CreateProfileFrameworks(336, net403, sl5, win8, wpa81, wp8), - CreateProfileFrameworks(344, net45, sl5, win8, wpa81, wp8), - }; + CreateProfileFrameworks(344, net45, sl5, win8, wpa81, wp8) + ]; }); public IEnumerable> ProfileFrameworks @@ -101,9 +101,9 @@ private static KeyValuePair CreateProfileFrameworks(int p // profiles that also support monotouch1+monoandroid1 private static readonly int[] ProfilesWithOptionalFrameworks = - { - 5, 6, 7, 14, 19, 24, 37, 42, 44, 47, 49, 78, 92, 102, 111, 136, 147, 151, 158, 225, 255, 259, 328, 336, 344 - }; + [ + 5, 6, 7, 14, 19, 24, 37, 42, 44, 47, 49, 78, 92, 102, 111, 136, 147, 151, 158, 225, 255, 259, 328, 336, 344 + ]; private static readonly Lazy>> ProfileOptionalFrameworksLazy = new(() => { @@ -135,8 +135,8 @@ public IEnumerable> ProfileOptionalFramework private static readonly Lazy[]> CompatibilityMappingsLazy = new(() => { - return new[] - { + return + [ CreateStandardMapping(7, FrameworkConstants.CommonFrameworks.NetStandard11), CreateStandardMapping(31, FrameworkConstants.CommonFrameworks.NetStandard10), CreateStandardMapping(32, FrameworkConstants.CommonFrameworks.NetStandard12), @@ -148,7 +148,7 @@ public IEnumerable> ProfileOptionalFramework CreateStandardMapping(151, FrameworkConstants.CommonFrameworks.NetStandard12), CreateStandardMapping(157, FrameworkConstants.CommonFrameworks.NetStandard10), CreateStandardMapping(259, FrameworkConstants.CommonFrameworks.NetStandard10) - }; + ]; }); public IEnumerable> CompatibilityMappings diff --git a/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/FrameworkNameProvider.cs b/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/FrameworkNameProvider.cs index 4c810b6564..1a52d91003 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/FrameworkNameProvider.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/FrameworkNameProvider.cs @@ -341,7 +341,7 @@ private HashSet RemoveDuplicateFramework(IEnumerable RemoveDuplicateFramework(IEnumerable - /// Get all equivalent frameworks including the given framework - /// + /// + /// Get all equivalent frameworks including the given framework + /// private HashSet GetAllEquivalentFrameworks(NuGetFramework framework) { - // Loop through the frameworks, all frameworks that are not in results yet - // will be added to toProcess to get the equivalent frameworks + // Loop through the frameworks, all frameworks that are not in results yet + // will be added to toProcess to get the equivalent frameworks var toProcess = new Stack(); var results = new HashSet(); @@ -486,7 +486,7 @@ public bool TryGetPortableFrameworks(string shortPortableProfiles, [NotNullWhen( throw new ArgumentNullException(nameof(shortPortableProfiles)); } - var shortNames = shortPortableProfiles.Split(new char[] { '+' }, StringSplitOptions.RemoveEmptyEntries); + var shortNames = shortPortableProfiles.Split(['+'], StringSplitOptions.RemoveEmptyEntries); var result = new List(); foreach (var name in shortNames) @@ -545,7 +545,7 @@ public bool TryGetPortableFrameworks(string profile, bool includeOptional, [NotN return true; } - frameworks = Enumerable.Empty(); + frameworks = []; return false; } diff --git a/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/FrameworkReducer.cs b/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/FrameworkReducer.cs index 097ee2f7ac..9c2ab2fd57 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/FrameworkReducer.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/FrameworkReducer.cs @@ -442,7 +442,7 @@ private IEnumerable ExplodePortableFramework(NuGetFramework pcl, if (!_mappings.TryGetPortableFrameworks(pcl.Profile, includeOptional, out IEnumerable? frameworks)) { Debug.Fail("Unable to get portable frameworks from: " + pcl.ToString()); - frameworks = Enumerable.Empty(); + frameworks = []; } return frameworks; diff --git a/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/NuGetFrameworkFactory.cs b/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/NuGetFrameworkFactory.cs index 6d5329f20d..019fde8102 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/NuGetFrameworkFactory.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/NuGetFrameworkFactory.cs @@ -136,7 +136,7 @@ internal static NuGetFramework ParseComponents(string targetFrameworkMoniker, st return result; } - private static readonly char[] CommaSeparator = new char[] { ',' }; + private static readonly char[] CommaSeparator = [',']; private static string[] GetParts(string targetPlatformMoniker) { diff --git a/src/Microsoft.TestPlatform.ObjectModel/TestCase.cs b/src/Microsoft.TestPlatform.ObjectModel/TestCase.cs index d949ede703..b9c260fb9f 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/TestCase.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/TestCase.cs @@ -339,7 +339,7 @@ public static class TestCaseProperties public static readonly TestProperty LineNumber = TestProperty.Register("TestCase.LineNumber", LineNumberLabel, typeof(int), TestPropertyAttributes.Hidden, typeof(TestCase)); internal static TestProperty[] Properties { get; } = - { + [ CodeFilePath, DisplayName, ExecutorUri, @@ -347,7 +347,7 @@ public static class TestCaseProperties Id, LineNumber, Source - }; + ]; private static bool ValidateName(object? value) { diff --git a/src/Microsoft.TestPlatform.ObjectModel/TestProperty/CustomKeyValueConverter.cs b/src/Microsoft.TestPlatform.ObjectModel/TestProperty/CustomKeyValueConverter.cs index b1baf611a5..75f4742a45 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/TestProperty/CustomKeyValueConverter.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/TestProperty/CustomKeyValueConverter.cs @@ -45,7 +45,7 @@ public override bool CanConvertFrom(ITypeDescriptorContext? context, Type source using var stream = new MemoryStream(Encoding.Unicode.GetBytes(data)); // Converting Json data to array of KeyValuePairs with duplicate keys. var listOfTraitObjects = _serializer.ReadObject(stream) as TraitObject[]; - return listOfTraitObjects?.Select(trait => new KeyValuePair(trait.Key, trait.Value)).ToArray() ?? new KeyValuePair[0]; + return listOfTraitObjects?.Select(trait => new KeyValuePair(trait.Key, trait.Value)).ToArray() ?? []; } return null; diff --git a/src/Microsoft.TestPlatform.ObjectModel/TestResult.cs b/src/Microsoft.TestPlatform.ObjectModel/TestResult.cs index 35838f1b31..7e9c33c528 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/TestResult.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/TestResult.cs @@ -320,7 +320,7 @@ public static class TestResultProperties public static readonly TestProperty ErrorStackTrace = TestProperty.Register("TestResult.ErrorStackTrace", Resources.Resources.TestResultPropertyErrorStackTraceLabel, typeof(string), typeof(TestResult)); #endif internal static TestProperty[] Properties { get; } = - { + [ ComputerName, DisplayName, Duration, @@ -329,7 +329,7 @@ public static class TestResultProperties ErrorStackTrace, Outcome, StartTime - }; + ]; private static bool ValidateOutcome(object? value) { diff --git a/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyLoadWorker.cs b/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyLoadWorker.cs index 545e3bcfad..aefba93a27 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyLoadWorker.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Utilities/AssemblyLoadWorker.cs @@ -96,7 +96,7 @@ internal static string GetTargetFrameworkStringFromAssembly(Assembly assembly) AssemblyName[] assemblies = a.GetReferencedAssemblies(); return assemblies == null || assemblies.Length == 0 - ? (new string[0]) + ? ([]) : (from assembly in assemblies select assembly.FullName).ToArray(); } diff --git a/src/Microsoft.TestPlatform.ObjectModel/Utilities/FilterHelper.cs b/src/Microsoft.TestPlatform.ObjectModel/Utilities/FilterHelper.cs index 7056264d71..eda82c44ca 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Utilities/FilterHelper.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Utilities/FilterHelper.cs @@ -11,7 +11,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; public static class FilterHelper { public const char EscapeCharacter = '\\'; - private static readonly char[] SpecialCharacters = { '\\', '(', ')', '&', '|', '=', '!', '~' }; + private static readonly char[] SpecialCharacters = ['\\', '(', ')', '&', '|', '=', '!', '~']; private static readonly HashSet SpecialCharactersSet = new(SpecialCharacters); /// diff --git a/src/Microsoft.TestPlatform.Utilities/CodeCoverageDataAttachmentsHandler.cs b/src/Microsoft.TestPlatform.Utilities/CodeCoverageDataAttachmentsHandler.cs index be2a1030f3..2a8241906c 100644 --- a/src/Microsoft.TestPlatform.Utilities/CodeCoverageDataAttachmentsHandler.cs +++ b/src/Microsoft.TestPlatform.Utilities/CodeCoverageDataAttachmentsHandler.cs @@ -129,7 +129,7 @@ public async Task> ProcessAttachmentSetsAsync(XmlElem TPDebug.Assert(s_mergeOperationEnumValues != null); - var task = (Task)s_mergeMethodInfo.Invoke(s_classInstance, new object[] { files[0], files, s_mergeOperationEnumValues.GetValue(0)!, true, cancellationToken })!; + var task = (Task)s_mergeMethodInfo.Invoke(s_classInstance, [files[0], files, s_mergeOperationEnumValues.GetValue(0)!, true, cancellationToken])!; await task.ConfigureAwait(false); if (task.GetType().GetProperty("Result")!.GetValue(task, null) is not IList mergedResults) @@ -176,6 +176,6 @@ private static void LoadCodeCoverageAssembly() var types = s_codeCoverageAssembly.GetTypes(); var mergeOperationEnum = Array.Find(types, d => d.Name == CoverageMergeOperationName)!; s_mergeOperationEnumValues = Enum.GetValues(mergeOperationEnum); - s_mergeMethodInfo = classType.GetMethod(MergeMethodName, new[] { typeof(string), typeof(IList), mergeOperationEnum, typeof(bool), typeof(CancellationToken) })!; + s_mergeMethodInfo = classType.GetMethod(MergeMethodName, [typeof(string), typeof(IList), mergeOperationEnum, typeof(bool), typeof(CancellationToken)])!; } } diff --git a/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs b/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs index 2488ff2d4d..8d28e6c5dc 100644 --- a/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs +++ b/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs @@ -55,7 +55,11 @@ public class InferRunSettingsHelper private const string LegacyElementsString = "Elements"; private const string DeploymentAttributesString = "DeploymentAttributes"; private const string ExecutionAttributesString = "ExecutionAttributes"; - private static readonly List ExecutionNodesPaths = new() { @"/RunSettings/LegacySettings/Execution/TestTypeSpecific/UnitTestRunConfig/AssemblyResolution", @"/RunSettings/LegacySettings/Execution/Timeouts", @"/RunSettings/LegacySettings/Execution/Hosts" }; + private static readonly List ExecutionNodesPaths = + [ + @"/RunSettings/LegacySettings/Execution/TestTypeSpecific/UnitTestRunConfig/AssemblyResolution", + @"/RunSettings/LegacySettings/Execution/Timeouts", @"/RunSettings/LegacySettings/Execution/Hosts" + ]; /// /// Make runsettings compatible with testhost of version 15.0.0-preview diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index ea17ec6555..e3b99521c7 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -1155,7 +1155,7 @@ public Task ProcessTestRunAttachmentsAsync( bool collectMetrics, ITestRunAttachmentsProcessingEventsHandler testSessionEventsHandler, CancellationToken cancellationToken) - => ProcessTestRunAttachmentsAsync(attachments, Enumerable.Empty(), processingSettings, isLastBatch, collectMetrics, testSessionEventsHandler, cancellationToken); + => ProcessTestRunAttachmentsAsync(attachments, [], processingSettings, isLastBatch, collectMetrics, testSessionEventsHandler, cancellationToken); #endregion diff --git a/src/testhost.x86/AppDomainEngineInvoker.cs b/src/testhost.x86/AppDomainEngineInvoker.cs index 0401e6bc32..344790949b 100644 --- a/src/testhost.x86/AppDomainEngineInvoker.cs +++ b/src/testhost.x86/AppDomainEngineInvoker.cs @@ -106,7 +106,7 @@ private static IEngineInvoker CreateInvokerInAppDomain(AppDomain appDomain) false, BindingFlags.Default, null, - new object?[] { CultureInfo.DefaultThreadCurrentUICulture?.Name, Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) }, + [CultureInfo.DefaultThreadCurrentUICulture?.Name, Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)], null, null); @@ -247,7 +247,7 @@ public CustomAssemblySetup(string uiCulture, string testPlatformPath) CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.CreateSpecificCulture(uiCulture); } - _resolverPaths = new string[] { testPlatformPath, Path.Combine(testPlatformPath, "Extensions") }; + _resolverPaths = [testPlatformPath, Path.Combine(testPlatformPath, "Extensions")]; _resolvedAssemblies = new Dictionary(); AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; } diff --git a/src/testhost.x86/UnitTestClient.cs b/src/testhost.x86/UnitTestClient.cs index b28b0f4ce8..de0f39cfa6 100644 --- a/src/testhost.x86/UnitTestClient.cs +++ b/src/testhost.x86/UnitTestClient.cs @@ -55,6 +55,6 @@ internal static string[] SplitArguments(string commandLine) parmChars[index] = '\n'; } - return (new string(parmChars)).Split(new[] { '\n' }); + return (new string(parmChars)).Split(['\n']); } } diff --git a/src/vstest.console/CommandLine/Executor.cs b/src/vstest.console/CommandLine/Executor.cs index beb8185b71..951a4166e1 100644 --- a/src/vstest.console/CommandLine/Executor.cs +++ b/src/vstest.console/CommandLine/Executor.cs @@ -141,7 +141,7 @@ internal int Execute(params string[]? args) if (args == null || args.Length == 0 || args.Any(StringUtils.IsNullOrWhiteSpace)) { Output.Error(true, CommandLineResources.NoArgumentsProvided); - args = new string[] { HelpArgumentProcessor.CommandName }; + args = [HelpArgumentProcessor.CommandName]; exitCode = 1; } diff --git a/src/vstest.console/Internal/FilePatternParser.cs b/src/vstest.console/Internal/FilePatternParser.cs index 918d7a3805..804739ca7e 100644 --- a/src/vstest.console/Internal/FilePatternParser.cs +++ b/src/vstest.console/Internal/FilePatternParser.cs @@ -27,7 +27,7 @@ public class FilePatternParser { private readonly Matcher _matcher; private readonly IFileHelper _fileHelper; - private readonly char[] _wildCardCharacters = { '*' }; + private readonly char[] _wildCardCharacters = ['*']; public FilePatternParser() : this(new Matcher(), new FileHelper()) diff --git a/src/vstest.console/Processors/CollectArgumentProcessor.cs b/src/vstest.console/Processors/CollectArgumentProcessor.cs index 2a6ea0761f..c050e85f22 100644 --- a/src/vstest.console/Processors/CollectArgumentProcessor.cs +++ b/src/vstest.console/Processors/CollectArgumentProcessor.cs @@ -241,7 +241,7 @@ private static bool DoesDataCollectorSettingsExist(string friendlyName, internal static void AddDataCollectorToRunSettings(string arguments, IRunSettingsProvider runSettingsManager, IFileHelper fileHelper) { - AddDataCollectorToRunSettings(new string[] { arguments }, runSettingsManager, fileHelper, string.Empty); + AddDataCollectorToRunSettings([arguments], runSettingsManager, fileHelper, string.Empty); } internal static void AddDataCollectorToRunSettings(string[] arguments, IRunSettingsProvider runSettingsManager, IFileHelper fileHelper, string exceptionMessage) diff --git a/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs b/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs index 783e2d967c..21b04d3976 100644 --- a/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs +++ b/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs @@ -77,7 +77,8 @@ internal class EnableCodeCoverageArgumentExecutor : IArgumentExecutor internal const string FriendlyName = "Code Coverage"; private static readonly string XPathSeperator = "/"; - private static readonly string[] NodeNames = new string[] { Constants.RunSettingsName, Constants.DataCollectionRunSettingsName, Constants.DataCollectorsSettingName, Constants.DataCollectorSettingName }; + private static readonly string[] NodeNames = [Constants.RunSettingsName, Constants.DataCollectionRunSettingsName, Constants.DataCollectorsSettingName, Constants.DataCollectorSettingName + ]; #region Default CodeCoverage Settings String @@ -258,7 +259,7 @@ private static string GetMissingNodesTextIfAny(string existingPath, string fullp { var xmlText = "{0}"; var nonExistingPath = fullpath.Substring(existingPath.Length); - var requiredNodeNames = nonExistingPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + var requiredNodeNames = nonExistingPath.Split(['/'], StringSplitOptions.RemoveEmptyEntries); var format = "<{0}>{1}"; foreach (var nodeName in requiredNodeNames) diff --git a/src/vstest.console/Processors/TestAdapterLoadingStrategyArgumentProcessor.cs b/src/vstest.console/Processors/TestAdapterLoadingStrategyArgumentProcessor.cs index 92b4a73e74..5fcb2d2b99 100644 --- a/src/vstest.console/Processors/TestAdapterLoadingStrategyArgumentProcessor.cs +++ b/src/vstest.console/Processors/TestAdapterLoadingStrategyArgumentProcessor.cs @@ -195,7 +195,7 @@ private void ForceIsolation() private void ValidateTestAdapterPaths(TestAdapterLoadingStrategy strategy) { - var testAdapterPaths = _commandLineOptions.TestAdapterPath ?? new string[0]; + var testAdapterPaths = _commandLineOptions.TestAdapterPath ?? []; if (!_commandLineOptions.TestAdapterPathsSet) { testAdapterPaths = TestAdapterPathArgumentExecutor.SplitPaths(_runSettingsManager.QueryRunSettingsNode(TestAdapterPathArgumentExecutor.RunSettingsPath)).Union(testAdapterPaths).Distinct().ToArray(); diff --git a/src/vstest.console/Processors/TestAdapterPathArgumentProcessor.cs b/src/vstest.console/Processors/TestAdapterPathArgumentProcessor.cs index 2c1ab3f7b0..701d1b37ce 100644 --- a/src/vstest.console/Processors/TestAdapterPathArgumentProcessor.cs +++ b/src/vstest.console/Processors/TestAdapterPathArgumentProcessor.cs @@ -96,7 +96,7 @@ internal class TestAdapterPathArgumentExecutor : IArgumentExecutor /// /// Separators for multiple paths in argument. /// - internal readonly static char[] ArgumentSeparators = new[] { ';' }; + internal readonly static char[] ArgumentSeparators = [';']; public const string RunSettingsPath = "RunConfiguration.TestAdaptersPaths"; @@ -132,7 +132,7 @@ public void Initialize(string? argument) // VSTS task add double quotes around TestAdapterpath. For example if user has given TestAdapter path C:\temp, // Then VSTS task will add TestAdapterPath as "/TestAdapterPath:\"C:\Temp\"". // Remove leading and trailing ' " ' chars... - argument = argument.Trim().Trim(new char[] { '\"' }); + argument = argument.Trim().Trim(['\"']); // Get test adapter paths from RunSettings. var testAdapterPathsInRunSettings = _runSettingsManager.QueryRunSettingsNode(RunSettingsPath); @@ -167,6 +167,6 @@ public ArgumentProcessorResult Execute() /// Paths. internal static string[] SplitPaths(string? paths) { - return paths.IsNullOrWhiteSpace() ? new string[0] : paths.Split(ArgumentSeparators, StringSplitOptions.RemoveEmptyEntries); + return paths.IsNullOrWhiteSpace() ? [] : paths.Split(ArgumentSeparators, StringSplitOptions.RemoveEmptyEntries); } } diff --git a/src/vstest.console/Processors/Utilities/ArgumentProcessorUtilities.cs b/src/vstest.console/Processors/Utilities/ArgumentProcessorUtilities.cs index a5744648cd..99f9130d39 100644 --- a/src/vstest.console/Processors/Utilities/ArgumentProcessorUtilities.cs +++ b/src/vstest.console/Processors/Utilities/ArgumentProcessorUtilities.cs @@ -8,8 +8,8 @@ namespace Microsoft.VisualStudio.TestPlatform.CommandLine.Processors.Utilities; internal class ArgumentProcessorUtilities { - public static readonly char[] SemiColonArgumentSeparator = { ';' }; - public static readonly char[] EqualNameValueSeparator = { '=' }; + public static readonly char[] SemiColonArgumentSeparator = [';']; + public static readonly char[] EqualNameValueSeparator = ['=']; /// /// Get argument list from raw argument using argument separator. diff --git a/test/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests/EventLogDataCollectorTests.cs b/test/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests/EventLogDataCollectorTests.cs index abf09de509..43923342e1 100644 --- a/test/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests/EventLogDataCollectorTests.cs +++ b/test/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests/EventLogDataCollectorTests.cs @@ -95,11 +95,11 @@ public void InitializeShouldThrowExceptionIfLoggerIsNull() [TestMethod] public void InitializeShouldInitializeDefaultEventLogNames() { - List eventLogNames = new() - { + List eventLogNames = + [ "System", "Application" - }; + ]; _eventLogDataCollector.Initialize(null, _mockDataCollectionEvents.Object, _mockDataCollectionSink, _mockDataCollectionLogger.Object, _dataCollectionEnvironmentContext); @@ -113,11 +113,11 @@ public void InitializeShouldInitializeCustomEventLogNamesIfSpecifiedInConfigurat string configurationString = @""; - List eventLogNames = new() - { + List eventLogNames = + [ "MyEventName", "MyEventName2" - }; + ]; XmlDocument expectedXmlDoc = new(); expectedXmlDoc.LoadXml(configurationString); @@ -131,12 +131,12 @@ public void InitializeShouldInitializeCustomEventLogNamesIfSpecifiedInConfigurat [TestMethod] public void InitializeShouldInitializeDefaultLogEntryTypes() { - List entryTypes = new() - { + List entryTypes = + [ EventLogEntryType.Error, EventLogEntryType.Warning, EventLogEntryType.FailureAudit - }; + ]; _eventLogDataCollector.Initialize(null, _mockDataCollectionEvents.Object, _mockDataCollectionSink, _mockDataCollectionLogger.Object, _dataCollectionEnvironmentContext); @@ -150,10 +150,7 @@ public void InitializeShouldInitializeEntryTypesIfSpecifiedInConfiguration() string configurationString = @""; - List entryTypes = new() - { - EventLogEntryType.Error - }; + List entryTypes = [EventLogEntryType.Error]; XmlDocument expectedXmlDoc = new(); expectedXmlDoc.LoadXml(configurationString); @@ -169,10 +166,7 @@ public void InitializeShouldInitializeEventSourcesIfSpecifiedInConfiguration() string configurationString = @""; - List eventSources = new() - { - "MyEventSource" - }; + List eventSources = ["MyEventSource"]; XmlDocument expectedXmlDoc = new(); expectedXmlDoc.LoadXml(configurationString); diff --git a/test/Intent/Runner.cs b/test/Intent/Runner.cs index 6edf62eb0f..cbe7706cba 100644 --- a/test/Intent/Runner.cs +++ b/test/Intent/Runner.cs @@ -62,7 +62,7 @@ public static void Run(IEnumerable paths, IRunLogger logger) // Declaring type cannot be really null for types you define in C# // without doing any reflection magic. var instance = Activator.CreateInstance(method.DeclaringType!); - var testResult = method.Invoke(instance, Array.Empty()); + var testResult = method.Invoke(instance, []); if (testResult is Task task) { // When the result is a task we need to await it. diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs index 02d4bd56f9..b36ace80bc 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/BlameDataCollectorTests.cs @@ -305,7 +305,7 @@ private static bool IsAdministrator() private void ValidateDump(int expectedDumpCount = 1) { - var attachments = StdOutWithWhiteSpace.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) + var attachments = StdOutWithWhiteSpace.Split([Environment.NewLine], StringSplitOptions.RemoveEmptyEntries) .SkipWhile(l => !l.Contains("Attachments:")).Skip(1) .Where(l => !string.IsNullOrWhiteSpace(l)) .ToList(); diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DataCollectionTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DataCollectionTests.cs index a48cedbd97..9698a81144 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DataCollectionTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DataCollectionTests.cs @@ -106,7 +106,7 @@ public void DataCollectorAttachmentProcessor(RunnerInfo runnerInfo) string runSettings = GetRunsettingsFilePath(TempDirectory.Path); string diagFileName = Path.Combine(TempDirectory.Path, "diaglog.txt"); var extensionsPath = Path.GetDirectoryName(GetTestDllForFramework("AttachmentProcessorDataCollector.dll", "netstandard2.0")); - var arguments = PrepareArguments(new string[] { assemblyPath, secondAssemblyPath }, null, runSettings, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path); + var arguments = PrepareArguments([assemblyPath, secondAssemblyPath], null, runSettings, FrameworkArgValue, runnerInfo.InIsolationValue, resultsDirectory: TempDirectory.Path); arguments = string.Concat(arguments, $" /Diag:{diagFileName}", $" /TestAdapterPath:{extensionsPath}"); XElement runSettingsXml = XElement.Load(runSettings); diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DataCollectorAttachmentsProcessorsFactoryTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DataCollectorAttachmentsProcessorsFactoryTests.cs index 4bf3b42e52..5a7284c7cf 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DataCollectorAttachmentsProcessorsFactoryTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DataCollectorAttachmentsProcessorsFactoryTests.cs @@ -42,12 +42,12 @@ public void Cleanup() public void Create_ShouldReturnListOfAttachmentProcessors() { // arrange - List invokedDataCollectors = new() - { + List invokedDataCollectors = + [ new InvokedDataCollector(new Uri("datacollector://Sample"), "Sample", typeof(SampleDataCollector).AssemblyQualifiedName!, typeof(SampleDataCollector).Assembly.Location, true), new InvokedDataCollector(new Uri("datacollector://SampleData2"), "SampleData2", typeof(SampleData2Collector).AssemblyQualifiedName!, typeof(SampleData2Collector).Assembly.Location, true), new InvokedDataCollector(new Uri("datacollector://SampleData3"), "SampleData3", typeof(SampleData3Collector).AssemblyQualifiedName!, typeof(SampleData3Collector).Assembly.Location, true) - }; + ]; // act var dataCollectorAttachmentsProcessors = _dataCollectorAttachmentsProcessorsFactory.Create(invokedDataCollectors.ToArray(), null); @@ -69,7 +69,7 @@ public void Create_ShouldReturnListOfAttachmentProcessors() public void Create_EmptyOrNullInvokedDataCollector_ShouldReturnCodeCoverageDataAttachmentsHandler(bool empty) { // act - var dataCollectorAttachmentsProcessors = _dataCollectorAttachmentsProcessorsFactory.Create(empty ? Array.Empty() : null, null); + var dataCollectorAttachmentsProcessors = _dataCollectorAttachmentsProcessorsFactory.Create(empty ? [] : null, null); //assert Assert.AreEqual(1, dataCollectorAttachmentsProcessors.Length); @@ -80,10 +80,12 @@ public void Create_EmptyOrNullInvokedDataCollector_ShouldReturnCodeCoverageDataA public void Create_ShouldNotFailIfWrongDataCollectorAttachmentProcessor() { // arrange - List invokedDataCollectors = new() - { - new InvokedDataCollector(new Uri("datacollector://SampleData4"), "SampleData4", typeof(SampleData4Collector).AssemblyQualifiedName!, typeof(SampleData4Collector).Assembly.Location, true) - }; + List invokedDataCollectors = + [ + new InvokedDataCollector(new Uri("datacollector://SampleData4"), "SampleData4", + typeof(SampleData4Collector).AssemblyQualifiedName!, typeof(SampleData4Collector).Assembly.Location, + true) + ]; // act var dataCollectorAttachmentsProcessors = _dataCollectorAttachmentsProcessorsFactory.Create(invokedDataCollectors.ToArray(), null); @@ -97,10 +99,10 @@ public void Create_ShouldNotFailIfWrongDataCollectorAttachmentProcessor() public void Create_ShouldAddTwoTimeCodeCoverageDataAttachmentsHandler() { // arrange - List invokedDataCollectors = new() - { + List invokedDataCollectors = + [ new InvokedDataCollector(new Uri("datacollector://microsoft/CodeCoverage/2.0"), "SampleData5", typeof(SampleData5Collector).AssemblyQualifiedName!, typeof(SampleData5Collector).Assembly.Location, true) - }; + ]; // act var dataCollectorAttachmentsProcessors = _dataCollectorAttachmentsProcessorsFactory.Create(invokedDataCollectors.ToArray(), null); @@ -129,11 +131,11 @@ public void Create_ShouldLoadOrderingByFilePath() Directory.CreateDirectory(version2); File.Copy(dataCollectorFilePath, Path.Combine(version2, Path.GetFileName(dataCollectorFilePath)), true); - List invokedDataCollectors = new() - { + List invokedDataCollectors = + [ new InvokedDataCollector(new Uri("my://sample/datacollector"), "sample", "AttachmentProcessorDataCollector.SampleDataCollectorV2", Path.Combine(version1, Path.GetFileName(dataCollectorFilePath)), true), new InvokedDataCollector(new Uri("my://sample/datacollector"), "sample", "AttachmentProcessorDataCollector.SampleDataCollectorV2", Path.Combine(version2, Path.GetFileName(dataCollectorFilePath)), true) - }; + ]; // act var dataCollectorAttachmentsProcessors = _dataCollectorAttachmentsProcessorsFactory.Create(invokedDataCollectors.ToArray(), null); diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DiscoveryTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DiscoveryTests.cs index 12658fd877..5fc1cd39a3 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DiscoveryTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DiscoveryTests.cs @@ -97,11 +97,12 @@ public void TypesToLoadAttributeTests() var extensionsDirectory = IntegrationTestEnvironment.ExtensionsDirectory; var extensionsToVerify = new Dictionary { - {"Microsoft.TestPlatform.Extensions.EventLogCollector.dll", new[] { "Microsoft.TestPlatform.Extensions.EventLogCollector.EventLogDataCollector"} }, - {"Microsoft.TestPlatform.Extensions.BlameDataCollector.dll", new[] { "Microsoft.TestPlatform.Extensions.BlameDataCollector.BlameLogger", "Microsoft.TestPlatform.Extensions.BlameDataCollector.BlameCollector" } }, - {"Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.dll", new[] { "Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.HtmlLogger" } }, - {"Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.dll", new[] { "Microsoft.VisualStudio.TestPlatform.Extensions.TrxLogger.TrxLogger" } }, - {"Microsoft.TestPlatform.TestHostRuntimeProvider.dll", new[] { "Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DefaultTestHostManager", "Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager" } } + {"Microsoft.TestPlatform.Extensions.EventLogCollector.dll", ["Microsoft.TestPlatform.Extensions.EventLogCollector.EventLogDataCollector"] }, + {"Microsoft.TestPlatform.Extensions.BlameDataCollector.dll", ["Microsoft.TestPlatform.Extensions.BlameDataCollector.BlameLogger", "Microsoft.TestPlatform.Extensions.BlameDataCollector.BlameCollector"] }, + {"Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger.dll", ["Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.HtmlLogger"] }, + {"Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.dll", ["Microsoft.VisualStudio.TestPlatform.Extensions.TrxLogger.TrxLogger"] }, + {"Microsoft.TestPlatform.TestHostRuntimeProvider.dll", ["Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DefaultTestHostManager", "Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager"] + } }; foreach (var extension in extensionsToVerify.Keys) diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/EventLogCollectorTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/EventLogCollectorTests.cs index cc0979cd53..abadb1e3e5 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/EventLogCollectorTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/EventLogCollectorTests.cs @@ -102,9 +102,9 @@ private void VaildateDataCollectorOutput(TempDirectory tempDirectory) var eventIdsDics = new Dictionary { - { new[] { "110", "111", "112" }, false }, - { new[] { "220", "221", "222", "223" }, false }, - { new[] { "330", "331", "332" }, false } + { ["110", "111", "112"], false }, + { ["220", "221", "222", "223"], false }, + { ["330", "331", "332"], false } }; // Since there is no guaranty that test will run in a particular order, we will check file for all available list of ids @@ -112,7 +112,7 @@ private void VaildateDataCollectorOutput(TempDirectory tempDirectory) Assert.IsTrue(VerifyOrder2(fileContent2, eventIdsDics), $"Event log file content: {fileContent2}"); Assert.IsTrue(VerifyOrder2(fileContent3, eventIdsDics), $"Event log file content: {fileContent3}"); - Assert.IsTrue(VerifyOrder(fileContent4, new[] { "110", "111", "112", "220", "221", "222", "223", "330", "331", "332" }), $"Event log file content: {fileContent4}"); + Assert.IsTrue(VerifyOrder(fileContent4, ["110", "111", "112", "220", "221", "222", "223", "330", "331", "332"]), $"Event log file content: {fileContent4}"); } private static bool VerifyOrder2(string content, Dictionary eventIdsDics) diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/CompatibilityRowsBuilder.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/CompatibilityRowsBuilder.cs index c34315c42f..d798463ae2 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/CompatibilityRowsBuilder.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/CompatibilityRowsBuilder.cs @@ -155,7 +155,7 @@ public List CreateData() allRows[i].Index = i; } - return JustRow == null ? allRows : new List { allRows[JustRow.Value] }; + return JustRow == null ? allRows : [allRows[JustRow.Value]]; } private static SemanticVersion ParseAndPatchSemanticVersion(string? version) @@ -244,7 +244,7 @@ private void AddEveryVersionOfHost(List dataRows) // .NET Framework testhost ships with the runner, and the version from the // runner directory is always the same as the runner. There are no variations // so we just need to add host versions for .NET testhosts. - var hostVersions = isNetFramework ? Array.Empty() : _hostVersions.ToArray(); + var hostVersions = isNetFramework ? [] : _hostVersions.ToArray(); foreach (var hostVersion in hostVersions) { foreach (var _ in _adapters) diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreRunnerAttribute.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreRunnerAttribute.cs index 478c595d3d..7af2fedb77 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreRunnerAttribute.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreRunnerAttribute.cs @@ -59,7 +59,7 @@ public IEnumerable GetData(MethodInfo methodInfo) DebugDataCollector = DebugDataCollector, DebugStopAtEntrypoint = DebugStopAtEntrypoint, }; - dataRows.Add(new object[] { runnerInfo }); + dataRows.Add([runnerInfo]); } return dataRows; @@ -67,6 +67,6 @@ public IEnumerable GetData(MethodInfo methodInfo) public string GetDisplayName(MethodInfo methodInfo, object?[]? data) { - return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? Array.Empty())); + return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? [])); } } diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs index 5cc808dd7f..a227c37af1 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs @@ -57,7 +57,7 @@ private void AddRunnerDataRow(List dataRows, string runnerFramework, s DebugVSTestConsole = DebugVSTestConsole, DebugStopAtEntrypoint = DebugStopAtEntrypoint, }; - dataRows.Add(new object[] { runnerInfo }); + dataRows.Add([runnerInfo]); } public IEnumerable GetData(MethodInfo methodInfo) @@ -83,6 +83,6 @@ public IEnumerable GetData(MethodInfo methodInfo) public string GetDisplayName(MethodInfo methodInfo, object?[]? data) { - return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? Array.Empty())); + return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? [])); } } diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFrameworkRunnerAttribute.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFrameworkRunnerAttribute.cs index 3ade381b25..037bb03a1a 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFrameworkRunnerAttribute.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFrameworkRunnerAttribute.cs @@ -62,7 +62,7 @@ public IEnumerable GetData(MethodInfo methodInfo) DebugStopAtEntrypoint = DebugStopAtEntrypoint, }; - dataRows.Add(new object[] { runnerInfo }); + dataRows.Add([runnerInfo]); } return dataRows; @@ -70,6 +70,6 @@ public IEnumerable GetData(MethodInfo methodInfo) public string GetDisplayName(MethodInfo methodInfo, object?[]? data) { - return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? Array.Empty())); + return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? [])); } } diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFullTargetFrameworkDataSourceAttribute.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFullTargetFrameworkDataSourceAttribute.cs index c38cdde9cf..eeec157d7e 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFullTargetFrameworkDataSourceAttribute.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetFullTargetFrameworkDataSourceAttribute.cs @@ -65,7 +65,7 @@ public IEnumerable GetData(MethodInfo methodInfo) DebugDataCollector = DebugDataCollector, DebugStopAtEntrypoint = DebugStopAtEntrypoint, }; - dataRows.Add(new object[] { runnerInfo }); + dataRows.Add([runnerInfo]); } if (_useDesktopRunner && isWindows) @@ -85,7 +85,7 @@ public IEnumerable GetData(MethodInfo methodInfo) DebugDataCollector = DebugDataCollector, DebugStopAtEntrypoint = DebugStopAtEntrypoint, }; - dataRows.Add(new object[] { runnerInfo }); + dataRows.Add([runnerInfo]); } if (_inProcess) @@ -103,7 +103,7 @@ public IEnumerable GetData(MethodInfo methodInfo) DebugDataCollector = DebugDataCollector, DebugStopAtEntrypoint = DebugStopAtEntrypoint, }; - dataRows.Add(new object[] { runnerInfo }); + dataRows.Add([runnerInfo]); } } @@ -112,6 +112,6 @@ public IEnumerable GetData(MethodInfo methodInfo) public string GetDisplayName(MethodInfo methodInfo, object?[]? data) { - return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? Array.Empty())); + return string.Format(CultureInfo.CurrentCulture, "{0} ({1})", methodInfo.Name, string.Join(",", data ?? [])); } } diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/TestDataSourceAttribute.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/TestDataSourceAttribute.cs index 8b334fcb4f..d67d02f975 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/TestDataSourceAttribute.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/TestDataSourceAttribute.cs @@ -18,7 +18,7 @@ public abstract class TestDataSourceAttribute : Attribute, ITestDataSource w public void AddData(T1 value1) { - _data.Add(new object[] { value1 }); + _data.Add([value1]); } public virtual string GetDisplayName(MethodInfo methodInfo, T1 value1) @@ -49,7 +49,7 @@ public abstract class TestDataSourceAttribute : Attribute, ITestDataSour public void AddData(T1 value1, T2 value2) { - _data.Add(new object[] { value1, value2 }); + _data.Add([value1, value2]); } public virtual string GetDisplayName(MethodInfo methodInfo, T1 value1, T2 value2) @@ -81,7 +81,7 @@ public abstract class TestDataSourceAttribute : Attribute, ITestData public void AddData(T1 value1, T2 value2, T3 value3) { - _data.Add(new object[] { value1, value2, value3 }); + _data.Add([value1, value2, value3]); } public virtual string GetDisplayName(MethodInfo methodInfo, T1 value1, T2 value2, T3 value3) @@ -108,13 +108,13 @@ public abstract class TestDataSourceAttribute : Attribute, ITest where T3 : notnull where T4 : notnull { - private readonly List _data = new(); + private readonly List _data = []; public abstract void CreateData(MethodInfo methodInfo); public void AddData(T1 value1, T2 value2, T3 value3, T4 value4) { - _data.Add(new object[] { value1, value2, value3, value4 }); + _data.Add([value1, value2, value3, value4]); } public virtual string GetDisplayName(MethodInfo methodInfo, T1 value1, T2 value2, T3 value3, T4 value4) diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/FilePatternParserTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/FilePatternParserTests.cs index 04ba1df6eb..a7f30c2ad9 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/FilePatternParserTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/FilePatternParserTests.cs @@ -67,7 +67,7 @@ public void WildCardPatternShouldCorrectlyWorkForRelativeAssemblyPath(RunnerInfo var testAssembly = GetSampleTestAssembly(); testAssembly = testAssembly.Replace("SimpleTestProject.dll", "*TestProj*.dll"); - var wildCardIndex = testAssembly.IndexOfAny(new char[] { '*' }); + var wildCardIndex = testAssembly.IndexOfAny(['*']); var testAssemblyDirectory = testAssembly.Substring(0, wildCardIndex); testAssembly = testAssembly.Substring(wildCardIndex); diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/LoggerTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/LoggerTests.cs index a3092eb8d5..4bf30e4da6 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/LoggerTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/LoggerTests.cs @@ -233,7 +233,7 @@ private static void IsFileAndContentEqual(string filePath) } string filePathContent = sb.ToString(); - string[] divs = { "Total tests", "Passed", "Failed", "Skipped", "Run duration", "Pass percentage", "PassingTest" }; + string[] divs = ["Total tests", "Passed", "Failed", "Skipped", "Run duration", "Pass percentage", "PassingTest"]; foreach (string str in divs) { StringAssert.Contains(filePathContent, str); diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/RunsettingsTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/RunsettingsTests.cs index 7a22fea29d..9675f8766c 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/RunsettingsTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/RunsettingsTests.cs @@ -47,13 +47,12 @@ public void CommandLineRunSettingsShouldWinAmongAllOptions(RunnerInfo runnerInfo var runSettingsArgs = string.Join( " ", - new string[] - { + [ "RunConfiguration.MaxCpuCount=1", string.Concat("RunConfiguration.TargetPlatform=",targetPlatform), string.Concat("RunConfiguration.TargetFrameworkVersion=" , GetTargetFrameworkForRunsettings()), string.Concat("RunConfiguration.TestAdaptersPaths=" , GetTestAdapterPath()) - }); + ]); RunTestWithRunSettings(runConfigurationDictionary, runSettingsArgs, additionalArgs, testhostProcessName, expectedNumOfProcessCreated); } @@ -82,13 +81,12 @@ public void CLIRunsettingsShouldWinBetweenCLISwitchesAndCLIRunsettings(RunnerInf // Pass non parallel var runSettingsArgs = string.Join( " ", - new string[] - { + [ "RunConfiguration.MaxCpuCount=1", string.Concat("RunConfiguration.TargetPlatform=",targetPlatform), string.Concat("RunConfiguration.TargetFrameworkVersion=" , GetTargetFrameworkForRunsettings()), string.Concat("RunConfiguration.TestAdaptersPaths=" , GetTestAdapterPath()) - }); + ]); RunTestWithRunSettings(null, runSettingsArgs, additionalArgs, testhostProcessName, expectedNumOfProcessCreated); } @@ -170,13 +168,12 @@ public void RunSettingsParamsAsArguments(RunnerInfo runnerInfo) var runSettingsArgs = string.Join( " ", - new string[] - { + [ "RunConfiguration.MaxCpuCount=1", string.Concat("RunConfiguration.TargetPlatform=",targetPlatform), string.Concat("RunConfiguration.TargetFrameworkVersion=" , GetTargetFrameworkForRunsettings()), string.Concat("RunConfiguration.TestAdaptersPaths=" , GetTestAdapterPath()) - }); + ]); RunTestWithRunSettings(null, runSettingsArgs, null, testhostProcessName, expectedNumOfProcessCreated); } @@ -206,13 +203,12 @@ public void RunSettingsAndRunSettingsParamsAsArguments(RunnerInfo runnerInfo) var runSettingsArgs = string.Join( " ", - new string[] - { + [ "RunConfiguration.MaxCpuCount=1", string.Concat("RunConfiguration.TargetPlatform=",targetPlatform), string.Concat("RunConfiguration.TargetFrameworkVersion=" , GetTargetFrameworkForRunsettings()), string.Concat("RunConfiguration.TestAdaptersPaths=" , GetTestAdapterPath()) - }); + ]); RunTestWithRunSettings(runConfigurationDictionary, runSettingsArgs, null, testhostProcessName, expectedNumOfProcessCreated); } diff --git a/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/ManagedNameParserTests.cs b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/ManagedNameParserTests.cs index 9587f844c0..826de8e0d1 100644 --- a/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/ManagedNameParserTests.cs +++ b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/ManagedNameParserTests.cs @@ -45,11 +45,11 @@ void AssertParse(string expectedMethod, int expectedArity, string[] expectedPara Assert.AreEqual(("Method", 0, null), Parse("Method")); Assert.AreEqual(("Method", 0, null), Parse("Method()")); Assert.AreEqual(("Method", 2, null), Parse("Method`2()")); - AssertParse("Method", 0, new string[] { "System.Int32" }, "Method(System.Int32)"); - AssertParse("Method", 0, new string[] { "TypeA", "List" }, "Method(TypeA,List)"); - AssertParse("Method", 1, new string[] { "B", "List" }, "Method`1(B,List)"); - AssertParse("Method", 0, new string[] { "B[]" }, "Method(B[])"); - AssertParse("Method", 0, new string[] { "A[,]", "B[,,][]" }, "Method(A[,],B[,,][])"); + AssertParse("Method", 0, ["System.Int32"], "Method(System.Int32)"); + AssertParse("Method", 0, ["TypeA", "List"], "Method(TypeA,List)"); + AssertParse("Method", 1, ["B", "List"], "Method`1(B,List)"); + AssertParse("Method", 0, ["B[]"], "Method(B[])"); + AssertParse("Method", 0, ["A[,]", "B[,,][]"], "Method(A[,],B[,,][])"); // An F# method that would look like this in code: member _.``method that does not pass`` () = // And like this in CIL: instance void 'method that does not pass' () cil managed diff --git a/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/TestIdProvider/CompatibilityTests.cs b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/TestIdProvider/CompatibilityTests.cs index 18232380ee..175ea9bcb2 100644 --- a/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/TestIdProvider/CompatibilityTests.cs +++ b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/TestIdProvider/CompatibilityTests.cs @@ -12,16 +12,16 @@ namespace Microsoft.TestPlatform.AdapterUtilities.UnitTests.TestIdProvider; public class CompatibilityTests { [TestMethod] - [DataRow(new[] { "eea339da-6b5e-0d4b-3255-bfef95601890", "" })] - [DataRow(new[] { "740b9afc-3350-4257-ca01-5bd47799147d", "adapter://", "name1" })] // less than one block - [DataRow(new[] { "119c5b31-c0fb-1c12-6d1a-d617bb2bd996", "adapter://namesamplenam.testname" })] // 1 full block - [DataRow(new[] { "2a4c33ec-6115-4bd7-2e94-71f2fd3a5ee3", "adapter://namesamplenamespace.testname" })] // 1 full block and extra - [DataRow(new[] { "119c5b31-c0fb-1c12-6d1a-d617bb2bd996", "adapter://", "name", "samplenam", ".", "testname" })] // 1 full block - [DataRow(new[] { "2a4c33ec-6115-4bd7-2e94-71f2fd3a5ee3", "adapter://", "name", "samplenamespace", ".", "testname" })] // 1 full block and extra - [DataRow(new[] { "1fc07043-3d2d-1401-c732-3b507feec548", "adapter://namesamplenam.testnameaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" })] // 2 full blocks - [DataRow(new[] { "24e8a50b-2766-6a12-f461-9f8e4fa1cbb5", "adapter://namesamplenamespace.testnameaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" })] // 2 full blocks and extra - [DataRow(new[] { "1fc07043-3d2d-1401-c732-3b507feec548", "adapter://", "name", "samplenam", ".", "testname", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" })] // 2 full blocks - [DataRow(new[] { "24e8a50b-2766-6a12-f461-9f8e4fa1cbb5", "adapter://", "name", "samplenamespace", ".", "testname", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" })] // 2 full blocks and extra + [DataRow(["eea339da-6b5e-0d4b-3255-bfef95601890", ""])] + [DataRow(["740b9afc-3350-4257-ca01-5bd47799147d", "adapter://", "name1"])] // less than one block + [DataRow(["119c5b31-c0fb-1c12-6d1a-d617bb2bd996", "adapter://namesamplenam.testname"])] // 1 full block + [DataRow(["2a4c33ec-6115-4bd7-2e94-71f2fd3a5ee3", "adapter://namesamplenamespace.testname"])] // 1 full block and extra + [DataRow(["119c5b31-c0fb-1c12-6d1a-d617bb2bd996", "adapter://", "name", "samplenam", ".", "testname"])] // 1 full block + [DataRow(["2a4c33ec-6115-4bd7-2e94-71f2fd3a5ee3", "adapter://", "name", "samplenamespace", ".", "testname"])] // 1 full block and extra + [DataRow(["1fc07043-3d2d-1401-c732-3b507feec548", "adapter://namesamplenam.testnameaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"])] // 2 full blocks + [DataRow(["24e8a50b-2766-6a12-f461-9f8e4fa1cbb5", "adapter://namesamplenamespace.testnameaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"])] // 2 full blocks and extra + [DataRow(["1fc07043-3d2d-1401-c732-3b507feec548", "adapter://", "name", "samplenam", ".", "testname", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"])] // 2 full blocks + [DataRow(["24e8a50b-2766-6a12-f461-9f8e4fa1cbb5", "adapter://", "name", "samplenamespace", ".", "testname", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"])] // 2 full blocks and extra public void IdCompatibilityTests(string[] data) { // Arrange diff --git a/test/Microsoft.TestPlatform.Build.UnitTests/TestTaskUtilsTests.cs b/test/Microsoft.TestPlatform.Build.UnitTests/TestTaskUtilsTests.cs index 7c464bb381..a8ed80b8f1 100644 --- a/test/Microsoft.TestPlatform.Build.UnitTests/TestTaskUtilsTests.cs +++ b/test/Microsoft.TestPlatform.Build.UnitTests/TestTaskUtilsTests.cs @@ -3,7 +3,6 @@ using System.Text.RegularExpressions; -using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Microsoft.TestPlatform.Build.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -47,7 +46,7 @@ public void CreateArgumentShouldAddCLIRunSettingsArgAtEnd() { const string codeCoverageOption = "Code Coverage"; - _vsTestTask.VSTestCollect = new string[] { codeCoverageOption }; + _vsTestTask.VSTestCollect = [codeCoverageOption]; _vsTestTask.VSTestBlame = true; const string arg1 = "RunConfiguration.ResultsDirectory=Path having Space"; @@ -79,7 +78,7 @@ public void CreateArgumentShouldPassResultsDirectoryCorrectly() public void CreateArgumentShouldNotSetConsoleLoggerVerbosityIfConsoleLoggerIsGivenInArgs() { _vsTestTask.VSTestVerbosity = "diag"; - _vsTestTask.VSTestLogger = new string[] { "Console;Verbosity=quiet" }; + _vsTestTask.VSTestLogger = ["Console;Verbosity=quiet"]; var commandline = TestTaskUtils.CreateCommandLineArguments(_vsTestTask); @@ -210,7 +209,7 @@ public void CreateArgumentShouldSetConsoleLoggerVerbosityToQuietIfConsoleLoggerI [TestMethod] public void CreateArgumentShouldPreserveWhiteSpaceInLogger() { - _vsTestTask.VSTestLogger = new string[] { "trx;LogFileName=foo bar.trx" }; + _vsTestTask.VSTestLogger = ["trx;LogFileName=foo bar.trx"]; var commandline = TestTaskUtils.CreateCommandLineArguments(_vsTestTask); @@ -234,7 +233,7 @@ public void CreateArgumentShouldAddOneCollectArgumentForEachCollect() [TestMethod] public void CreateArgumentShouldAddMultipleTestAdapterPaths() { - _vsTestTask.VSTestTestAdapterPath = new ITaskItem[] { new TaskItem("path1"), new TaskItem("path2") }; + _vsTestTask.VSTestTestAdapterPath = [new TaskItem("path1"), new TaskItem("path2")]; var commandline = TestTaskUtils.CreateCommandLineArguments(_vsTestTask); @@ -245,7 +244,7 @@ public void CreateArgumentShouldAddMultipleTestAdapterPaths() [TestMethod] public void CreateArgumentShouldAddMultipleLoggers() { - _vsTestTask.VSTestLogger = new string[] { "trx;LogFileName=foo bar.trx", "console" }; + _vsTestTask.VSTestLogger = ["trx;LogFileName=foo bar.trx", "console"]; var commandline = TestTaskUtils.CreateCommandLineArguments(_vsTestTask); StringAssert.Contains(commandline, "--logger:\"trx;LogFileName=foo bar.trx\""); @@ -257,7 +256,7 @@ public void CreateArgumentShouldAddTraceCollectorDirectoryPathAsTestAdapterForCo { const string traceDataCollectorDirectoryPath = @"c:\path\to\tracedata collector"; _vsTestTask.VSTestTraceDataCollectorDirectoryPath = new TaskItem(traceDataCollectorDirectoryPath); - _vsTestTask.VSTestCollect = new string[] { "code coverage" }; + _vsTestTask.VSTestCollect = ["code coverage"]; var commandline = TestTaskUtils.CreateCommandLineArguments(_vsTestTask); @@ -270,7 +269,7 @@ public void CreateArgumentShouldNotAddTraceCollectorDirectoryPathAsTestAdapterFo { const string traceDataCollectorDirectoryPath = @"c:\path\to\tracedata collector"; _vsTestTask.VSTestTraceDataCollectorDirectoryPath = new TaskItem(traceDataCollectorDirectoryPath); - _vsTestTask.VSTestCollect = new string[] { "not code coverage" }; + _vsTestTask.VSTestCollect = ["not code coverage"]; var commandline = TestTaskUtils.CreateCommandLineArguments(_vsTestTask); @@ -296,7 +295,7 @@ public void CreateArgumentShouldNotAddTestAdapterPathIfVSTestTraceDataCollectorD { _vsTestTask.VSTestTraceDataCollectorDirectoryPath = null; _vsTestTask.VSTestSetting = @"c:\path\to\sample.runsettings"; - _vsTestTask.VSTestCollect = new string[] { "code coverage" }; + _vsTestTask.VSTestCollect = ["code coverage"]; var commandline = TestTaskUtils.CreateCommandLineArguments(_vsTestTask); diff --git a/test/Microsoft.TestPlatform.Client.UnitTests/Discovery/DiscoveryRequestTests.cs b/test/Microsoft.TestPlatform.Client.UnitTests/Discovery/DiscoveryRequestTests.cs index 7ffc09294b..1a64538b9a 100644 --- a/test/Microsoft.TestPlatform.Client.UnitTests/Discovery/DiscoveryRequestTests.cs +++ b/test/Microsoft.TestPlatform.Client.UnitTests/Discovery/DiscoveryRequestTests.cs @@ -136,7 +136,7 @@ public void HandleDiscoveryCompleteShouldCloseDiscoveryManager() { var eventsHandler = _discoveryRequest as ITestDiscoveryEventsHandler2; - eventsHandler.HandleDiscoveryComplete(new DiscoveryCompleteEventArgs(1, false), Enumerable.Empty()); + eventsHandler.HandleDiscoveryComplete(new DiscoveryCompleteEventArgs(1, false), []); _discoveryManager.Verify(dm => dm.Close(), Times.Once); } @@ -148,7 +148,7 @@ public void HandleDiscoveryCompleteShouldCloseDiscoveryManagerBeforeRaiseDiscove _discoveryRequest.OnDiscoveryComplete += (s, e) => events.Add("complete"); var eventsHandler = _discoveryRequest as ITestDiscoveryEventsHandler2; - eventsHandler.HandleDiscoveryComplete(new DiscoveryCompleteEventArgs(1, false), Enumerable.Empty()); + eventsHandler.HandleDiscoveryComplete(new DiscoveryCompleteEventArgs(1, false), []); Assert.AreEqual(2, events.Count); Assert.AreEqual("close", events[0]); @@ -198,7 +198,7 @@ public void HandleDiscoveryCompleteShouldCollectMetrics() discoveryCompleteEventArgs.Metrics = dict; // Act - eventsHandler.HandleDiscoveryComplete(discoveryCompleteEventArgs, Enumerable.Empty()); + eventsHandler.HandleDiscoveryComplete(discoveryCompleteEventArgs, []); // Verify. mockMetricsCollector.Verify(rd => rd.Add(TelemetryDataConstants.TimeTakenInSecForDiscovery, It.IsAny()), Times.Once); @@ -247,7 +247,7 @@ public void HandleRawMessageShouldInvokeHandleDiscoveryCompleteOfLoggerManager() { TotalTests = 1, IsAborted = false, - LastDiscoveredTests = Enumerable.Empty() + LastDiscoveredTests = [] }); _discoveryRequest.HandleRawMessage(string.Empty); @@ -260,7 +260,7 @@ public void HandleDiscoveryCompleteShouldInvokeHandleDiscoveryCompleteOfLoggerMa { var discoveryCompleteEventArgs = new DiscoveryCompleteEventArgs(1, false); var eventsHandler = _discoveryRequest as ITestDiscoveryEventsHandler2; - eventsHandler.HandleDiscoveryComplete(discoveryCompleteEventArgs, Enumerable.Empty()); + eventsHandler.HandleDiscoveryComplete(discoveryCompleteEventArgs, []); _loggerManager.Verify(lm => lm.HandleDiscoveryComplete(discoveryCompleteEventArgs), Times.Once); } @@ -270,7 +270,7 @@ public void HandleDiscoveryCompleteShouldNotInvokeHandleDiscoveredTestsIfLastChu { var discoveryCompleteEventArgs = new DiscoveryCompleteEventArgs(1, false); var eventsHandler = _discoveryRequest as ITestDiscoveryEventsHandler2; - eventsHandler.HandleDiscoveryComplete(discoveryCompleteEventArgs, Enumerable.Empty()); + eventsHandler.HandleDiscoveryComplete(discoveryCompleteEventArgs, []); _loggerManager.Verify(lm => lm.HandleDiscoveredTests(It.IsAny()), Times.Never); } diff --git a/test/Microsoft.TestPlatform.Client.UnitTests/Execution/TestRunRequestTests.cs b/test/Microsoft.TestPlatform.Client.UnitTests/Execution/TestRunRequestTests.cs index e07fbe9de9..d77e39fda6 100644 --- a/test/Microsoft.TestPlatform.Client.UnitTests/Execution/TestRunRequestTests.cs +++ b/test/Microsoft.TestPlatform.Client.UnitTests/Execution/TestRunRequestTests.cs @@ -508,7 +508,7 @@ public void HandleTestRunCompleteShouldHandleListAttachments() bool attachmentsFound = false; _testRunRequest.OnRunCompletion += (s, e) => attachmentsFound = e.AttachmentSets != null && e.AttachmentSets.Count == 1; - List attachmentSets = new() { new AttachmentSet(new Uri("datacollector://attachment"), "datacollectorAttachment") }; + List attachmentSets = [new AttachmentSet(new Uri("datacollector://attachment"), "datacollectorAttachment")]; _testRunRequest.ExecuteAsync(); var testRunCompleteEventsArgs = new TestRunCompleteEventArgs( diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/ExtensionDecoratorTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/ExtensionDecoratorTests.cs index 2bb19a3ca6..a44997fd80 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/ExtensionDecoratorTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/ExtensionDecoratorTests.cs @@ -121,7 +121,7 @@ public void SerialTestRunDecorator_Disabled(string falseValue, bool nullRunSetti testCases.Add(new TestCase() { Id = Guid.NewGuid() }); } - string[] sourcesName = new string[] { "testSource.dll" }; + string[] sourcesName = ["testSource.dll"]; _settingsMock.Setup(x => x.SettingsXml).Returns(nullRunSettings ? null : runsettings); _contextMock.Setup(x => x.RunSettings).Returns(_settingsMock.Object); diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs index ff82d8f17b..30612dfc6e 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs @@ -30,7 +30,7 @@ public TestPluginCacheTests() // Reset the singleton. TestPluginCache.Instance = null; _mockFileHelper = new Mock(); - _testablePluginCache = new TestableTestPluginCache(new List { typeof(TestPluginCacheTests).Assembly.Location }); + _testablePluginCache = new TestableTestPluginCache([typeof(TestPluginCacheTests).Assembly.Location]); _mockFileHelper.Setup(fh => fh.DirectoryExists(It.IsAny())).Returns(true); } diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionsTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionsTests.cs index a26d10ac56..aed57338cf 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionsTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionsTests.cs @@ -287,28 +287,28 @@ public void MergedDictionaryShouldBeEquivalentToTheExpectedDictionary() var first = new Dictionary> { // Merged with "key1" from the next set. - { "key1", new HashSet(new List() { "ext1", "ext2", "ext3" }) }, + { "key1", ["ext1", "ext2", "ext3"] }, // Empty hashset, will be removed from the result. - { "key2", new HashSet() }, + { "key2", [] }, // Added as is. - { "key5", new HashSet(new List() { "ext1", "ext2" }) } + { "key5", ["ext1", "ext2"] } }; var second = new Dictionary> { // Merged with "key1" from the previous set. - { "key1", new HashSet(new List() { "ext2", "ext3", "ext3", "ext4", "ext5" }) }, + { "key1", ["ext2", "ext3", "ext3", "ext4", "ext5"] }, // Empty hashset, will be removed from the result. - { "key2", new HashSet() }, + { "key2", [] }, // Empty hashset, will be removed from the result. - { "key3", new HashSet() }, + { "key3", [] }, // Added as is. - { "key4", new HashSet(new List() { "ext1" }) } + { "key4", ["ext1"] } }; var expected = new Dictionary> { - { "key1", new HashSet(new List() { "ext1", "ext2", "ext3", "ext4", "ext5" }) }, - { "key4", new HashSet(new List() { "ext1" }) }, - { "key5", new HashSet(new List() { "ext1", "ext2" }) } + { "key1", ["ext1", "ext2", "ext3", "ext4", "ext5"] }, + { "key4", ["ext1"] }, + { "key5", ["ext1", "ext2"] } }; // Merge the two dictionaries. @@ -329,9 +329,9 @@ public void AddExtensionTelemetryShouldAddJsonFormattedDiscoveredExtensionsTelem var telemetryData = new Dictionary(); var extensions = new Dictionary> { - { "key1", new HashSet(new List() { "ext1", "ext2", "ext3", "ext4", "ext5" }) }, - { "key4", new HashSet(new List() { "ext1" }) }, - { "key5", new HashSet(new List() { "ext1", "ext2" }) } + { "key1", ["ext1", "ext2", "ext3", "ext4", "ext5"] }, + { "key4", ["ext1"] }, + { "key5", ["ext1", "ext2"] } }; var expectedTelemetry = diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/Logging/InternalTestLoggerEventsTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/Logging/InternalTestLoggerEventsTests.cs index 849484134a..5077e68760 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/Logging/InternalTestLoggerEventsTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/Logging/InternalTestLoggerEventsTests.cs @@ -250,7 +250,7 @@ public void RaiseDiscoveredTestsShouldThrowExceptionIfNullDiscoveredTestsEventAr public void RaiseDiscoveredTestsShouldThrowExceptionIfAlreadyDisposed() { var loggerEvents = GetDisposedLoggerEvents(); - List testCases = new() { new TestCase("This is a string.", new Uri("some://uri"), "DummySourceFileName") }; + List testCases = [new TestCase("This is a string.", new Uri("some://uri"), "DummySourceFileName")]; DiscoveredTestsEventArgs discoveredTestsEventArgs = new(testCases); Assert.ThrowsException(() => loggerEvents.RaiseDiscoveredTests(discoveredTestsEventArgs)); @@ -266,7 +266,7 @@ public void RaiseDiscoveredTestsShouldInvokeRegisteredEventHandler() DiscoveredTestsEventArgs? receivedEventArgs = null; EventWaitHandle waitHandle = new AutoResetEvent(false); - List testCases = new() { new TestCase("This is a string.", new Uri("some://uri"), "DummySourceFileName") }; + List testCases = [new TestCase("This is a string.", new Uri("some://uri"), "DummySourceFileName")]; DiscoveredTestsEventArgs discoveredTestsEventArgs = new(testCases); // Register for the discovered tests event. diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/FakesUtilitiesTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/FakesUtilitiesTests.cs index 1b1b598cdc..a26dbdcdc1 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/FakesUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/FakesUtilitiesTests.cs @@ -25,14 +25,14 @@ public void FakesSettingsShouldThrowExceptionIfSourcesArePassedAsNull() [TestMethod] public void FakesSettingsShouldThrowExceptionIfRunSettingsIsPassedAsNull() { - Assert.ThrowsException(() => FakesUtilities.GenerateFakesSettingsForRunConfiguration(Array.Empty(), null!)); + Assert.ThrowsException(() => FakesUtilities.GenerateFakesSettingsForRunConfiguration([], null!)); } [TestMethod] public void FakesSettingsShouldBeNotGeneratedIfFakeConfiguratorAssemblyIsNotPresent() { string runSettingsXml = @""; - var generatedRunSettings = FakesUtilities.GenerateFakesSettingsForRunConfiguration(new string[] { @"C:\temp\UT.dll" }, runSettingsXml); + var generatedRunSettings = FakesUtilities.GenerateFakesSettingsForRunConfiguration([@"C:\temp\UT.dll"], runSettingsXml); Assert.AreEqual(generatedRunSettings, runSettingsXml); } diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/RunSettingsUtilitiesTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/RunSettingsUtilitiesTests.cs index 767417c4a8..f0b1133c56 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/RunSettingsUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/Utilities/RunSettingsUtilitiesTests.cs @@ -95,7 +95,7 @@ public void GetMaxCpuCountWithInvalidCpuCountShouldReturnDefaultCpuCount() public void GetTestAdaptersPaths() { string settingXml = @"C:\testadapterpath;D:\secondtestadapterpath"; - string[] expectedResult = new string[] { @"C:\testadapterpath", @"D:\secondtestadapterpath" }; + string[] expectedResult = [@"C:\testadapterpath", @"D:\secondtestadapterpath"]; string[] result = (string[])RunSettingsUtilities.GetTestAdaptersPaths(settingXml); diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/SocketCommunicationManagerTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/SocketCommunicationManagerTests.cs index db25959ca0..7d352a6327 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/SocketCommunicationManagerTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/SocketCommunicationManagerTests.cs @@ -358,7 +358,7 @@ private static void WriteOnSocket(Socket socket) { for (int i = 0; i < 10; i++) { - socket.Send(new byte[2] { 0x1, 0x0 }); + socket.Send([0x1, 0x0]); } } diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/DataCollectionRequestSenderTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/DataCollectionRequestSenderTests.cs index 81245148c2..311230f716 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/DataCollectionRequestSenderTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/DataCollectionRequestSenderTests.cs @@ -44,7 +44,7 @@ public void SendAfterTestRunEndAndGetResultShouldReturnAttachments() attachment.Attachments.Add(new UriDataAttachment(attachmentUri, "filename.txt")); var invokedDataCollector = new InvokedDataCollector(datacollectorUri, displayName, typeof(string).AssemblyQualifiedName!, typeof(string).Assembly.Location, false); _mockDataSerializer.Setup(x => x.DeserializePayload(It.IsAny())).Returns( - new AfterTestRunEndResult(new Collection() { attachment }, new Collection() { invokedDataCollector }, new Dictionary())); + new AfterTestRunEndResult([attachment], new Collection() { invokedDataCollector }, new Dictionary())); _mockCommunicationManager.SetupSequence(x => x.ReceiveRawMessage()).Returns(rawMessage1).Returns(rawMessage2); _mockDataSerializer.Setup(x => x.DeserializeMessage(rawMessage1)).Returns(new Message() { MessageType = MessageType.TelemetryEventMessage, Payload = null }); _mockDataSerializer.Setup(x => x.DeserializeMessage(rawMessage2)).Returns(new Message() { MessageType = MessageType.AfterTestRunEndResult, Payload = null }); @@ -80,7 +80,7 @@ public void SendAfterTestRunEndAndGetResultShouldReturnAttachmentsAndPropagateTe attachment.Attachments.Add(new UriDataAttachment(attachmentUri, "filename.txt")); var invokedDataCollector = new InvokedDataCollector(datacollectorUri, displayName, typeof(string).AssemblyQualifiedName!, typeof(string).Assembly.Location, false); _mockDataSerializer.Setup(x => x.DeserializePayload(It.IsAny())).Returns( - new AfterTestRunEndResult(new Collection() { attachment }, new Collection() { invokedDataCollector }, new Dictionary())); + new AfterTestRunEndResult([attachment], new Collection() { invokedDataCollector }, new Dictionary())); _mockCommunicationManager.SetupSequence(x => x.ReceiveRawMessage()).Returns(rawMessage1).Returns(rawMessage2); _mockDataSerializer.Setup(x => x.DeserializeMessage(rawMessage1)).Returns(new Message() { MessageType = MessageType.TelemetryEventMessage, Payload = null }); _mockDataSerializer.Setup(x => x.DeserializeMessage(rawMessage2)).Returns(new Message() { MessageType = MessageType.AfterTestRunEndResult, Payload = null }); diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs index 3fa3d0c968..8cdeb06831 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs @@ -35,7 +35,7 @@ public class TestRequestSenderTests private readonly Mock _mockDataSerializer; private readonly Mock _mockChannel; - private readonly List _pathToAdditionalExtensions = new() { "Hello", "World" }; + private readonly List _pathToAdditionalExtensions = ["Hello", "World"]; private readonly Mock _mockDiscoveryEventsHandler; private readonly Mock _mockExecutionEventsHandler; private readonly TestRunCriteriaWithSources _testRunCriteriaWithSources; diff --git a/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Helpers/CommandLineArgumentsHelperTests.cs b/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Helpers/CommandLineArgumentsHelperTests.cs index 7f9b7cf5f0..1b7ec113d6 100644 --- a/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Helpers/CommandLineArgumentsHelperTests.cs +++ b/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Helpers/CommandLineArgumentsHelperTests.cs @@ -33,7 +33,7 @@ public void GetArgumentsDictionaryShouldIgnoreValuesWithoutPreceedingHypen() Assert.AreEqual("2312", argsDictionary["--parentprocessid"]); Assert.AreEqual(@"C:\temp\1.dll", argsDictionary["--testsourcepath"]); - args = new List() { "--port", "12312", "--parentprocessid", "2312", "testsourcepath", @"C:\temp\1.dll" }; + args = ["--port", "12312", "--parentprocessid", "2312", "testsourcepath", @"C:\temp\1.dll"]; argsDictionary = CommandLineArgumentsHelper.GetArgumentsDictionary(args.ToArray()); Assert.IsTrue(argsDictionary.Count == 2); @@ -81,7 +81,7 @@ public void GetArgumentsDictionaryShouldReturnEmptyDictionaryIfEmptyArgIsPassed( var argsDictionary = CommandLineArgumentsHelper.GetArgumentsDictionary(null); Assert.IsTrue(argsDictionary.Count == 0); - argsDictionary = CommandLineArgumentsHelper.GetArgumentsDictionary(System.Array.Empty()); + argsDictionary = CommandLineArgumentsHelper.GetArgumentsDictionary([]); Assert.IsTrue(argsDictionary.Count == 0); } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/AttachmentsProcessing/TestRunAttachmentsProcessingManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/AttachmentsProcessing/TestRunAttachmentsProcessingManagerTests.cs index 24da177a5d..54bb5e48e6 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/AttachmentsProcessing/TestRunAttachmentsProcessingManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/AttachmentsProcessing/TestRunAttachmentsProcessingManagerTests.cs @@ -56,11 +56,10 @@ public TestRunAttachmentsProcessingManagerTests() _mockAttachmentHandler1.Setup(h => h.GetExtensionUris()).Returns(new[] { new Uri(Uri1) }); _mockAttachmentHandler2.Setup(h => h.GetExtensionUris()).Returns(new[] { new Uri(Uri2) }); _mockDataCollectorAttachmentsProcessorsFactory.Setup(p => p.Create(It.IsAny(), It.IsAny())) - .Returns(new DataCollectorAttachmentProcessor[] - { + .Returns([ new( "friendlyNameA", _mockAttachmentHandler1.Object ), new( "friendlyNameB" ,_mockAttachmentHandler2.Object ) - }); + ]); _manager = new TestRunAttachmentsProcessingManager(_mockEventSource.Object, _mockDataCollectorAttachmentsProcessorsFactory.Object); @@ -114,10 +113,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnNoAttachments_IfNoA public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1NotProcessedAttachmentThroughEventsHandler_If1NotRelatedAttachmentOnInput() { // arrange - List inputAttachments = new() - { - new AttachmentSet(new Uri(Uri3), "uri3_input") - }; + List inputAttachments = [new AttachmentSet(new Uri(Uri3), "uri3_input")]; // act await _manager.ProcessTestRunAttachmentsAsync(Constants.EmptyRunSettings, _mockRequestData.Object, inputAttachments, Array.Empty(), _mockEventsHandler.Object, _cancellationTokenSource.Token); @@ -138,10 +134,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1NotProcessedAttach public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1NotProcessedAttachment_If1NotRelatedAttachmentOnInput() { // arrange - List inputAttachments = new() - { - new AttachmentSet(new Uri(Uri3), "uri3_input") - }; + List inputAttachments = [new AttachmentSet(new Uri(Uri3), "uri3_input")]; // act var result = await _manager.ProcessTestRunAttachmentsAsync(Constants.EmptyRunSettings, _mockRequestData.Object, inputAttachments, Array.Empty(), _cancellationTokenSource.Token); @@ -161,15 +154,9 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1NotProcessedAttach public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1ProcessedAttachmentThroughEventsHandler_IfRelatedAttachmentOnInput() { // arrange - List inputAttachments = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_input") - }; + List inputAttachments = [new AttachmentSet(new Uri(Uri1), "uri1_input")]; - List outputAttachments = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_output") - }; + List outputAttachments = [new AttachmentSet(new Uri(Uri1), "uri1_output")]; _mockAttachmentHandler1.Setup(h => h.ProcessAttachmentSetsAsync(It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny())).ReturnsAsync(outputAttachments); @@ -192,15 +179,9 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1ProcessedAttachmen public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1ProcessedAttachment_IfRelatedAttachmentOnInput() { // arrange - List inputAttachments = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_input") - }; + List inputAttachments = [new AttachmentSet(new Uri(Uri1), "uri1_input")]; - List outputAttachments = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_output") - }; + List outputAttachments = [new AttachmentSet(new Uri(Uri1), "uri1_output")]; _mockAttachmentHandler1.Setup(h => h.ProcessAttachmentSetsAsync(It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny())).ReturnsAsync(outputAttachments); @@ -224,10 +205,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturn1ProcessedAttachmen public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachmentsThroughEventsHandler_IfRelatedAttachmentOnInputButHandlerThrowsException() { // arrange - List inputAttachments = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_input") - }; + List inputAttachments = [new AttachmentSet(new Uri(Uri1), "uri1_input")]; var exceptionToThrow = new Exception("exception message"); _mockAttachmentHandler1.Setup(h => h.ProcessAttachmentSetsAsync(It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny())).Throws(exceptionToThrow); @@ -251,10 +229,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachmentsT public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachments_IfRelatedAttachmentOnInputButHandlerThrowsException() { // arrange - List inputAttachments = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_input") - }; + List inputAttachments = [new AttachmentSet(new Uri(Uri1), "uri1_input")]; _mockAttachmentHandler1.Setup(h => h.ProcessAttachmentSetsAsync(It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny())).Throws(new Exception("exception message")); @@ -277,10 +252,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachmentsT { // arrange _cancellationTokenSource.Cancel(); - List inputAttachments = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_input") - }; + List inputAttachments = [new AttachmentSet(new Uri(Uri1), "uri1_input")]; // act await _manager.ProcessTestRunAttachmentsAsync(Constants.EmptyRunSettings, _mockRequestData.Object, inputAttachments, Array.Empty(), _mockEventsHandler.Object, _cancellationTokenSource.Token); @@ -301,10 +273,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachments_ { // arrange _cancellationTokenSource.Cancel(); - List inputAttachments = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_input") - }; + List inputAttachments = [new AttachmentSet(new Uri(Uri1), "uri1_input")]; // act var result = await _manager.ProcessTestRunAttachmentsAsync(Constants.EmptyRunSettings, _mockRequestData.Object, inputAttachments, Array.Empty(), _cancellationTokenSource.Token); @@ -324,24 +293,18 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachments_ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnProcessedAttachmentsThroughEventsHandler_IfRelatedAttachmentsOnInput() { // arrange - List inputAttachments = new() - { + List inputAttachments = + [ new AttachmentSet(new Uri(Uri1), "uri1_input1"), new AttachmentSet(new Uri(Uri1), "uri1_input2"), new AttachmentSet(new Uri(Uri2), "uri2_input1"), new AttachmentSet(new Uri(Uri2), "uri2_input2"), - new AttachmentSet(new Uri(Uri3), "uri3_input1"), - }; + new AttachmentSet(new Uri(Uri3), "uri3_input1") + ]; - List outputAttachmentsForHandler1 = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_output") - }; + List outputAttachmentsForHandler1 = [new AttachmentSet(new Uri(Uri1), "uri1_output")]; - List outputAttachmentsForHandler2 = new() - { - new AttachmentSet(new Uri(Uri2), "uri2_output") - }; + List outputAttachmentsForHandler2 = [new AttachmentSet(new Uri(Uri2), "uri2_output")]; _mockAttachmentHandler1.Setup(h => h.ProcessAttachmentSetsAsync(null!, It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny())).ReturnsAsync(outputAttachmentsForHandler1); _mockAttachmentHandler2.Setup(h => h.ProcessAttachmentSetsAsync(null!, It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny())).ReturnsAsync(outputAttachmentsForHandler2); @@ -365,24 +328,18 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnProcessedAttachment public async Task ProcessTestRunAttachmentsAsync_ShouldReturnProcessedAttachments_IfRelatedAttachmentsOnInput() { // arrange - List inputAttachments = new() - { + List inputAttachments = + [ new AttachmentSet(new Uri(Uri1), "uri1_input1"), new AttachmentSet(new Uri(Uri1), "uri1_input2"), new AttachmentSet(new Uri(Uri2), "uri2_input1"), new AttachmentSet(new Uri(Uri2), "uri2_input2"), - new AttachmentSet(new Uri(Uri3), "uri3_input1"), - }; + new AttachmentSet(new Uri(Uri3), "uri3_input1") + ]; - List outputAttachmentsForHandler1 = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_output") - }; + List outputAttachmentsForHandler1 = [new AttachmentSet(new Uri(Uri1), "uri1_output")]; - List outputAttachmentsForHandler2 = new() - { - new AttachmentSet(new Uri(Uri2), "uri2_output") - }; + List outputAttachmentsForHandler2 = [new AttachmentSet(new Uri(Uri2), "uri2_output")]; _mockAttachmentHandler1.Setup(h => h.ProcessAttachmentSetsAsync(It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny())).ReturnsAsync(outputAttachmentsForHandler1); _mockAttachmentHandler2.Setup(h => h.ProcessAttachmentSetsAsync(It.IsAny(), It.IsAny>(), It.IsAny>(), It.IsAny(), It.IsAny())).ReturnsAsync(outputAttachmentsForHandler2); @@ -407,10 +364,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnProcessedAttachment public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachmentsThroughEventsHandler_IfOperationCancelled() { // arrange - List inputAttachments = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_input") - }; + List inputAttachments = [new AttachmentSet(new Uri(Uri1), "uri1_input")]; ICollection outputAttachments = new List { @@ -491,10 +445,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachmentsT public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachments_IfOperationCancelled() { // arrange - List inputAttachments = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_input") - }; + List inputAttachments = [new AttachmentSet(new Uri(Uri1), "uri1_input")]; ICollection outputAttachments = new List { @@ -552,11 +503,11 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnInitialAttachments_ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnProperlySendProgressEvents_IfHandlersPropagesEvents() { // arrange - List inputAttachments = new() - { + List inputAttachments = + [ new AttachmentSet(new Uri(Uri1), "uri1_input"), new AttachmentSet(new Uri(Uri2), "uri2_input") - }; + ]; ICollection outputAttachments1 = new List { @@ -628,11 +579,11 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldReturnProperlySendProgres public async Task ProcessTestRunAttachmentsAsync_ShouldNotFailIfRunsettingsIsNull() { // arrange - List inputAttachments = new() - { + List inputAttachments = + [ new AttachmentSet(new Uri(Uri1), "uri1_input"), new AttachmentSet(new Uri(Uri2), "uri2_input") - }; + ]; ICollection outputAttachments = new List { new(new Uri(Uri2), "uri2_output") @@ -658,16 +609,16 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldNotFailIfRunsettingsIsNul public async Task ProcessTestRunAttachmentsAsync_ShouldFlowCorrectDataCollectorConfiguration(bool withConfig) { // arrange - List inputAttachments = new() - { + List inputAttachments = + [ new AttachmentSet(new Uri(Uri1), "uri1_input"), new AttachmentSet(new Uri(Uri2), "uri2_input") - }; + ]; - List invokedDataCollectors = new() - { + List invokedDataCollectors = + [ new InvokedDataCollector(new Uri(Uri1), withConfig ? "friendlyNameA" : "friendlyNameB", typeof(string).AssemblyQualifiedName!, typeof(string).Assembly.Location, false) - }; + ]; string runSettingsXml = $@" @@ -716,10 +667,7 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldFlowCorrectDataCollectorC public async Task ProcessTestRunAttachmentsAsync_ShouldNotConsumeAttachmentsIfProcessorFails() { // arrange - List inputAttachments = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_input_1") - }; + List inputAttachments = [new AttachmentSet(new Uri(Uri1), "uri1_input_1")]; inputAttachments[0].Attachments.Add(UriDataAttachment.CreateFrom("file1", "Sample1")); inputAttachments[0].Attachments.Add(UriDataAttachment.CreateFrom("file2", "Sample2")); inputAttachments[0].Attachments.Add(UriDataAttachment.CreateFrom("file3", "Sample3")); @@ -778,10 +726,10 @@ public async Task ProcessTestRunAttachmentsAsync_ShouldNotConsumeAttachmentsIfPr public async Task ProcessTestRunAttachmentsAsync_ShouldNotConsumeAttachmentsIfAllProcessorsFail() { // arrange - List inputAttachments = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_input_1"), - }; + List inputAttachments = + [ + new AttachmentSet(new Uri(Uri1), "uri1_input_1") + ]; inputAttachments[0].Attachments.Add(UriDataAttachment.CreateFrom("file1", "Sample1")); inputAttachments[0].Attachments.Add(UriDataAttachment.CreateFrom("file2", "Sample2")); inputAttachments[0].Attachments.Add(UriDataAttachment.CreateFrom("file3", "Sample3")); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyDiscoveryManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyDiscoveryManagerTests.cs index 879ef89150..4e0c03058d 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyDiscoveryManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyDiscoveryManagerTests.cs @@ -40,7 +40,7 @@ public InProcessProxyDiscoveryManagerTests() public void DiscoverTestsShouldCallInitialize() { var manualResetEvent = new ManualResetEvent(false); - _mockDiscoveryManager.Setup(o => o.Initialize(Enumerable.Empty(), null)).Callback( + _mockDiscoveryManager.Setup(o => o.Initialize(Array.Empty(), null)).Callback( () => manualResetEvent.Set()); var discoveryCriteria = new DiscoveryCriteria(new[] { "test.dll" }, 1, string.Empty); @@ -53,7 +53,7 @@ public void DiscoverTestsShouldCallInitialize() public void DiscoverTestsShouldUpdateTestPluginCacheWithExtensionsReturnByTestHost() { var manualResetEvent = new ManualResetEvent(false); - _mockDiscoveryManager.Setup(o => o.Initialize(Enumerable.Empty(), null)).Callback( + _mockDiscoveryManager.Setup(o => o.Initialize(Array.Empty(), null)).Callback( () => manualResetEvent.Set()); var path = Path.Combine(Path.GetTempPath(), "DiscoveryDummy.dll"); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyexecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyexecutionManagerTests.cs index 6ef4ea3f74..4122e2cbdc 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyexecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/InProcessProxyexecutionManagerTests.cs @@ -44,7 +44,7 @@ public void StartTestRunShouldCallInitialize() var mockTestMessageEventHandler = new Mock(); _inProcessProxyExecutionManager.StartTestRun(testRunCriteria, null!); - _mockExecutionManager.Verify(o => o.Initialize(Enumerable.Empty(), It.IsAny()), Times.Once, "StartTestRun should call Initialize if not already initialized"); + _mockExecutionManager.Verify(o => o.Initialize(Array.Empty(), It.IsAny()), Times.Once, "StartTestRun should call Initialize if not already initialized"); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/Parallel/ParallelProxyDiscoveryManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/Parallel/ParallelProxyDiscoveryManagerTests.cs index 066afb05cb..37cfb2764d 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/Parallel/ParallelProxyDiscoveryManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/Parallel/ParallelProxyDiscoveryManagerTests.cs @@ -30,7 +30,7 @@ public class ParallelProxyDiscoveryManagerTests private readonly List> _usedMockManagers; private readonly Func _createMockManager; private readonly Mock _mockEventHandler; - private readonly List _sources = new() { "1.dll", "2.dll" }; + private readonly List _sources = ["1.dll", "2.dll"]; private readonly DiscoveryCriteria _discoveryCriteriaWith2Sources; private readonly List _runtimeProviders; private int _createMockManagerCalled; @@ -70,11 +70,10 @@ public ParallelProxyDiscoveryManagerTests() _mockEventHandler = new Mock(); _discoveryCriteriaWith2Sources = new DiscoveryCriteria(_sources, 100, null); _runtimeProviders = new List { - new(typeof(ITestRuntimeProvider), false, "", new List - { + new(typeof(ITestRuntimeProvider), false, "", [ new() { Source = _sources[0], Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, new() { Source = _sources[1], Architecture = Architecture.X86, Framework = Framework.DefaultFramework } - }) + ]) }; // This event is Set by callback from _mockEventHandler in SetupDiscoveryManager diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/Parallel/ParallelProxyExecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/Parallel/ParallelProxyExecutionManagerTests.cs index 061e6c00a2..2ac3486f2f 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/Parallel/ParallelProxyExecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/Parallel/ParallelProxyExecutionManagerTests.cs @@ -73,13 +73,12 @@ public ParallelProxyExecutionManagerTests() _processedSources = new List(); _testRunCriteriaWith2Sources = new TestRunCriteria(_sources, 100, false, string.Empty, TimeSpan.MaxValue, null, "Name~Test", new FilterOptions() { FilterRegEx = @"^[^\s\(]+" }); _runtimeProviders = new List { - new(typeof(ITestRuntimeProvider), false, "", new List - { + new(typeof(ITestRuntimeProvider), false, "", [ new() { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, new() { Source = "2.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, // For testcases on the bottom. - new() { Source = "3.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, - }) + new() { Source = "3.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework } + ]) }; // Configure testcases diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs index a9774c1367..b78ab647f8 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyDiscoveryManagerTests.cs @@ -222,7 +222,7 @@ public void DiscoverTestsShouldQueryTestHostManagerForExtensions() TestPluginCache.Instance = null; try { - TestPluginCacheHelper.SetupMockAdditionalPathExtensions(new[] { "c:\\e1.dll" }); + TestPluginCacheHelper.SetupMockAdditionalPathExtensions(["c:\\e1.dll"]); _mockFileHelper.Setup(fh => fh.Exists(It.IsAny())).Returns(true); _mockRequestSender.Setup(s => s.WaitForRequestHandlerConnection(It.IsAny(), It.IsAny())).Returns(true); _mockTestHostManager.Setup(th => th.GetTestPlatformExtensions(It.IsAny>(), It.IsAny>())).Returns(new[] { "he1.dll", "c:\\e1.dll" }); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs index 416a12ca8c..286c193f53 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyExecutionManagerTests.cs @@ -320,7 +320,7 @@ public void SetupChannelShouldThrowExceptionWithAllSourcesIfTestHostExitedBefore _mockRequestSender.Setup(s => s.WaitForRequestHandlerConnection(It.IsAny(), It.IsAny())).Returns(false); _mockTestHostManager.Setup(tmh => tmh.LaunchTestHostAsync(It.IsAny(), It.IsAny())).Returns(Task.FromResult(true)).Callback(() => _mockTestHostManager.Raise(t => t.HostExited += null, new HostProviderEventArgs("I crashed!"))); - Assert.AreEqual(string.Format(CultureInfo.CurrentCulture, CrossPlatEngineResources.Resources.TestHostExitedWithError, string.Join("', '", new[] { "source1.dll", "source2.dll" }), "I crashed!"), Assert.ThrowsException(() => _testExecutionManager.SetupChannel(new List { "source1.dll", "source2.dll" }, runsettings)).Message); + Assert.AreEqual(string.Format(CultureInfo.CurrentCulture, CrossPlatEngineResources.Resources.TestHostExitedWithError, string.Join("', '", ["source1.dll", "source2.dll"]), "I crashed!"), Assert.ThrowsException(() => _testExecutionManager.SetupChannel(new List { "source1.dll", "source2.dll" }, runsettings)).Message); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs index 6e1dc96b61..a38583a79e 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs @@ -6,7 +6,6 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; -using System.Linq; using System.Net; using System.Threading; using System.Threading.Tasks; @@ -72,10 +71,10 @@ public void SetupChannelShouldLaunchTestHost() var expectedStartInfo = new TestProcessStartInfo(); _mockRequestSender.Setup(rs => rs.InitializeCommunication()).Returns(123); _mockTestHostManager.Setup( - th => th.GetTestHostProcessStartInfo(Enumerable.Empty(), It.IsAny>(), It.IsAny())) + th => th.GetTestHostProcessStartInfo(Array.Empty(), It.IsAny>(), It.IsAny())) .Returns(expectedStartInfo); - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); _mockTestHostManager.Verify(thl => thl.LaunchTestHostAsync(It.Is(si => si == expectedStartInfo), It.IsAny()), Times.Once); } @@ -86,7 +85,7 @@ public void SetupChannelShouldCreateTimestampedLogFileForHost() _mockRequestSender.Setup(rs => rs.InitializeCommunication()).Returns(123); EqtTrace.InitializeTrace("log.txt", PlatformTraceLevel.Verbose); - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); _mockTestHostManager.Verify( th => @@ -125,7 +124,7 @@ public void SetupChannelOutcomeShouldTakeTesthostSessionSupportIntoAccount( }; Assert.IsTrue(testOperationManager.IsTesthostCompatibleWithTestSessions() == expectedCompatibilityCheckResult); - Assert.IsTrue(testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings) == expectedSetupResult); + Assert.IsTrue(testOperationManager.SetupChannel([], DefaultRunSettings) == expectedSetupResult); } [TestMethod] @@ -133,7 +132,7 @@ public void SetupChannelShouldAddRunnerProcessIdForTestHost() { _mockRequestSender.Setup(rs => rs.InitializeCommunication()).Returns(123); - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); #if NET5_0_OR_GREATER var pid = Environment.ProcessId; @@ -161,7 +160,7 @@ public void SetupChannelShouldAddCorrectTraceLevelForTestHost() #endif _mockRequestSender.Setup(rs => rs.InitializeCommunication()).Returns(123); - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); _mockTestHostManager.Verify( th => @@ -174,7 +173,7 @@ public void SetupChannelShouldAddCorrectTraceLevelForTestHost() [TestMethod] public void SetupChannelShouldSetupServerForCommunication() { - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); _mockRequestSender.Verify(s => s.InitializeCommunication(), Times.Once); } @@ -201,7 +200,7 @@ public void SetupChannelShouldCallHostServerIfRunnerIsServer() var localTestOperationManager = new TestableProxyOperationManager(_mockRequestData.Object, testRequestSender, _mockTestHostManager.Object); - localTestOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + localTestOperationManager.SetupChannel([], DefaultRunSettings); mockCommunicationServer.Verify(s => s.Start(IPAddress.Loopback.ToString() + ":0"), Times.Once); } @@ -229,7 +228,7 @@ public void SetupChannelShouldCallSetupClientIfRunnerIsClient() var localTestOperationManager = new TestableProxyOperationManager(_mockRequestData.Object, testRequestSender, _mockTestHostManager.Object); - localTestOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + localTestOperationManager.SetupChannel([], DefaultRunSettings); mockCommunicationEndpoint.Verify(s => s.Start(It.IsAny()), Times.Once); } @@ -237,8 +236,8 @@ public void SetupChannelShouldCallSetupClientIfRunnerIsClient() [TestMethod] public void SetupChannelShouldNotInitializeIfConnectionIsAlreadyInitialized() { - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); _mockRequestSender.Verify(s => s.InitializeCommunication(), Times.Once); } @@ -246,7 +245,7 @@ public void SetupChannelShouldNotInitializeIfConnectionIsAlreadyInitialized() [TestMethod] public void SetupChannelShouldWaitForTestHostConnection() { - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); _mockRequestSender.Verify(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny()), Times.Once); } @@ -254,8 +253,8 @@ public void SetupChannelShouldWaitForTestHostConnection() [TestMethod] public void SetupChannelShouldNotWaitForTestHostConnectionIfConnectionIsInitialized() { - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); _mockRequestSender.Verify(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny()), Times.Exactly(1)); } @@ -266,7 +265,7 @@ public void SetupChannelShouldHonorTimeOutSetByUser() Environment.SetEnvironmentVariable(EnvironmentHelper.VstestConnectionTimeout, "100"); _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(100000, It.IsAny())).Returns(true); - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); _mockRequestSender.Verify(rs => rs.WaitForRequestHandlerConnection(100000, It.IsAny()), Times.Exactly(1)); } @@ -279,7 +278,7 @@ public void SetupChannelShouldThrowIfWaitForTestHostConnectionTimesOut() var operationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, _mockTestHostManager.Object); - var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings)).Message; + var message = Assert.ThrowsException(() => operationManager.SetupChannel([], DefaultRunSettings)).Message; Assert.AreEqual(message, TimoutErrorMessage); } @@ -293,7 +292,7 @@ public void SetupChannelShouldThrowTestPlatformExceptionIfRequestCancelled() var operationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, _mockTestHostManager.Object, cancellationTokenSource); cancellationTokenSource.Cancel(); - var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings)).Message; + var message = Assert.ThrowsException(() => operationManager.SetupChannel([], DefaultRunSettings)).Message; Equals("Canceling the operation as requested.", message); } @@ -308,7 +307,7 @@ public void SetupChannelShouldThrowTestPlatformExceptionIfRequestCancelledDuring var cancellationTokenSource = new CancellationTokenSource(); var operationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, _mockTestHostManager.Object, cancellationTokenSource); - var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings)).Message; + var message = Assert.ThrowsException(() => operationManager.SetupChannel([], DefaultRunSettings)).Message; Equals("Canceling the operation as requested.", message); } @@ -322,7 +321,7 @@ public void SetupChannelShouldThrowTestPlatformExceptionIfRequestCancelledPostHo _mockTestHostManager.Setup(rs => rs.LaunchTestHostAsync(It.IsAny(), It.IsAny())).Callback(() => cancellationTokenSource.Cancel()); var operationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, _mockTestHostManager.Object, cancellationTokenSource); - var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings)).Message; + var message = Assert.ThrowsException(() => operationManager.SetupChannel([], DefaultRunSettings)).Message; Equals("Canceling the operation as requested.", message); } @@ -334,14 +333,14 @@ public void SetupChannelShouldThrowIfLaunchTestHostFails() var operationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, _mockTestHostManager.Object); - var message = Assert.ThrowsException(() => operationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings)).Message; + var message = Assert.ThrowsException(() => operationManager.SetupChannel([], DefaultRunSettings)).Message; Assert.AreEqual(message, Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Resources.Resources.InitializationFailed); } [TestMethod] public void SetupChannelShouldCheckVersionWithTestHost() { - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); _mockRequestSender.Verify(rs => rs.CheckVersionWithTestHost(), Times.Once); } @@ -350,7 +349,7 @@ public void SetupChannelShouldThrowExceptionIfVersionCheckFails() { // Make the version check fail _mockRequestSender.Setup(rs => rs.CheckVersionWithTestHost()).Throws(new TestPlatformException("Version check failed")); - Assert.ThrowsException(() => _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings)); + Assert.ThrowsException(() => _testOperationManager.SetupChannel([], DefaultRunSettings)); } [TestMethod] @@ -362,7 +361,7 @@ public void SetupChannelForDotnetHostManagerWithIsVersionCheckRequiredFalseShoul var operationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, testHostManager); - operationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + operationManager.SetupChannel([], DefaultRunSettings); _mockRequestSender.Verify(rs => rs.CheckVersionWithTestHost(), Times.Never); } @@ -375,7 +374,7 @@ public void SetupChannelForDotnetHostManagerWithIsVersionCheckRequiredTrueShould testHostManager.Initialize(new NullMessageLogger(), DefaultRunSettings); var operationManager = new TestableProxyOperationManager(_mockRequestData.Object, _mockRequestSender.Object, testHostManager); - operationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + operationManager.SetupChannel([], DefaultRunSettings); _mockRequestSender.Verify(rs => rs.CheckVersionWithTestHost(), Times.Once); } @@ -384,7 +383,7 @@ public void SetupChannelForDotnetHostManagerWithIsVersionCheckRequiredTrueShould public void CloseShouldEndSessionIfHostWasLaunched() { _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny())).Returns(true); - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); _testOperationManager.Close(); @@ -412,11 +411,11 @@ public void CloseShouldResetChannelInitialization() { SetupWaitForTestHostExit(); _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny())).Returns(true); - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); _testOperationManager.Close(); - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); _mockTestHostManager.Verify(th => th.LaunchTestHostAsync(It.IsAny(), It.IsAny()), Times.Exactly(2)); } @@ -425,7 +424,7 @@ public void CloseShouldTerminateTesthostProcessIfWaitTimesout() { // Ensure testhost start returns a dummy process id _mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(ConnectionTimeout, It.IsAny())).Returns(true); - _testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + _testOperationManager.SetupChannel([], DefaultRunSettings); _testOperationManager.Close(); @@ -472,7 +471,7 @@ public void UpdateTestProcessStartInfoShouldUpdateTelemetryOptedInArgTrueIfTelem .Returns(Task.FromResult(true)); // Act. - testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + testOperationManager.SetupChannel([], DefaultRunSettings); // Verify. Assert.IsTrue(receivedTestProcessInfo.Arguments!.Contains("--telemetryoptedin true")); @@ -495,7 +494,7 @@ public void UpdateTestProcessStartInfoShouldUpdateTelemetryOptedInArgFalseIfTele .Returns(Task.FromResult(true)); // Act. - testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings); + testOperationManager.SetupChannel([], DefaultRunSettings); // Verify. Assert.IsTrue(receivedTestProcessInfo.Arguments!.Contains("--telemetryoptedin false")); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyTestSessionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyTestSessionManagerTests.cs index 615c62c2bd..853bfa8486 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyTestSessionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyTestSessionManagerTests.cs @@ -108,14 +108,14 @@ public ProxyTestSessionManagerTests() _fakeTestSourcesToRuntimeProviderMap = new Dictionary { - [_fakeTestSources[0]] = new TestRuntimeProviderInfo(typeof(ITestRuntimeProvider), false, _fakeRunSettings, new List - { - new() { + [_fakeTestSources[0]] = new TestRuntimeProviderInfo(typeof(ITestRuntimeProvider), false, _fakeRunSettings, [ + new() + { Source = _fakeTestSources[0], Architecture = Architecture.X86, Framework = Framework.DefaultFramework } - }) + ]) }; } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ParallelDataCollectionEventsHandlerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ParallelDataCollectionEventsHandlerTests.cs index 681ac0e675..bb923e63bb 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ParallelDataCollectionEventsHandlerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/ParallelDataCollectionEventsHandlerTests.cs @@ -54,17 +54,14 @@ public ParallelDataCollectionEventsHandlerTests() public void HandleTestRunComplete_ShouldCallProcessTestRunAttachmentsAsyncWithAttachmentsAndUseResults() { // arrange - List inputAttachments = new() - { + List inputAttachments = + [ new AttachmentSet(new Uri(Uri1), "uri1_input1"), new AttachmentSet(new Uri(Uri2), "uri2_input1"), new AttachmentSet(new Uri(Uri3), "uri3_input1") - }; + ]; - Collection outputAttachments = new() - { - new AttachmentSet(new Uri(Uri1), "uri1_input1") - }; + Collection outputAttachments = [new AttachmentSet(new Uri(Uri1), "uri1_input1")]; _mockTestRunAttachmentsProcessingManager.Setup(f => f.ProcessTestRunAttachmentsAsync(Constants.EmptyRunSettings, _mockRequestData.Object, It.IsAny>(), It.IsAny>(), It.IsAny())).Returns(Task.FromResult(outputAttachments)); @@ -80,12 +77,12 @@ public void HandleTestRunComplete_ShouldCallProcessTestRunAttachmentsAsyncWithAt public void HandleTestRunComplete_ShouldCallProcessTestRunAttachmentsAsyncWithAttachmentsAndNotUserResults_IfManagerReturnsNull() { // arrange - List inputAttachments = new() - { + List inputAttachments = + [ new AttachmentSet(new Uri(Uri1), "uri1_input1"), new AttachmentSet(new Uri(Uri2), "uri2_input1"), new AttachmentSet(new Uri(Uri3), "uri3_input1") - }; + ]; _mockTestRunAttachmentsProcessingManager.Setup(f => f.ProcessTestRunAttachmentsAsync(Constants.EmptyRunSettings, _mockRequestData.Object, It.IsAny>(), It.IsAny>(), It.IsAny())).Returns(Task.FromResult((Collection)null!)); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs index ec44ce64b4..3215c024a3 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs @@ -49,7 +49,8 @@ public DiscovererEnumeratorTests() _discovererEnumerator = new DiscovererEnumerator(_mockRequestData.Object, _discoveryResultCache, _mockTestPlatformEventSource.Object, _mockAssemblyProperties.Object, _cancellationTokenSource.Token); _runSettingsMock = new Mock(); _messageLoggerMock = new Mock(); - TestPluginCacheHelper.SetupMockExtensions(new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + TestPluginCacheHelper.SetupMockExtensions( + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); TestDiscoveryExtensionManager.Destroy(); } @@ -70,7 +71,7 @@ public void Cleanup() public void LoadTestsShouldReportWarningOnNoDiscoverers() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(TestPluginCache).Assembly.Location }, + [typeof(TestPluginCache).Assembly.Location], () => { }); var sources = new List { typeof(DiscoveryResultCacheTests).Assembly.Location }; @@ -90,7 +91,7 @@ public void LoadTestsShouldReportWarningOnNoDiscoverers() public void LoadTestsShouldNotCallIntoDiscoverersIfNoneMatchesSources() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); var sources = new List { "temp.jpeg" }; @@ -115,7 +116,7 @@ public void LoadTestsShouldNotCallIntoDiscoverersIfNoneMatchesSources() public void LoadTestsShouldCallOnlyNativeDiscovererIfNativeAssembliesPassed() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); _mockAssemblyProperties.Setup(pe => pe.GetAssemblyType("native.dll")).Returns(AssemblyType.Native); @@ -150,7 +151,7 @@ public void LoadTestsShouldCallOnlyNativeDiscovererIfNativeAssembliesPassed() public void LoadTestsShouldCallOnlyManagedDiscovererIfManagedAssembliesPassed() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); _mockAssemblyProperties.Setup(pe => pe.GetAssemblyType("managed.dll")).Returns(AssemblyType.Managed); @@ -185,7 +186,7 @@ public void LoadTestsShouldCallOnlyManagedDiscovererIfManagedAssembliesPassed() public void LoadTestsShouldCallBothNativeAndManagedDiscoverersWithCorrectSources() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); _mockAssemblyProperties.Setup(pe => pe.GetAssemblyType("native.dll")).Returns(AssemblyType.Native); @@ -228,7 +229,7 @@ public void LoadTestsShouldCallBothNativeAndManagedDiscoverersWithCorrectSources public void LoadTestsShouldCallIntoADiscovererThatMatchesTheSources() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); var sources = new List @@ -269,7 +270,7 @@ public void LoadTestsShouldCallIntoADiscovererThatMatchesTheSources() public void LoadTestsShouldCallIntoMultipleDiscoverersThatMatchesTheSources() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); var dllsources = new List @@ -350,7 +351,7 @@ public void LoadTestsShouldCallIntoMultipleDiscoverersThatMatchesTheSources() public void LoadTestsShouldCallIntoOtherDiscoverersWhenCreatingOneFails() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); var sources = new List @@ -394,7 +395,7 @@ public void LoadTestsShouldCallIntoOtherDiscoverersWhenCreatingOneFails() public void LoadTestsShouldCallIntoOtherDiscoverersEvenIfDiscoveryInOneFails() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); var sources = new List @@ -449,7 +450,7 @@ public void LoadTestsShouldCollectMetrics() }; TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); var sources = new List @@ -484,7 +485,7 @@ public void LoadTestsShouldCollectMetrics() public void LoadTestsShouldNotCallIntoDiscoverersWhenCancelled() { // Setup - string[] extensions = new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }; + string[] extensions = [typeof(DiscovererEnumeratorTests).Assembly.Location]; TestPluginCacheHelper.SetupMockExtensions(extensions, () => { }); var dllsources = new List @@ -572,7 +573,7 @@ public void LoadTestShouldInstrumentAdapterDiscoveryStop() public void LoadTestsShouldIterateOverAllExtensionsInTheMapAndDiscoverTests() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); var dllsources = new List @@ -696,7 +697,7 @@ private static void SetupForNoTestsAvailableInGivenAssemblies( private void InvokeLoadTestWithMockSetup() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); var sources = new List diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs index dca3280bf7..86fee2b8d9 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs @@ -160,7 +160,7 @@ public void DiscoverTestsShouldLogIfThereAreNoValidSources() public void DiscoverTestsShouldLogIfTheSameSourceIsSpecifiedTwice() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); var sources = new List @@ -187,7 +187,7 @@ public void DiscoverTestsShouldLogIfTheSameSourceIsSpecifiedTwice() public void DiscoverTestsShouldDiscoverTestsInTheSpecifiedSource() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); var sources = new List @@ -215,7 +215,7 @@ public void DiscoverTestsShouldSendMetricsOnDiscoveryComplete() DiscoveryCompleteEventArgs? receivedDiscoveryCompleteEventArgs = null; TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); var sources = new List @@ -253,7 +253,7 @@ public void DiscoverTestsShouldCollectMetrics() _mockRequestData.Setup(rd => rd.MetricsCollection).Returns(mockMetricsCollector.Object); TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(DiscovererEnumeratorTests).Assembly.Location }, + [typeof(DiscovererEnumeratorTests).Assembly.Location], () => { }); var sources = new List @@ -278,7 +278,7 @@ public void DiscoveryInitializeShouldVerifyWarningMessageIfAdapterFailedToLoad() var assemblyLocation = typeof(DiscoveryManagerTests).Assembly.Location; var mockLogger = new Mock(); TestPluginCacheHelper.SetupMockExtensions( - new string[] { assemblyLocation }, + [assemblyLocation], () => { }); //Act diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs index 89b6b64aa6..f57cf09db5 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs @@ -200,7 +200,7 @@ public void ProcessRequestsDiscoveryStartShouldStartDiscoveryWithGivenCriteria() [TestMethod] public void DiscoveryCompleteShouldSendDiscoveryCompletePayloadOnChannel() { - var discoveryComplete = new DiscoveryCompletePayload { TotalTests = 1, LastDiscoveredTests = Enumerable.Empty(), IsAborted = false }; + var discoveryComplete = new DiscoveryCompletePayload { TotalTests = 1, LastDiscoveredTests = [], IsAborted = false }; var message = _dataSerializer.SerializePayload(MessageType.DiscoveryComplete, discoveryComplete); ProcessRequestsAsync(_mockTestHostManagerFactory.Object); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs index b1aeeffeaa..4f7194fd83 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs @@ -91,7 +91,7 @@ public BaseRunTestsTests() new PlatformThread(), _mockDataSerializer.Object); - TestPluginCacheHelper.SetupMockExtensions(new string[] { typeof(BaseRunTestsTests).Assembly.Location }, () => { }); + TestPluginCacheHelper.SetupMockExtensions([typeof(BaseRunTestsTests).Assembly.Location], () => { }); } [TestCleanup] @@ -809,7 +809,7 @@ private void SetupForExecutionThreadApartmentStateTests(PlatformApartmentState a _mockThread.Object, _mockDataSerializer.Object); - TestPluginCacheHelper.SetupMockExtensions(new string[] { typeof(BaseRunTestsTests).Assembly.Location }, () => { }); + TestPluginCacheHelper.SetupMockExtensions([typeof(BaseRunTestsTests).Assembly.Location], () => { }); var assemblyLocation = typeof(BaseRunTestsTests).Assembly.Location; var executorUriExtensionMap = new List> { diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs index 72da52e034..bea628a470 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs @@ -78,7 +78,7 @@ public void InitializeShouldLoadAndInitializeAllExtensions() var commonAssemblyLocation = typeof(ExecutionManagerTests).Assembly.Location; var mockTestMessageEventHandler = new Mock(); TestPluginCacheHelper.SetupMockExtensions( - new string[] { commonAssemblyLocation }, + [commonAssemblyLocation], () => { }); @@ -142,7 +142,7 @@ public void StartTestRunShouldRunTestsInTheProvidedSources() { var assemblyLocation = typeof(ExecutionManagerTests).Assembly.Location; TestPluginCacheHelper.SetupMockExtensions( - new string[] { assemblyLocation }, + [assemblyLocation], () => { }); TestPluginCache.Instance.DiscoverTestExtensions(TestPlatformConstants.TestAdapterEndsWithPattern); TestPluginCache.Instance.DiscoverTestExtensions(TestPlatformConstants.TestAdapterEndsWithPattern); @@ -205,7 +205,7 @@ public void StartTestRunShouldRunTestsForTheProvidedTests() "A.dll")); fh!.RecordResult(tr); }; - TestPluginCacheHelper.SetupMockExtensions(new string[] { assemblyLocation }, () => { }); + TestPluginCacheHelper.SetupMockExtensions([assemblyLocation], () => { }); _executionManager.StartTestRun(tests, null, null, _testExecutionContext, null, mockTestRunEventsHandler.Object); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs index d0b676eb03..ba5b3dd728 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs @@ -56,7 +56,7 @@ public RunTestsWithSourcesTests() _mockRequestData.Setup(rd => rd.MetricsCollection).Returns(_mockMetricsCollection.Object); TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(RunTestsWithSourcesTests).Assembly.Location }, + [typeof(RunTestsWithSourcesTests).Assembly.Location], () => { }); TestPluginCache.Instance.DiscoverTestExtensions(TestPlatformConstants.TestAdapterEndsWithPattern); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/PostProcessing/ArtifactProcessingTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/PostProcessing/ArtifactProcessingTests.cs index f38dfc2eee..909ac63b15 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/PostProcessing/ArtifactProcessingTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/PostProcessing/ArtifactProcessingTests.cs @@ -140,7 +140,7 @@ public async Task PostProcessArtifactsAsync_ShouldRunPostProcessing() // arrange _fileHelperMock.Setup(x => x.DirectoryExists(It.IsAny())).Returns(true); _fileHelperMock.Setup(x => x.GetFiles(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns((string path, string pattern, SearchOption so) => new string[2] { "/tmp/sessionId/runsettings.xml", "/tmp/sessionId/executionComplete.json" }); + .Returns((string path, string pattern, SearchOption so) => ["/tmp/sessionId/runsettings.xml", "/tmp/sessionId/executionComplete.json"]); _fileHelperMock.Setup(x => x.GetStream(It.IsAny(), It.IsAny(), It.IsAny())) .Returns((string path, FileMode mode, FileAccess access) => { @@ -188,7 +188,7 @@ public async Task PostProcessArtifactsAsync_NullRunSettings_ShouldRunPostProcess // arrange _fileHelperMock.Setup(x => x.DirectoryExists(It.IsAny())).Returns(true); _fileHelperMock.Setup(x => x.GetFiles(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns((string path, string pattern, SearchOption so) => new string[1] { "/tmp/sessionId/executionComplete.json" }); + .Returns((string path, string pattern, SearchOption so) => ["/tmp/sessionId/executionComplete.json"]); _fileHelperMock.Setup(x => x.GetStream(It.IsAny(), It.IsAny(), It.IsAny())) .Returns((string path, FileMode mode, FileAccess access) => { @@ -231,7 +231,7 @@ public async Task PostProcessArtifactsAsync_EmptyInvokedDataCollectors_ShouldRun // arrange _fileHelperMock.Setup(x => x.DirectoryExists(It.IsAny())).Returns(true); _fileHelperMock.Setup(x => x.GetFiles(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns((string path, string pattern, SearchOption so) => new string[1] { "/tmp/sessionId/runsettings.xml" }); + .Returns((string path, string pattern, SearchOption so) => ["/tmp/sessionId/runsettings.xml"]); _fileHelperMock.Setup(x => x.GetStream(It.IsAny(), It.IsAny(), It.IsAny())) .Returns((string path, FileMode mode, FileAccess access) => { @@ -266,7 +266,7 @@ public async Task PostProcessArtifactsAsync_DeserializationException_ShouldStopP // arrange _fileHelperMock.Setup(x => x.DirectoryExists(It.IsAny())).Returns(true); _fileHelperMock.Setup(x => x.GetFiles(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns((string path, string pattern, SearchOption so) => new string[1] { "/tmp/sessionId/executionComplete.json" }); + .Returns((string path, string pattern, SearchOption so) => ["/tmp/sessionId/executionComplete.json"]); _fileHelperMock.Setup(x => x.GetStream(It.IsAny(), It.IsAny(), It.IsAny())) .Returns((string path, FileMode mode, FileAccess access) => { diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs index 7608bee072..420f2ab44c 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestEngineTests.cs @@ -31,7 +31,7 @@ public class TestEngineTests public TestEngineTests() { - TestPluginCacheHelper.SetupMockExtensions(new[] { typeof(TestEngineTests).Assembly.Location }, () => { }); + TestPluginCacheHelper.SetupMockExtensions([typeof(TestEngineTests).Assembly.Location], () => { }); _mockProcessHelper = new Mock(); _mockRequestData = new Mock(); _mockMetricsCollection = new Mock(); @@ -1042,7 +1042,7 @@ public void CreatingNonParallelExecutionManagerShouldReturnExecutionManagerWithD var testRunCriteria = new TestRunCriteria(new List { "1.dll" }, 100, false, settingXml); var runtimeProviderInfo = new TestRuntimeProviderInfo(typeof(ITestRuntimeProvider), false, settingXml, - new List { new() { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework } }); + [new() { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }]); var nonParallelExecutionManager = _testEngine.CreateNonParallelExecutionManager(_mockRequestData.Object, testRunCriteria, true, runtimeProviderInfo); Assert.IsNotNull(nonParallelExecutionManager); @@ -1068,10 +1068,10 @@ public void CreatedNonParallelExecutionManagerShouldBeInitialzedWithCorrectTestS "; var runtimeProviderInfo = new TestRuntimeProviderInfo(typeof(ITestRuntimeProvider), false, settingXml, - new List { - new() { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, - new() { Source = "2.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework } - }); + [ + new() { Source = "1.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework }, + new() { Source = "2.dll", Architecture = Architecture.X86, Framework = Framework.DefaultFramework } + ]); var nonParallelExecutionManager = _testEngine.CreateNonParallelExecutionManager(_mockRequestData.Object, testRunCriteria, true, runtimeProviderInfo); Assert.IsInstanceOfType(nonParallelExecutionManager, typeof(ProxyExecutionManagerWithDataCollection)); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs index e72987971c..7510928451 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/TestLoggerManagerTests.cs @@ -36,7 +36,7 @@ public class TestLoggerManagerTests public void Initialize() { TestPluginCacheHelper.SetupMockExtensions( - new string[] { typeof(TestLoggerManagerTests).Assembly.Location }, + [typeof(TestLoggerManagerTests).Assembly.Location], () => { }); } @@ -409,7 +409,7 @@ public void HandleDiscoveredTestsShouldInvokeDiscoveredTestsHandlerOfLoggers() s_counter = 0; WaitHandle.Reset(); - List testCases = new() { new TestCase("This is a string.", new Uri("some://uri"), "DummySourceFileName") }; + List testCases = [new TestCase("This is a string.", new Uri("some://uri"), "DummySourceFileName")]; DiscoveredTestsEventArgs discoveredTestsEventArgs = new(testCases); // setup TestLogger @@ -430,7 +430,7 @@ public void HandleDiscoveredTestsShouldNotInvokeDiscoveredTestsHandlerOfLoggersI s_counter = 0; WaitHandle.Reset(); - List testCases = new() { new TestCase("This is a string.", new Uri("some://uri"), "DummySourceFileName") }; + List testCases = [new TestCase("This is a string.", new Uri("some://uri"), "DummySourceFileName")]; DiscoveredTestsEventArgs discoveredTestsEventArgs = new(testCases); // setup TestLogger diff --git a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/ProcessDumpUtilityTests.cs b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/ProcessDumpUtilityTests.cs index 629b94f369..03e9c234ac 100644 --- a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/ProcessDumpUtilityTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/ProcessDumpUtilityTests.cs @@ -44,7 +44,7 @@ public void GetDumpFileWillThrowExceptionIfNoDumpfile() var testResultsDirectory = "D:\\TestResults"; _mockFileHelper.Setup(x => x.GetFiles(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(System.Array.Empty()); + .Returns([]); _mockProcessHelper.Setup(x => x.GetProcessName(processId)) .Returns(process); diff --git a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs index 91a2b72fa6..9c1cc94e27 100644 --- a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs @@ -739,11 +739,11 @@ public void GetCustomPropertyValueFromTestCaseShouldReadCategoryAttributesFromTe List listCategoriesActual = Converter.GetCustomPropertyValueFromTestCase(testCase1, "MSTestDiscoverer.TestCategory"); - List listCategoriesExpected = new() - { + List listCategoriesExpected = + [ "ClassLevel", "AsmLevel" - }; + ]; CollectionAssert.AreEqual(listCategoriesExpected, listCategoriesActual); } @@ -758,11 +758,11 @@ public void GetCustomPropertyValueFromTestCaseShouldReadWorkItemAttributesFromTe List listWorkItemsActual = Converter.GetCustomPropertyValueFromTestCase(testCase1, "WorkItemIds"); - List listWorkItemsExpected = new() - { + List listWorkItemsExpected = + [ "99999", "0" - }; + ]; CollectionAssert.AreEqual(listWorkItemsExpected, listWorkItemsActual); } diff --git a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs index f5eb8b75bd..a459932bfc 100644 --- a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs @@ -96,7 +96,7 @@ public void ToTestElementShouldAssignTestCategoryOfUnitTestElement() var unitTestElement = Converter.ToTestElement(testCase.Id, Guid.Empty, Guid.Empty, testCase.DisplayName, TrxLoggerConstants.UnitTestType, testCase); - object[] expected = new[] { "MethodLevel", "ClassLevel", "AsmLevel" }; + object[] expected = ["MethodLevel", "ClassLevel", "AsmLevel"]; CollectionAssert.AreEqual(expected, unitTestElement.TestCategories.ToArray().OrderByDescending(x => x).ToArray()); } @@ -112,7 +112,7 @@ public void ToTestElementShouldAssignWorkItemOfUnitTestElement() var unitTestElement = Converter.ToTestElement(testCase.Id, Guid.Empty, Guid.Empty, testCase.DisplayName, TrxLoggerConstants.UnitTestType, testCase); - int[] expected = new[] { 0, 3, 99999 }; + int[] expected = [0, 3, 99999]; CollectionAssert.AreEquivalent(expected, unitTestElement.WorkItems.ToArray()); } @@ -227,10 +227,7 @@ private static void SetupForToCollectionEntries(out string tempDir, out List - { - new(new Uri("datacollector://microsoft/CodeCoverage/2.0"), "Code Coverage") - }; + attachmentSets = [new(new Uri("datacollector://microsoft/CodeCoverage/2.0"), "Code Coverage")]; testRun = new TestRun(Guid.NewGuid()); testRun.RunConfiguration = new TestRunConfiguration("Testrun 1", new TrxFileHelper()); diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs index 9b36182524..0055035827 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs @@ -60,7 +60,7 @@ public DefaultTestHostManagerTests() _testHostManager = new DefaultTestHostManager(_mockProcessHelper.Object, _mockFileHelper.Object, _mockDotnetHostHelper.Object, _mockEnvironment.Object, _mockEnvironmentVariable.Object); _testHostManager.Initialize(_mockMessageLogger.Object, $" {Architecture.X64} {Framework.DefaultFramework} {false} "); - _startInfo = _testHostManager.GetTestHostProcessStartInfo(Enumerable.Empty(), null, default); + _startInfo = _testHostManager.GetTestHostProcessStartInfo([], null, default); } [TestMethod] @@ -68,7 +68,7 @@ public void ConstructorShouldSetX86ProcessForX86Architecture() { _testHostManager.Initialize(_mockMessageLogger.Object, $" {Architecture.X86} {Framework.DefaultFramework} {false} "); - var info = _testHostManager.GetTestHostProcessStartInfo(Enumerable.Empty(), null, default); + var info = _testHostManager.GetTestHostProcessStartInfo([], null, default); StringAssert.EndsWith(info.FileName, "testhost.x86.exe"); } @@ -84,7 +84,7 @@ public void GetTestHostProcessStartInfoShouldIncludeFileNameFromSubFolderTestHos { _mockProcessHelper.Setup(ph => ph.GetCurrentProcessFileName()).Returns("dotnet.exe"); _mockFileHelper.Setup(x => x.Exists(It.IsAny())).Returns(false); - var startInfo = _testHostManager.GetTestHostProcessStartInfo(Enumerable.Empty(), null, default); + var startInfo = _testHostManager.GetTestHostProcessStartInfo([], null, default); Assert.IsTrue(startInfo.FileName!.EndsWith(Path.Combine("TestHostNetFramework", "testhost.exe"))); } @@ -94,7 +94,7 @@ public void GetTestHostProcessStartInfoShouldNotIncludeFileNameFromSubFolderTest { _mockProcessHelper.Setup(ph => ph.GetCurrentProcessFileName()).Returns("dotnet.exe"); _mockFileHelper.Setup(x => x.Exists(It.IsAny())).Returns(true); - var startInfo = _testHostManager.GetTestHostProcessStartInfo(Enumerable.Empty(), null, default); + var startInfo = _testHostManager.GetTestHostProcessStartInfo([], null, default); Assert.IsFalse(startInfo.FileName!.EndsWith(Path.Combine("TestHost", "testhost.exe"))); Assert.IsTrue(startInfo.FileName!.EndsWith("testhost.exe")); @@ -104,7 +104,7 @@ public void GetTestHostProcessStartInfoShouldNotIncludeFileNameFromSubFolderTest public void GetTestHostProcessStartInfoShouldNotIncludeFileNameFromSubFolderTestHostWhenCurrentProcessIsIde() { _mockProcessHelper.Setup(ph => ph.GetCurrentProcessFileName()).Returns("devenv.exe"); - var startInfo = _testHostManager.GetTestHostProcessStartInfo(Enumerable.Empty(), null, default); + var startInfo = _testHostManager.GetTestHostProcessStartInfo([], null, default); Assert.IsFalse(startInfo.FileName!.EndsWith(Path.Combine("TestHost", "testhost.exe"))); Assert.IsTrue(startInfo.FileName!.EndsWith("testhost.exe")); @@ -115,7 +115,7 @@ public void GetTestHostProcessStartInfoShouldIncludeConnectionInfo() { var connectionInfo = new TestRunnerConnectionInfo { Port = 123, ConnectionInfo = new TestHostConnectionInfo { Endpoint = "127.0.0.0:123", Role = ConnectionRole.Client, Transport = Transport.Sockets }, RunnerProcessId = 101 }; var info = _testHostManager.GetTestHostProcessStartInfo( - Enumerable.Empty(), + [], null, connectionInfo); @@ -148,7 +148,7 @@ public void GetTestHostProcessStartInfoShouldIncludeEnvironmentVariables() { var environmentVariables = new Dictionary { { "k1", "v1" } }; - var info = _testHostManager.GetTestHostProcessStartInfo(Enumerable.Empty(), environmentVariables, default); + var info = _testHostManager.GetTestHostProcessStartInfo([], environmentVariables, default); Assert.AreEqual(environmentVariables, info.EnvironmentVariables); } @@ -213,7 +213,7 @@ public void GetTestHostProcessStartInfoShouldNotUseMonoAsHostOnNonWindowsIfStart public void GetTestPlatformExtensionsShouldReturnExtensionsListAsIsIfSourcesListIsEmpty() { _testHostManager.Initialize(_mockMessageLogger.Object, $" "); - List currentList = new() { @"FooExtension.dll" }; + List currentList = [@"FooExtension.dll"]; // Act var resultExtensions = _testHostManager.GetTestPlatformExtensions(new List(), currentList).ToList(); @@ -226,7 +226,7 @@ public void GetTestPlatformExtensionsShouldReturnExtensionsListAsIsIfSourcesList public void GetTestPlatformExtensionsShouldReturnExtensionsListAsIsIfSourcesListIsNull() { _testHostManager.Initialize(_mockMessageLogger.Object, $" "); - List currentList = new() { @"FooExtension.dll" }; + List currentList = [@"FooExtension.dll"]; // Act var resultExtensions = _testHostManager.GetTestPlatformExtensions(null, currentList).ToList(); @@ -238,17 +238,17 @@ public void GetTestPlatformExtensionsShouldReturnExtensionsListAsIsIfSourcesList [TestMethod] public void GetTestPlatformExtensionsShouldNotExcludeOutputDirectoryExtensionsIfTestAdapterPathIsSet() { - List sourcesDir = new() { @"C:\Source1" }; - List sources = new() { @"C:\Source1\source1.dll" }; + List sourcesDir = [@"C:\Source1"]; + List sources = [@"C:\Source1\source1.dll"]; - List extensionsList1 = new() { @"C:\Source1\ext1.TestAdapter.dll", @"C:\Source1\ext2.TestAdapter.dll" }; + List extensionsList1 = [@"C:\Source1\ext1.TestAdapter.dll", @"C:\Source1\ext2.TestAdapter.dll"]; _mockFileHelper.Setup(fh => fh.EnumerateFiles(sourcesDir[0], SearchOption.TopDirectoryOnly, "TestAdapter.dll")).Returns(extensionsList1); _mockFileHelper.Setup(fh => fh.GetFileVersion(extensionsList1[0])).Returns(new Version(2, 0)); _mockFileHelper.Setup(fh => fh.GetFileVersion(extensionsList1[1])).Returns(new Version(5, 5)); _testHostManager.Initialize(_mockMessageLogger.Object, $" C:\\Foo "); - List currentList = new() { @"FooExtension.dll", @"C:\Source1\ext1.TestAdapter.dll", @"C:\Source1\ext2.TestAdapter.dll" }; + List currentList = [@"FooExtension.dll", @"C:\Source1\ext1.TestAdapter.dll", @"C:\Source1\ext2.TestAdapter.dll"]; // Act var resultExtensions = _testHostManager.GetTestPlatformExtensions(sources, currentList).ToList(); @@ -261,11 +261,11 @@ public void GetTestPlatformExtensionsShouldNotExcludeOutputDirectoryExtensionsIf [TestCategory("Windows")] public void GetTestPlatformExtensionsShouldIncludeOutputDirectoryExtensionsIfTestAdapterPathIsNotSet() { - List sourcesDir = new() { "C:\\Source1", "C:\\Source2" }; - List sources = new() { @"C:\Source1\source1.dll", @"C:\Source2\source2.dll" }; + List sourcesDir = ["C:\\Source1", "C:\\Source2"]; + List sources = [@"C:\Source1\source1.dll", @"C:\Source2\source2.dll"]; - List extensionsList1 = new() { @"C:\Source1\ext1.TestAdapter.dll", @"C:\Source1\ext2.TestAdapter.dll" }; - List extensionsList2 = new() { @"C:\Source2\ext1.TestAdapter.dll", @"C:\Source2\ext2.TestAdapter.dll" }; + List extensionsList1 = [@"C:\Source1\ext1.TestAdapter.dll", @"C:\Source1\ext2.TestAdapter.dll"]; + List extensionsList2 = [@"C:\Source2\ext1.TestAdapter.dll", @"C:\Source2\ext2.TestAdapter.dll"]; _mockFileHelper.Setup(fh => fh.GetFileVersion(extensionsList1[0])).Returns(new Version(2, 0)); _mockFileHelper.Setup(fh => fh.GetFileVersion(extensionsList1[1])).Returns(new Version(5, 5)); @@ -281,7 +281,7 @@ public void GetTestPlatformExtensionsShouldIncludeOutputDirectoryExtensionsIfTes var resultExtensions = _testHostManager.GetTestPlatformExtensions(sources, new List()).ToList(); // Verify - List expectedList = new() { @"C:\Source2\ext1.TestAdapter.dll", @"C:\Source1\ext2.TestAdapter.dll" }; + List expectedList = [@"C:\Source2\ext1.TestAdapter.dll", @"C:\Source1\ext2.TestAdapter.dll"]; CollectionAssert.AreEqual(expectedList, resultExtensions); _mockMessageLogger.Verify(ml => ml.SendMessage(TestMessageLevel.Warning, "Multiple versions of same extension found. Selecting the highest version." + Environment.NewLine + " ext1.TestAdapter : 2.2\n ext2.TestAdapter : 5.5"), Times.Once); } @@ -290,11 +290,11 @@ public void GetTestPlatformExtensionsShouldIncludeOutputDirectoryExtensionsIfTes [TestCategory("Windows")] public void GetTestPlatformExtensionsShouldReturnPathTheHigherVersionedFileExtensions() { - List sourcesDir = new() { "C:\\Source1", "C:\\Source2" }; - List sources = new() { @"C:\Source1\source1.dll", @"C:\Source2\source2.dll" }; + List sourcesDir = ["C:\\Source1", "C:\\Source2"]; + List sources = [@"C:\Source1\source1.dll", @"C:\Source2\source2.dll"]; - List extensionsList1 = new() { @"C:\Source1\ext1.TestAdapter.dll" }; - List extensionsList2 = new() { @"C:\Source2\ext1.TestAdapter.dll" }; + List extensionsList1 = [@"C:\Source1\ext1.TestAdapter.dll"]; + List extensionsList2 = [@"C:\Source2\ext1.TestAdapter.dll"]; _mockFileHelper.Setup(fh => fh.GetFileVersion(extensionsList1[0])).Returns(new Version(2, 0)); _mockFileHelper.Setup(fh => fh.GetFileVersion(extensionsList2[0])).Returns(new Version(2, 2)); @@ -316,11 +316,11 @@ public void GetTestPlatformExtensionsShouldReturnPathTheHigherVersionedFileExten [TestCategory("Windows")] public void GetTestPlatformExtensionsShouldReturnPathToSingleFileExtensionOfATypeIfVersionsAreSame() { - List sourcesDir = new() { "C:\\Source1", "C:\\Source2" }; - List sources = new() { @"C:\Source1\source1.dll", @"C:\Source2\source2.dll" }; + List sourcesDir = ["C:\\Source1", "C:\\Source2"]; + List sources = [@"C:\Source1\source1.dll", @"C:\Source2\source2.dll"]; - List extensionsList1 = new() { @"C:\Source1\ext1.TestAdapter.dll" }; - List extensionsList2 = new() { @"C:\Source2\ext1.TestAdapter.dll" }; + List extensionsList1 = [@"C:\Source1\ext1.TestAdapter.dll"]; + List extensionsList2 = [@"C:\Source2\ext1.TestAdapter.dll"]; _mockFileHelper.Setup(fh => fh.GetFileVersion(extensionsList1[0])).Returns(new Version(2, 0)); _mockFileHelper.Setup(fh => fh.GetFileVersion(extensionsList2[0])).Returns(new Version(2, 0)); @@ -353,7 +353,7 @@ public void LaunchTestHostShouldReturnTestHostProcessId() It.IsAny>())).Returns(Process.GetCurrentProcess()); _testHostManager.Initialize(_mockMessageLogger.Object, $" {Architecture.X64} {Framework.DefaultFramework} {false} "); - var startInfo = _testHostManager.GetTestHostProcessStartInfo(Enumerable.Empty(), null, default); + var startInfo = _testHostManager.GetTestHostProcessStartInfo([], null, default); _testHostManager.HostLaunched += TestHostManagerHostLaunched; diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs index af5ee66ec3..7d643fcae4 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs @@ -42,7 +42,7 @@ public class DotnetTestHostManagerTests private readonly Mock _mockEnvironment; private readonly Mock _mockRunsettingHelper; private readonly TestRunnerConnectionInfo _defaultConnectionInfo; - private readonly string[] _testSource = { "test.dll" }; + private readonly string[] _testSource = ["test.dll"]; private readonly string _defaultTestHostPath; private readonly TestProcessStartInfo _defaultTestProcessStartInfo; private readonly TestableDotnetTestHostManager _dotnetHostManager; @@ -548,7 +548,7 @@ public void GetTestHostProcessStartInfoShouldIncludeSourceDirectoryAsWorkingDire public void GetTestPlatformExtensionsShouldReturnEmptySetIfSourceDirectoryDoesNotExist() { _mockFileHelper.Setup(fh => fh.DirectoryExists(It.IsAny())).Returns(false); - var extensions = _dotnetHostManager.GetTestPlatformExtensions(new[] { $".{Path.DirectorySeparatorChar}foo.dll" }, Enumerable.Empty()); + var extensions = _dotnetHostManager.GetTestPlatformExtensions(new[] { $".{Path.DirectorySeparatorChar}foo.dll" }, []); Assert.AreEqual(0, extensions.Count()); } @@ -558,7 +558,7 @@ public void GetTestPlatformExtensionsShouldReturnLibrariesFromSourceDirectory() { _mockFileHelper.Setup(fh => fh.DirectoryExists(It.IsAny())).Returns(true); _mockFileHelper.Setup(fh => fh.EnumerateFiles(It.IsAny(), SearchOption.TopDirectoryOnly, It.IsAny())).Returns(new[] { "foo.TestAdapter.dll" }); - var extensions = _dotnetHostManager.GetTestPlatformExtensions(new[] { $".{Path.DirectorySeparatorChar}foo.dll" }, Enumerable.Empty()); + var extensions = _dotnetHostManager.GetTestPlatformExtensions(new[] { $".{Path.DirectorySeparatorChar}foo.dll" }, []); CollectionAssert.AreEqual(new[] { "foo.TestAdapter.dll" }, extensions.ToArray()); } @@ -569,7 +569,7 @@ public void GetTestPlatformExtensionsShouldReturnEmptySetIfSourceDirectoryIsEmpt // Parent directory is empty since the input source is file "test.dll" _mockFileHelper.Setup(fh => fh.DirectoryExists(It.IsAny())).Returns(true); _mockFileHelper.Setup(fh => fh.EnumerateFiles(It.IsAny(), SearchOption.TopDirectoryOnly, It.IsAny())).Returns(new[] { "foo.dll" }); - var extensions = _dotnetHostManager.GetTestPlatformExtensions(_testSource, Enumerable.Empty()); + var extensions = _dotnetHostManager.GetTestPlatformExtensions(_testSource, []); Assert.AreEqual(0, extensions.Count()); } @@ -579,7 +579,7 @@ public void GetTestPlatformExtensionsShouldNotAddNonCoverletDataCollectorsExtens { _mockFileHelper.Setup(fh => fh.DirectoryExists(It.IsAny())).Returns(true); _mockFileHelper.Setup(fh => fh.EnumerateFiles(It.IsAny(), SearchOption.TopDirectoryOnly, It.IsAny())).Returns(new[] { "foo.dll" }); - var extensions = _dotnetHostManager.GetTestPlatformExtensions(_testSource, new List { "abc.dataollector.dll" }); + var extensions = _dotnetHostManager.GetTestPlatformExtensions(_testSource, ["abc.dataollector.dll"]); Assert.AreEqual(0, extensions.Count()); } diff --git a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs index 0fe2212be4..123a0167a7 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs @@ -174,7 +174,7 @@ public static string PrepareArguments(string[] testAssemblies, string? testAdapt /// Command line arguments string. public static string PrepareArguments(string testAssembly, string? testAdapterPath, string? runSettings, string framework, string? inIsolation = "", string? resultsDirectory = null) - => PrepareArguments(new string[] { testAssembly }, testAdapterPath, runSettings, framework, inIsolation, resultsDirectory); + => PrepareArguments([testAssembly], testAdapterPath, runSettings, framework, inIsolation, resultsDirectory); /// diff --git a/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs b/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs index a36eee6046..e9c401a7b6 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/TestPluginCacheHelper.cs @@ -17,7 +17,7 @@ public static class TestPluginCacheHelper public static TestableTestPluginCache SetupMockAdditionalPathExtensions(Type callingTest) { return SetupMockAdditionalPathExtensions( - new string[] { callingTest.Assembly.Location }); + [callingTest.Assembly.Location]); } public static TestableTestPluginCache SetupMockAdditionalPathExtensions(string[] extensions) @@ -42,7 +42,7 @@ public static void SetupMockExtensions(Type callingTest, Mock? mock public static void SetupMockExtensions(Type callingTest, Action callback, Mock? mockFileHelper = null) { - SetupMockExtensions(new[] { callingTest.Assembly.Location }, callback, mockFileHelper); + SetupMockExtensions([callingTest.Assembly.Location], callback, mockFileHelper); } public static void SetupMockExtensions(string[] extensions, Action callback, Mock? mockFileHelper = null) diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageDataAttachmentsHandlerTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageDataAttachmentsHandlerTests.cs index 0761e61d69..0dfa24dd46 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageDataAttachmentsHandlerTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageDataAttachmentsHandlerTests.cs @@ -86,7 +86,7 @@ public async Task HandleDataCollectionAttachmentSetsShouldReturnInputIfOnly1Atta var attachmentSet = new AttachmentSet(new Uri("datacollector://microsoft/CodeCoverage/2.0"), string.Empty); attachmentSet.Attachments.Add(new UriDataAttachment(new Uri("C:\\temp\\aa.coverage"), "coverage")); - Collection attachment = new() { attachmentSet }; + Collection attachment = [attachmentSet]; ICollection resultAttachmentSets = await _coverageDataAttachmentsHandler.ProcessAttachmentSetsAsync(_configurationElement, attachment, _mockProgressReporter.Object, null, CancellationToken.None); @@ -106,7 +106,7 @@ public async Task HandleDataCollectionAttachmentSetsShouldReturnInputIf2Differen attachmentSet.Attachments.Add(new UriDataAttachment(new Uri(file1Path), "coverage")); attachmentSet.Attachments.Add(new UriDataAttachment(new Uri(file2Path), "coverage")); - Collection attachment = new() { attachmentSet }; + Collection attachment = [attachmentSet]; ICollection resultAttachmentSets = await _coverageDataAttachmentsHandler.ProcessAttachmentSetsAsync(_configurationElement, attachment, _mockProgressReporter.Object, null, CancellationToken.None); @@ -127,7 +127,7 @@ public async Task HandleDataCollectionAttachmentSetsShouldReturnInputIf2SameForm attachmentSet.Attachments.Add(new UriDataAttachment(new Uri(file1Path), "coverage")); attachmentSet.Attachments.Add(new UriDataAttachment(new Uri(file1Path), "coverage")); - Collection attachment = new() { attachmentSet }; + Collection attachment = [attachmentSet]; ICollection resultAttachmentSets = await _coverageDataAttachmentsHandler.ProcessAttachmentSetsAsync(_configurationElement, attachment, _mockProgressReporter.Object, null, CancellationToken.None); @@ -144,7 +144,7 @@ public async Task HandleDataCollectionAttachmentSetsShouldReturnInputIfOnly1Logs var attachmentSet = new AttachmentSet(new Uri("datacollector://microsoft/CodeCoverage/2.0"), string.Empty); attachmentSet.Attachments.Add(new UriDataAttachment(new Uri("C:\\temp\\aa.logs"), "coverage")); - Collection attachment = new() { attachmentSet }; + Collection attachment = [attachmentSet]; ICollection resultAttachmentSets = await _coverageDataAttachmentsHandler.ProcessAttachmentSetsAsync(_configurationElement, attachment, _mockProgressReporter.Object, null, CancellationToken.None); @@ -165,7 +165,7 @@ public async Task HandleDataCollectionAttachmentSetsShouldReturnInputIfOnlySever attachmentSet1.Attachments.Add(new UriDataAttachment(new Uri("C:\\temp\\aa.logs"), "coverage")); attachmentSet1.Attachments.Add(new UriDataAttachment(new Uri("C:\\temp\\bb.logs"), "coverage")); - Collection attachment = new() { attachmentSet, attachmentSet1 }; + Collection attachment = [attachmentSet, attachmentSet1]; ICollection resultAttachmentSets = await _coverageDataAttachmentsHandler.ProcessAttachmentSetsAsync(_configurationElement, attachment, _mockProgressReporter.Object, null, CancellationToken.None); @@ -183,11 +183,11 @@ public async Task HandleDataCollectionAttachmentSetsShouldThrowIfCancellationReq CancellationTokenSource cts = new(); cts.Cancel(); - Collection attachment = new() - { + Collection attachment = + [ attachmentSet, attachmentSet - }; + ]; await Assert.ThrowsExceptionAsync(async () => await _coverageDataAttachmentsHandler.ProcessAttachmentSetsAsync(_configurationElement, attachment, _mockProgressReporter.Object, null, cts.Token)); diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/CommandLineUtilitiesTest.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/CommandLineUtilitiesTest.cs index 30789efec3..c1106695a7 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/CommandLineUtilitiesTest.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/CommandLineUtilitiesTest.cs @@ -24,9 +24,9 @@ private static void VerifyCommandLineSplitter(string commandLine, string[] expec [TestMethod] public void TestCommandLineSplitter() { - VerifyCommandLineSplitter("", System.Array.Empty()); - VerifyCommandLineSplitter("/testadapterpath:\"c:\\Path\"", new[] { @"/testadapterpath:c:\Path" }); - VerifyCommandLineSplitter("/testadapterpath:\"c:\\Path\" /logger:\"trx\"", new[] { @"/testadapterpath:c:\Path", "/logger:trx" }); - VerifyCommandLineSplitter("/testadapterpath:\"c:\\Path\" /logger:\"trx\" /diag:\"log.txt\"", new[] { @"/testadapterpath:c:\Path", "/logger:trx", "/diag:log.txt" }); + VerifyCommandLineSplitter("", []); + VerifyCommandLineSplitter("/testadapterpath:\"c:\\Path\"", [@"/testadapterpath:c:\Path"]); + VerifyCommandLineSplitter("/testadapterpath:\"c:\\Path\" /logger:\"trx\"", [@"/testadapterpath:c:\Path", "/logger:trx"]); + VerifyCommandLineSplitter("/testadapterpath:\"c:\\Path\" /logger:\"trx\" /diag:\"log.txt\"", [@"/testadapterpath:c:\Path", "/logger:trx", "/diag:log.txt"]); } } diff --git a/test/SettingsMigrator.UnitTests/PathResolverTests.cs b/test/SettingsMigrator.UnitTests/PathResolverTests.cs index 7df59759f3..678865ddd4 100644 --- a/test/SettingsMigrator.UnitTests/PathResolverTests.cs +++ b/test/SettingsMigrator.UnitTests/PathResolverTests.cs @@ -22,49 +22,49 @@ public PathResolverTests() [TestMethod] public void PathResolverShouldReturnNullForEmptyArguments() { - var newFilePath = _pathResolver.GetTargetPath(Array.Empty()); + var newFilePath = _pathResolver.GetTargetPath([]); Assert.IsNull(newFilePath, "Empty arguments should return null"); } [TestMethod] public void PathResolverShouldReturnNullForInvalidArguments() { - var newFilePath = _pathResolver.GetTargetPath(new string[] { "asd", "asd", "asd" }); + var newFilePath = _pathResolver.GetTargetPath(["asd", "asd", "asd"]); Assert.IsNull(newFilePath, "Invalid arguments should return null"); } [TestMethod] public void PathResolverShouldReturnNullForRelativePaths() { - var newFilePath = _pathResolver.GetTargetPath(new string[] { "asd.testsettings" }); + var newFilePath = _pathResolver.GetTargetPath(["asd.testsettings"]); Assert.IsNull(newFilePath, "Relative paths should return null"); } [TestMethod] public void PathResolverShouldReturnNullForRelativePathsWithTwoArguments() { - var newFilePath = _pathResolver.GetTargetPath(new string[] { "asd.Testsettings", "C:\\asd.runsettings" }); + var newFilePath = _pathResolver.GetTargetPath(["asd.Testsettings", "C:\\asd.runsettings"]); Assert.IsNull(newFilePath, "Relative paths should return null"); } [TestMethod] public void PathResolverShouldNotReturnNullForPathsWithExtensionInCapitals() { - var newFilePath = _pathResolver.GetTargetPath(new string[] { "C:\\asd.TestSEettings", "C:\\asd.RuNSettings" }); + var newFilePath = _pathResolver.GetTargetPath(["C:\\asd.TestSEettings", "C:\\asd.RuNSettings"]); Assert.IsNotNull(newFilePath, "Relative paths should not return null"); } [TestMethod] public void PathResolverShouldReturnNullForRelativePathsForRunsettings() { - var newFilePath = _pathResolver.GetTargetPath(new string[] { "C:\\asd.testsettings", "asd.runsettings" }); + var newFilePath = _pathResolver.GetTargetPath(["C:\\asd.testsettings", "asd.runsettings"]); Assert.IsNull(newFilePath, "Relative paths should return null"); } [TestMethod] public void PathResolverShouldReturnRunsettingsPathOfSameLocationAsTestSettings() { - var newFilePath = _pathResolver.GetTargetPath(new string[] { "C:\\asd.testsettings" }); + var newFilePath = _pathResolver.GetTargetPath(["C:\\asd.testsettings"]); Assert.IsNotNull(newFilePath, "File path should not be null."); Assert.IsTrue(string.Equals(Path.GetExtension(newFilePath), ".runsettings"), "File path should be .runsettings"); Assert.IsTrue(newFilePath!.Contains("C:\\asd_"), "File should be of same name as testsettings"); diff --git a/test/SettingsMigrator.UnitTests/ProgramTests.cs b/test/SettingsMigrator.UnitTests/ProgramTests.cs index 5025e97963..9e4ef90675 100644 --- a/test/SettingsMigrator.UnitTests/ProgramTests.cs +++ b/test/SettingsMigrator.UnitTests/ProgramTests.cs @@ -11,14 +11,14 @@ public class ProgramTests [TestMethod] public void MoreThanTwoArgumentsShouldNotBeAccepted() { - int returnCode = Program.Main(new string[] { "asd", "asd", "asd" }); + int returnCode = Program.Main(["asd", "asd", "asd"]); Assert.AreEqual(1, returnCode, "More than 2 arguments should not be accepted."); } [TestMethod] public void NoArgumentsShouldNotBeAccepted() { - int returnCode = Program.Main(System.Array.Empty()); + int returnCode = Program.Main([]); Assert.AreEqual(1, returnCode, "No arguments should not be accepted."); } } diff --git a/test/TranslationLayer.UnitTests/TestSessionTests.cs b/test/TranslationLayer.UnitTests/TestSessionTests.cs index f6eb5fac6a..5b2220d1bc 100644 --- a/test/TranslationLayer.UnitTests/TestSessionTests.cs +++ b/test/TranslationLayer.UnitTests/TestSessionTests.cs @@ -22,12 +22,12 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer.UnitTests; public class TestSessionTests { private readonly string _testSettings = "TestSettings"; - private readonly List _testSources = new() { "Hello", "World" }; - private readonly List _testCases = new() - { + private readonly List _testSources = ["Hello", "World"]; + private readonly List _testCases = + [ new TestCase("a.b.c", new Uri("d://uri"), "a.dll"), new TestCase("d.e.f", new Uri("g://uri"), "d.dll") - }; + ]; private readonly TestSessionInfo _testSessionInfo; private readonly ITestSession _testSession; diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs index 71d0689dcb..b2d496d208 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs @@ -436,13 +436,13 @@ public void DiscoverTestsShouldCompleteWithSingleFullyDiscoveredSource() var mockHandler = new Mock(); - List sources = new() { "1.dll" }; + List sources = ["1.dll"]; var testCase = new TestCase("hello", new Uri("world://how"), source: sources[0]); var testsFound = new Message() { MessageType = MessageType.TestCasesFound, - Payload = JToken.FromObject(new List() { testCase }) + Payload = JToken.FromObject(new List { testCase }) }; var payload = new DiscoveryCompletePayload() { TotalTests = 1, LastDiscoveredTests = null, IsAborted = false, FullyDiscoveredSources = sources }; @@ -476,7 +476,7 @@ public void DiscoverTestsShouldCompleteWithCorrectAbortedValuesIfAbortingWasRequ var mockHandler = new Mock(); - List sources = new() { "1.dll" }; + List sources = ["1.dll"]; var testCase = new TestCase("hello", new Uri("world://how"), source: sources[0]); var testsFound = new Message() diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs index 5b7ad29759..e3ba446662 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs @@ -28,12 +28,12 @@ public class VsTestConsoleWrapperTests private readonly Mock _mockProcessManager; private readonly Mock _mockProcessHelper; private readonly Mock _mockRequestSender; - private readonly List _testSources = new() { "Hello", "World" }; - private readonly List _testCases = new() - { + private readonly List _testSources = ["Hello", "World"]; + private readonly List _testCases = + [ new TestCase("a.b.c", new Uri("d://uri"), "a.dll"), new TestCase("d.e.f", new Uri("g://uri"), "d.dll") - }; + ]; private readonly ConsoleParameters _consoleParameters; private readonly Mock _telemetryEventsHandler; diff --git a/test/datacollector.UnitTests/DataCollectionManagerTests.cs b/test/datacollector.UnitTests/DataCollectionManagerTests.cs index e13553f3d0..7cf8a2a93a 100644 --- a/test/datacollector.UnitTests/DataCollectionManagerTests.cs +++ b/test/datacollector.UnitTests/DataCollectionManagerTests.cs @@ -359,7 +359,7 @@ public void SessionEndedShouldReturnAttachments() var attachment = new AttachmentSet(new Uri("my://custom/datacollector"), "CustomDataCollector"); attachment.Attachments.Add(new UriDataAttachment(new Uri("my://filename.txt"), "filename.txt")); - _mockDataCollectionAttachmentManager.Setup(x => x.GetAttachments(It.IsAny())).Returns(new List() { attachment }); + _mockDataCollectionAttachmentManager.Setup(x => x.GetAttachments(It.IsAny())).Returns([attachment]); _dataCollectionManager.InitializeDataCollectors(_dataCollectorSettings); var sessionStartEventArgs = new SessionStartEventArgs(); @@ -387,7 +387,7 @@ public void SessionEndedShouldContinueDataCollectionIfExceptionIsThrownWhileSend var attachment = new AttachmentSet(new Uri("my://custom/datacollector"), "CustomDataCollector"); attachment.Attachments.Add(new UriDataAttachment(new Uri("my://filename.txt"), "filename.txt")); - _mockDataCollectionAttachmentManager.Setup(x => x.GetAttachments(It.IsAny())).Returns(new List() { attachment }); + _mockDataCollectionAttachmentManager.Setup(x => x.GetAttachments(It.IsAny())).Returns([attachment]); SetupMockDataCollector((XmlElement a, DataCollectionEvents b, DataCollectionSink c, DataCollectionLogger d, DataCollectionEnvironmentContext e) => b.SessionEnd += (sender, ev) => diff --git a/test/datacollector.UnitTests/DataCollectorMainTests.cs b/test/datacollector.UnitTests/DataCollectorMainTests.cs index 8c83ca950b..59103a2949 100644 --- a/test/datacollector.UnitTests/DataCollectorMainTests.cs +++ b/test/datacollector.UnitTests/DataCollectorMainTests.cs @@ -20,9 +20,9 @@ namespace Microsoft.VisualStudio.TestPlatform.Common.DataCollector.UnitTests; [TestClass] public class DataCollectorMainTests { - private readonly string[] _args = { "--port", "1025", "--parentprocessid", "100", "--diag", "abc.txt", "--tracelevel", "3" }; - private readonly string[] _argsWithEmptyDiagArg = { "--port", "1025", "--parentprocessid", "100", "--diag", "", "--tracelevel", "3" }; - private readonly string[] _argsWithInvalidTraceLevel = { "--port", "1025", "--parentprocessid", "100", "--diag", "abc.txt", "--tracelevel", "5" }; + private readonly string[] _args = ["--port", "1025", "--parentprocessid", "100", "--diag", "abc.txt", "--tracelevel", "3"]; + private readonly string[] _argsWithEmptyDiagArg = ["--port", "1025", "--parentprocessid", "100", "--diag", "", "--tracelevel", "3"]; + private readonly string[] _argsWithInvalidTraceLevel = ["--port", "1025", "--parentprocessid", "100", "--diag", "abc.txt", "--tracelevel", "5"]; private static readonly string TimeoutErrorMessage = "datacollector process failed to connect to vstest.console process after 90 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout."; diff --git a/test/vstest.ProgrammerTests/Fakes/StringExtensions.cs b/test/vstest.ProgrammerTests/Fakes/StringExtensions.cs index f5df113f53..8d33f23acb 100644 --- a/test/vstest.ProgrammerTests/Fakes/StringExtensions.cs +++ b/test/vstest.ProgrammerTests/Fakes/StringExtensions.cs @@ -17,6 +17,6 @@ public static string JoinBy(this IEnumerable value, string delimiter) public static List AsList(this T value) { - return new List { value }; + return [value]; } } diff --git a/test/vstest.ProgrammerTests/MultiTFMRunAndDiscovery.cs b/test/vstest.ProgrammerTests/MultiTFMRunAndDiscovery.cs index 9ff6c075f7..36c9822d57 100644 --- a/test/vstest.ProgrammerTests/MultiTFMRunAndDiscovery.cs +++ b/test/vstest.ProgrammerTests/MultiTFMRunAndDiscovery.cs @@ -668,7 +668,7 @@ internal static string GetRawMessage(this Message request) s_messageProperty = request.GetType().GetProperty("RawMessage")!.GetGetMethod(); } - return (string)s_messageProperty!.Invoke(request, Array.Empty())!; + return (string)s_messageProperty!.Invoke(request, [])!; } } diff --git a/test/vstest.ProgrammerTests/Program.cs b/test/vstest.ProgrammerTests/Program.cs index 22f4c0e949..f6d0f025be 100644 --- a/test/vstest.ProgrammerTests/Program.cs +++ b/test/vstest.ProgrammerTests/Program.cs @@ -9,6 +9,6 @@ internal class Program { static void Main() { - Intent.Console.Program.Main(new[] { Assembly.GetExecutingAssembly().Location }); + Intent.Console.Program.Main([Assembly.GetExecutingAssembly().Location]); } } diff --git a/test/vstest.console.UnitTests/CommandLine/GenerateFakesUtilitiesTests.cs b/test/vstest.console.UnitTests/CommandLine/GenerateFakesUtilitiesTests.cs index 65f5013af7..201ee8312c 100644 --- a/test/vstest.console.UnitTests/CommandLine/GenerateFakesUtilitiesTests.cs +++ b/test/vstest.console.UnitTests/CommandLine/GenerateFakesUtilitiesTests.cs @@ -37,7 +37,7 @@ public void FakesShouldNotBeGeneratedIfDisableAutoFakesSetToTrue() CommandLineOptions.Instance.DisableAutoFakes = true; string runSettingsXml = @".netstandard,Version=5.0"; - runSettingsXml = GenerateFakesUtilities.GenerateFakesSettings(CommandLineOptions.Instance, System.Array.Empty(), runSettingsXml); + runSettingsXml = GenerateFakesUtilities.GenerateFakesSettings(CommandLineOptions.Instance, [], runSettingsXml); Assert.AreEqual(runSettingsXml, _runSettings); } diff --git a/test/vstest.console.UnitTests/ExecutorUnitTests.cs b/test/vstest.console.UnitTests/ExecutorUnitTests.cs index e8102f24da..313ec26a25 100644 --- a/test/vstest.console.UnitTests/ExecutorUnitTests.cs +++ b/test/vstest.console.UnitTests/ExecutorUnitTests.cs @@ -171,7 +171,7 @@ public void ExecuteShouldInstrumentVsTestConsoleStop() [TestMethod] public void ExecuteShouldExitWithErrorOnResponseFileException() { - string[] args = { "@FileDoesNotExist.rsp" }; + string[] args = ["@FileDoesNotExist.rsp"]; var mockOutput = new MockOutput(); var exitCode = new Executor(mockOutput, _mockTestPlatformEventSource.Object, new ProcessHelper(), new PlatformEnvironment()).Execute(args); @@ -226,7 +226,7 @@ public void ExecuteShouldNotThrowSettingsExceptionButLogOutput() File.WriteAllText(runSettingsFile, fileContents); var testSourceDllPath = Path.GetTempFileName(); - string[] args = { testSourceDllPath, "/settings:" + runSettingsFile }; + string[] args = [testSourceDllPath, "/settings:" + runSettingsFile]; var mockOutput = new MockOutput(); var exitCode = new Executor(mockOutput, _mockTestPlatformEventSource.Object, new ProcessHelper(), new PlatformEnvironment()).Execute(args); @@ -264,7 +264,7 @@ public void ExecuteShouldReturnNonZeroExitCodeIfSettingsException() File.WriteAllText(runSettingsFile, fileContents); - string[] args = { "/settings:" + runSettingsFile }; + string[] args = ["/settings:" + runSettingsFile]; var mockOutput = new MockOutput(); var exitCode = new Executor(mockOutput, _mockTestPlatformEventSource.Object, new ProcessHelper(), new PlatformEnvironment()).Execute(args); @@ -299,7 +299,7 @@ public void ExecutorShouldShowRightErrorMessage() File.WriteAllText(runSettingsFile, fileContents); - string[] args = { "/settings:" + runSettingsFile }; + string[] args = ["/settings:" + runSettingsFile]; var mockOutput = new MockOutput(); var exitCode = new Executor(mockOutput, _mockTestPlatformEventSource.Object, new ProcessHelper(), new PlatformEnvironment()).Execute(args); diff --git a/test/vstest.console.UnitTests/Processors/ArtifactProcessingPostProcessModeProcessorTest.cs b/test/vstest.console.UnitTests/Processors/ArtifactProcessingPostProcessModeProcessorTest.cs index 3556acb841..78fea1b91f 100644 --- a/test/vstest.console.UnitTests/Processors/ArtifactProcessingPostProcessModeProcessorTest.cs +++ b/test/vstest.console.UnitTests/Processors/ArtifactProcessingPostProcessModeProcessorTest.cs @@ -64,10 +64,10 @@ public void ProcessorExecutorInitialize_ExceptionShouldNotBubbleUp() public void ArtifactProcessingPostProcessMode_ContainsPostProcessCommand() { _featureFlagMock.Setup(x => x.IsSet(It.IsAny())).Returns(false); - Assert.IsTrue(ArtifactProcessingPostProcessModeProcessor.ContainsPostProcessCommand(new string[] { "--artifactsProcessingMode-postprocess" }, _featureFlagMock.Object)); - Assert.IsTrue(ArtifactProcessingPostProcessModeProcessor.ContainsPostProcessCommand(new string[] { "--ARTIfactsProcessingMode-postprocess" }, _featureFlagMock.Object)); - Assert.IsFalse(ArtifactProcessingPostProcessModeProcessor.ContainsPostProcessCommand(new string[] { "-ARTIfactsProcessingMode-postprocess" }, _featureFlagMock.Object)); - Assert.IsFalse(ArtifactProcessingPostProcessModeProcessor.ContainsPostProcessCommand(new string[] { "--ARTIfactsProcessingMode-postproces" }, _featureFlagMock.Object)); + Assert.IsTrue(ArtifactProcessingPostProcessModeProcessor.ContainsPostProcessCommand(["--artifactsProcessingMode-postprocess"], _featureFlagMock.Object)); + Assert.IsTrue(ArtifactProcessingPostProcessModeProcessor.ContainsPostProcessCommand(["--ARTIfactsProcessingMode-postprocess"], _featureFlagMock.Object)); + Assert.IsFalse(ArtifactProcessingPostProcessModeProcessor.ContainsPostProcessCommand(["-ARTIfactsProcessingMode-postprocess"], _featureFlagMock.Object)); + Assert.IsFalse(ArtifactProcessingPostProcessModeProcessor.ContainsPostProcessCommand(["--ARTIfactsProcessingMode-postproces"], _featureFlagMock.Object)); Assert.IsFalse(ArtifactProcessingPostProcessModeProcessor.ContainsPostProcessCommand(null, _featureFlagMock.Object)); } } diff --git a/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs index a27be02e89..3a40e52bfb 100644 --- a/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs @@ -114,7 +114,7 @@ public void InitializeShouldNotThrowExceptionIfArgumentIsNull() [TestMethod] public void InitializeShouldNotThrowExceptionIfArgumentIsEmpty() { - _executor.Initialize(Array.Empty()); + _executor.Initialize([]); Assert.IsNull(_settingsProvider.ActiveRunSettings); } @@ -122,7 +122,7 @@ public void InitializeShouldNotThrowExceptionIfArgumentIsEmpty() [TestMethod] public void InitializeShouldCreateEmptyRunSettingsIfArgumentsHasOnlyWhiteSpace() { - _executor.Initialize(new string[] { " " }); + _executor.Initialize([" "]); Assert.IsNull(_settingsProvider.ActiveRunSettings); } @@ -344,42 +344,43 @@ public static IEnumerable TestRunParameterArgInvalidTestCases() return InvalidTestCases; } - private static readonly List InvalidTestCases = new() - { - new object[] { "TestRunParameters.Parameter(name=asf,value=rgq)" }, - new object[] { "TestRunParameters.Parameter(name=\"asf\",value=\"rgq\" )" }, - new object[] { "TestRunParameters.Parameter( name=\"asf\",value=\"rgq\")" }, - new object[] { "TestRunParametersParameter(name=\"asf\",value=\"rgq\")" }, - new object[] { "TestRunParameters.Paramete(name=\"asf\",value=\"rgq\")" }, - new object[] { "TestRunParameters.Parametername=\"asf\",value=\"rgq\")" }, - new object[] { "TestRunParameters.Parameter(ame=\"asf\",value=\"rgq\")" }, - new object[] { "TestRunParameters.Parameter(name\"asf\",value=\"rgq\")" }, - new object[] { "TestRunParameters.Parameter(name=\"asf\" value=\"rgq\")" }, - new object[] { "TestRunParameters.Parameter(name=\"asf\",alue=\"rgq\")" }, - new object[] { "TestRunParameters.Parameter(name=\"asf\",value\"rgq\")" }, - new object[] { "TestRunParameters.Parameter(name=\"asf\",value=\"rgq\"" }, - new object[] { "TestRunParameters.Parameter(name=\"asf\",value=\"rgq\")wfds" }, - new object[] { "TestRunParameters.Parameter(name=\"\",value=\"rgq\")" }, - new object[] { "TestRunParameters.Parameter(name=\"asf\",value=\"\")" }, - new object[] { "TestRunParameters.Parameter(name=asf\",value=\"rgq\")" }, - new object[] { "TestRunParameters.Parameter(name=\"asf,value=\"rgq\")" }, - new object[] { "TestRunParameters.Parameter(name=\"asf\",value=rgq\")" }, - new object[] { "TestRunParameters.Parameter(name=\"asf\",value=\"rgq)" }, - new object[] { "TestRunParameters.Parameter(name=\"asf@#!\",value=\"rgq\")" }, - new object[] { "TestRunParameters.Parameter(name=\"\",value=\"fgf\")" }, - new object[] { "TestRunParameters.Parameter(name=\"gag\",value=\"\")" }, - new object[] { "TestRunParameters.Parameter(name=\"gag\")" } - }; + private static readonly List InvalidTestCases = + [ + ["TestRunParameters.Parameter(name=asf,value=rgq)"], + ["TestRunParameters.Parameter(name=\"asf\",value=\"rgq\" )"], + ["TestRunParameters.Parameter( name=\"asf\",value=\"rgq\")"], + ["TestRunParametersParameter(name=\"asf\",value=\"rgq\")"], + ["TestRunParameters.Paramete(name=\"asf\",value=\"rgq\")"], + ["TestRunParameters.Parametername=\"asf\",value=\"rgq\")"], + ["TestRunParameters.Parameter(ame=\"asf\",value=\"rgq\")"], + ["TestRunParameters.Parameter(name\"asf\",value=\"rgq\")"], + ["TestRunParameters.Parameter(name=\"asf\" value=\"rgq\")"], + ["TestRunParameters.Parameter(name=\"asf\",alue=\"rgq\")"], + ["TestRunParameters.Parameter(name=\"asf\",value\"rgq\")"], + ["TestRunParameters.Parameter(name=\"asf\",value=\"rgq\""], + ["TestRunParameters.Parameter(name=\"asf\",value=\"rgq\")wfds"], + ["TestRunParameters.Parameter(name=\"\",value=\"rgq\")"], + ["TestRunParameters.Parameter(name=\"asf\",value=\"\")"], + ["TestRunParameters.Parameter(name=asf\",value=\"rgq\")"], + ["TestRunParameters.Parameter(name=\"asf,value=\"rgq\")"], + ["TestRunParameters.Parameter(name=\"asf\",value=rgq\")"], + ["TestRunParameters.Parameter(name=\"asf\",value=\"rgq)"], + ["TestRunParameters.Parameter(name=\"asf@#!\",value=\"rgq\")"], + ["TestRunParameters.Parameter(name=\"\",value=\"fgf\")"], + ["TestRunParameters.Parameter(name=\"gag\",value=\"\")"], + ["TestRunParameters.Parameter(name=\"gag\")"] + ]; public static IEnumerable TestRunParameterArgValidTestCases() { return ValidTestCases; } - private static readonly List ValidTestCases = new() - { - new object[] { "TestRunParameters.Parameter(name=\"weburl\",value=\"&><\")" , - string.Join(Environment.NewLine, "", + private static readonly List ValidTestCases = + [ + [ + "TestRunParameters.Parameter(name=\"weburl\",value=\"&><\")", string.Join(Environment.NewLine, + "", "", " ", " ", @@ -388,9 +389,10 @@ public static IEnumerable TestRunParameterArgValidTestCases() " ", " ", "") - }, - new object[] { "TestRunParameters.Parameter(name=\"weburl\",value=\"http://localhost//abc\")" , - string.Join(Environment.NewLine, "", + ], + [ + "TestRunParameters.Parameter(name=\"weburl\",value=\"http://localhost//abc\")", string.Join( + Environment.NewLine, "", "", " ", " ", @@ -399,8 +401,9 @@ public static IEnumerable TestRunParameterArgValidTestCases() " ", " ", "") - }, - new object[] { "TestRunParameters.Parameter(name= \"a_sf123_12\",value= \"2324346a!@#$%^*()_+-=':;.,/?{}[]|\")" , + ], + [ + "TestRunParameters.Parameter(name= \"a_sf123_12\",value= \"2324346a!@#$%^*()_+-=':;.,/?{}[]|\")", string.Join(Environment.NewLine, "", "", " ", @@ -410,9 +413,10 @@ public static IEnumerable TestRunParameterArgValidTestCases() " ", " ", "") - }, - new object[] { "TestRunParameters.Parameter(name = \"weburl\" , value = \"http://localhost//abc\")" , - string.Join(Environment.NewLine, "", + ], + [ + "TestRunParameters.Parameter(name = \"weburl\" , value = \"http://localhost//abc\")", string.Join( + Environment.NewLine, "", "", " ", " ", @@ -421,8 +425,8 @@ public static IEnumerable TestRunParameterArgValidTestCases() " ", " ", "") - }, - }; + ] + ]; #endregion [TestMethod] @@ -459,7 +463,7 @@ public void InitializeShouldMergeTestRunParametersWithSpaces() "value=\"myValue 2\")", }; - var runsettings = string.Join(Environment.NewLine, new[]{ + var runsettings = string.Join(Environment.NewLine, [ "", "", " ", @@ -469,7 +473,8 @@ public void InitializeShouldMergeTestRunParametersWithSpaces() " ", " ", " ", - ""}); + "" + ]); _executor.Initialize(args); diff --git a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs index 418be5202e..eaffa017fc 100644 --- a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs @@ -191,11 +191,11 @@ public void ExecutorExecuteForValidSourceWithTestCaseFilterShouldRunTests() ResetAndAddSourceToCommandLineOptions(); - List list = new() - { + List list = + [ new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1"), new TestCase("Test2", new Uri("http://FooTestUri1"), "Source1") - }; + ]; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); @@ -275,11 +275,11 @@ public void ExecutorExecuteShouldThrowTestPlatformExceptionThrownDuringExecution var mockTestRunRequest = new Mock(); var mockDiscoveryRequest = new Mock(); - List list = new() - { + List list = + [ new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1"), new TestCase("Test2", new Uri("http://FooTestUri2"), "Source2") - }; + ]; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); mockTestRunRequest.Setup(dr => dr.ExecuteAsync()).Throws(new TestPlatformException("DummyTestPlatformException")); @@ -302,11 +302,11 @@ public void ExecutorExecuteShouldThrowSettingsExceptionThrownDuringExecution() var mockTestRunRequest = new Mock(); var mockDiscoveryRequest = new Mock(); - List list = new() - { + List list = + [ new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1"), new TestCase("Test2", new Uri("http://FooTestUri2"), "Source2") - }; + ]; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); mockTestRunRequest.Setup(dr => dr.ExecuteAsync()).Throws(new SettingsException("DummySettingsException")); @@ -329,11 +329,11 @@ public void ExecutorExecuteShouldThrowInvalidOperationExceptionThrownDuringExecu var mockTestRunRequest = new Mock(); var mockDiscoveryRequest = new Mock(); - List list = new() - { + List list = + [ new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1"), new TestCase("Test2", new Uri("http://FooTestUri2"), "Source2") - }; + ]; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); mockTestRunRequest.Setup(dr => dr.ExecuteAsync()).Throws(new InvalidOperationException("DummySettingsException")); @@ -359,7 +359,7 @@ public void ExecutorExecuteShouldForValidSourcesAndNoTestsDiscoveredShouldLogWar ResetAndAddSourceToCommandLineOptions(); // Setting some test adapter path - CommandLineOptions.Instance.TestAdapterPath = new[] { @"C:\Foo" }; + CommandLineOptions.Instance.TestAdapterPath = [@"C:\Foo"]; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(new List())); mockTestPlatform.Setup(tp => tp.CreateDiscoveryRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockDiscoveryRequest.Object); @@ -404,10 +404,7 @@ public void ExecutorExecuteShouldForValidSourcesAndValidSelectedTestsRunsTestsAn ResetAndAddSourceToCommandLineOptions(); - List list = new() - { - new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1") - }; + List list = [new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1")]; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); @@ -431,11 +428,11 @@ public void ExecutorShouldRunTestsWhenTestsAreCommaSeparated() ResetAndAddSourceToCommandLineOptions(); - List list = new() - { + List list = + [ new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1"), new TestCase("Test2", new Uri("http://FooTestUri1"), "Source1") - }; + ]; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); @@ -460,11 +457,11 @@ public void ExecutorShouldRunTestsWhenTestsAreFiltered() ResetAndAddSourceToCommandLineOptions(); - List list = new() - { + List list = + [ new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1"), new TestCase("Test2", new Uri("http://FooTestUri1"), "Source1") - }; + ]; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); @@ -489,10 +486,7 @@ public void ExecutorShouldWarnWhenTestsAreNotAvailable() ResetAndAddSourceToCommandLineOptions(); - List list = new() - { - new TestCase("Test2", new Uri("http://FooTestUri1"), "Source1") - }; + List list = [new TestCase("Test2", new Uri("http://FooTestUri1"), "Source1")]; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); @@ -517,11 +511,11 @@ public void ExecutorShouldRunTestsWhenTestsAreCommaSeparatedWithEscape() ResetAndAddSourceToCommandLineOptions(); - List list = new() - { + List list = + [ new TestCase("Test1(a,b)", new Uri("http://FooTestUri1"), "Source1"), new TestCase("Test2(c,d)", new Uri("http://FooTestUri1"), "Source1") - }; + ]; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); mockTestPlatform.Setup(tp => tp.CreateTestRunRequest(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny>(), It.IsAny())).Returns(mockTestRunRequest.Object); @@ -545,11 +539,11 @@ public void ExecutorShouldDisplayWarningIfNoTestsAreExecuted() var mockDiscoveryRequest = new Mock(); var mockTestRunStats = new Mock(); - List list = new() - { + List list = + [ new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1"), new TestCase("Test2", new Uri("http://FooTestUri2"), "Source2") - }; + ]; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); mockTestRunRequest.Setup(tr => tr.ExecuteAsync()).Returns(1).Raises(tr => tr.OnRunCompletion += null, @@ -576,11 +570,11 @@ public void ExecutorShouldNotDisplayWarningIfTestsAreExecuted() var mockDiscoveryRequest = new Mock(); var testRunStats = new TestRunStatistics(1, new Dictionary { { TestOutcome.Passed, 1 } }); - List list = new() - { + List list = + [ new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1"), new TestCase("Test2", new Uri("http://FooTestUri2"), "Source2") - }; + ]; mockDiscoveryRequest.Setup(dr => dr.DiscoverAsync()).Raises(dr => dr.OnDiscoveredTests += null, new DiscoveredTestsEventArgs(list)); mockTestRunRequest.Setup(tr => tr.ExecuteAsync()).Returns(1).Raises(tr => tr.OnRunCompletion += null, diff --git a/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs index 2ed759112b..0c31c47d9d 100644 --- a/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs @@ -252,11 +252,11 @@ private ArgumentProcessorResult RunRunArgumentProcessorExecuteWithMockSetup(ITes var mockTestPlatform = new Mock(); var mockConsoleOutput = new Mock(); - List list = new() - { + List list = + [ new TestCase("Test1", new Uri("http://FooTestUri1"), "Source1"), new TestCase("Test2", new Uri("http://FooTestUri2"), "Source2") - }; + ]; var mockTestRunStats = new Mock(); var args = new TestRunCompleteEventArgs(mockTestRunStats.Object, false, false, null, null, null, new TimeSpan()); diff --git a/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorFactoryTests.cs b/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorFactoryTests.cs index 4859fe631a..01f9acf5f0 100644 --- a/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorFactoryTests.cs +++ b/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorFactoryTests.cs @@ -84,7 +84,7 @@ public void CreateArgumentProcessorShouldReturnNullIfInvalidCommandIsPassed() ArgumentProcessorFactory factory = ArgumentProcessorFactory.Create(); - IArgumentProcessor result = factory.CreateArgumentProcessor(command, new string[] { "" })!; + IArgumentProcessor result = factory.CreateArgumentProcessor(command, [""])!; Assert.IsNull(result); } @@ -96,7 +96,7 @@ public void CreateArgumentProcessorShouldReturnCliRunSettingsArgumentProcessorIf ArgumentProcessorFactory factory = ArgumentProcessorFactory.Create(); - IArgumentProcessor result = factory.CreateArgumentProcessor(command, new string[] { "" })!; + IArgumentProcessor result = factory.CreateArgumentProcessor(command, [""])!; Assert.AreEqual(typeof(CliRunSettingsArgumentProcessor), result.GetType()); } diff --git a/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorUtilitiesTests.cs b/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorUtilitiesTests.cs index c7cb234b47..a597af523d 100644 --- a/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorUtilitiesTests.cs +++ b/test/vstest.console.UnitTests/Processors/Utilities/ArgumentProcessorUtilitiesTests.cs @@ -40,7 +40,7 @@ public void GetArgumentListShouldReturnCorrectArgumentList(string argument) } [TestMethod] - [DataRow(new string[] { "key1=value1", "invalidPair", "key2=value2" })] + [DataRow(["key1=value1", "invalidPair", "key2=value2"])] public void GetArgumentParametersShouldThrowErrorOnInvalidParameters(string[] parameterArgs) { try From 86d5eef3457df1d95910bfdb7fb4cc6ca0c0a87e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Wed, 10 Jul 2024 12:28:59 +0200 Subject: [PATCH 14/94] Cleanup and bump required runtimes (#5139) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Cleanup and bump required runtimes * Put netcoreapp2.1 back, we run old vstest.console (like 16.11) on that in compatibility tests --------- Co-authored-by: Jakub Jareš --- global.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/global.json b/global.json index 87cba1cd91..9e9971dc9b 100644 --- a/global.json +++ b/global.json @@ -11,17 +11,17 @@ "2.1.30", "3.1.32", "5.0.17", - "6.0.29", - "7.0.18", - "8.0.4" + "6.0.32", + "7.0.20", + "8.0.7" ], "dotnet/x86": [ "2.1.30", "3.1.32", "5.0.17", - "6.0.29", - "7.0.18", - "8.0.4" + "6.0.32", + "7.0.20", + "8.0.7" ] }, "vs": { From 73b9f0112ab3b593ff0210197d3426aee519b3ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 10 Jul 2024 20:02:09 +0200 Subject: [PATCH 15/94] Fix help warnings (#5140) --- Directory.Build.props | 13 +--------- .../DesignMode/IDesignModeClient.cs | 1 + .../Discovery/DiscoveryRequest.cs | 2 ++ .../RequestHelper/ITestRequestManager.cs | 2 +- .../TestPlatform.cs | 1 + .../DataCollection/DataCollectionManager.cs | 6 +++++ .../IDataCollectionAttachmentManager.cs | 2 +- .../DataCollectionExtensionManager.cs | 1 + .../TestDiscoveryExtensionManager.cs | 2 ++ .../ExtensionFramework/TestPluginCache.cs | 5 ++-- .../TestPluginDiscoverer.cs | 2 ++ .../Utilities/TestExtensions.cs | 4 ++-- .../Filtering/Condition.cs | 2 +- .../Filtering/FilterExpression.cs | 4 ++-- .../Engine/ClientProtocol/ITestEngine.cs | 8 +++++-- ...taCollectorAttachmentsProcessorsFactory.cs | 2 +- .../ITestRunAttachmentsProcessingManager.cs | 2 ++ .../TesthostProtocol/IDiscoveryManager.cs | 1 + .../TesthostProtocol/IExecutionManager.cs | 5 ++-- .../Interfaces/ITestDiscovererCapabilities.cs | 2 +- .../Utilities/FakesUtilities.cs | 1 + .../RunSettingsProviderExtensions.cs | 2 +- .../Utilities/RunSettingsUtilities.cs | 1 - .../DataCollectionTestCaseEventHandler.cs | 1 + .../IDataCollectionTestCaseEventSender.cs | 2 +- .../Interfaces/ITestRequestHandler.cs | 2 +- .../Helpers/CommandLineArgumentsHelper.cs | 1 + .../Helpers/Interfaces/IFileHelper.cs | 2 +- .../Client/InProcessProxyexecutionManager.cs | 2 +- .../Parallel/ParallelProxyDiscoveryManager.cs | 10 ++++++-- .../Parallel/ParallelProxyExecutionManager.cs | 1 - .../Client/ProxyDiscoveryManager.cs | 2 ++ .../Client/ProxyExecutionManager.cs | 2 ++ ...ProxyExecutionManagerWithDataCollection.cs | 1 + .../Client/ProxyOperationManager.cs | 4 ++++ ...ProxyOperationManagerWithDataCollection.cs | 1 + .../DataCollectionTestRunEventsHandler.cs | 4 +++- .../InProcDataCollectionExtensionManager.cs | 7 +----- .../DataCollection/InProcDataCollector.cs | 3 ++- .../ProxyOutOfProcDataCollectionManager.cs | 4 ++-- .../Discovery/DiscovererEnumerator.cs | 4 +++- .../Discovery/DiscoveryManager.cs | 1 + .../Execution/ExecutionManager.cs | 2 ++ .../Execution/RunTestsWithSources.cs | 1 - .../Execution/RunTestsWithTests.cs | 2 +- .../TestSession/ProxyTestSessionManager.cs | 1 + .../BlameCollector.cs | 1 + .../Interfaces/IProcessDumpUtility.cs | 1 + .../ObjectModel/TestResult.cs | 10 ++++++-- .../TrxLogger.cs | 2 +- .../Utility/Converter.cs | 2 +- .../Adapter/Interfaces/ITestExecutor.cs | 4 ++-- .../Client/Events/TestRunCompleteEventArgs.cs | 2 +- .../Client/FilterOptions.cs | 2 +- .../IInternalTestRunEventsHandler.cs | 2 +- .../Client/Interfaces/ITestPlatform.cs | 6 +++++ ...stRunAttachmentsProcessingEventsHandler.cs | 2 +- .../DataCollectionRunSettings.cs | 3 ++- .../DataCollector/DataCollectorSettings.cs | 2 +- .../DataCollector/Events/SessionEvents.cs | 1 + .../DefaultExecutorUriAttribute.cs | 2 +- .../DirectoryBasedTestDiscovererAttribute.cs | 2 +- .../InvokedDataCollector.cs | 1 + .../Nuget.Frameworks/NuGetFrameworkUtility.cs | 3 +++ .../RegistryFreeActivationContext.cs | 1 + .../Utilities/FilterHelper.cs | 2 +- .../Utilities/Sha1Helper.cs | 24 +++++++++---------- .../Utilities/XmlReaderUtilities.cs | 1 - .../Interfaces/System/IProcessHelper.cs | 4 ++-- ...readApartmentStateNotSupportedException.cs | 1 - .../Runtime/PlatformAssemblyResolver.cs | 1 - .../Hosting/DefaultTestHostManager.cs | 1 + .../InferRunSettingsHelper.cs | 2 +- .../ParallelRunSettingsUtilities.cs | 2 +- src/testhost.x86/AppDomainEngineInvoker.cs | 3 +-- .../EnableBlameArgumentProcessor.cs | 5 ---- .../EnableCodeCoverageArgumentProcessor.cs | 1 - .../Processors/EnableDiagArgumentProcessor.cs | 1 + ...istFullyQualifiedTestsArgumentProcessor.cs | 5 ++++ .../Processors/ListTestsArgumentProcessor.cs | 5 ++++ .../ResultsDirectoryArgumentProcessor.cs | 2 +- ...AdapterLoadingStrategyArgumentProcessor.cs | 4 +++- .../TestAdapterPathArgumentProcessor.cs | 4 +++- .../Utilities/ArgumentProcessorFactory.cs | 6 ++--- .../TestPlatformHelpers/TestRequestManager.cs | 2 -- .../Extension/NetCoreRunnerAttribute.cs | 2 +- .../Extension/RunnnerInfo.cs | 6 ----- .../PerfInstrumentation/PerfAnalyzer.cs | 2 +- .../TranslationLayer/TelemetryPerfTestBase.cs | 4 ---- .../RunsettingsTests.cs | 3 --- .../BlameCollectorTests.cs | 1 + .../IntegrationTestBase.cs | 16 +++++++++---- .../Fakes/FakeTestBatchBuilder.cs | 2 +- .../Fakes/FakeTestDllBuilder.cs | 1 - .../Fakes/FakeTestHostResponsesBuilder.cs | 1 - 95 files changed, 172 insertions(+), 122 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 1d8854a6ba..94e7a2ac6d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -45,18 +45,7 @@ preview true - - $(NoWarn);CA1416;RS0037;CS1570;CS1572;CS1573;CS1574;CS1591 + $(NoWarn);CA1416;RS0037 diff --git a/src/Microsoft.TestPlatform.Client/DesignMode/IDesignModeClient.cs b/src/Microsoft.TestPlatform.Client/DesignMode/IDesignModeClient.cs index 1a21066235..a8b8c023c6 100644 --- a/src/Microsoft.TestPlatform.Client/DesignMode/IDesignModeClient.cs +++ b/src/Microsoft.TestPlatform.Client/DesignMode/IDesignModeClient.cs @@ -20,6 +20,7 @@ public interface IDesignModeClient : IDisposable /// Setups client based on port /// /// port number to connect + /// test request manager void ConnectToClientAndProcessRequests(int port, ITestRequestManager testRequestManager); /// diff --git a/src/Microsoft.TestPlatform.Client/Discovery/DiscoveryRequest.cs b/src/Microsoft.TestPlatform.Client/Discovery/DiscoveryRequest.cs index 9a2e655868..530a5d82f3 100644 --- a/src/Microsoft.TestPlatform.Client/Discovery/DiscoveryRequest.cs +++ b/src/Microsoft.TestPlatform.Client/Discovery/DiscoveryRequest.cs @@ -33,6 +33,7 @@ public sealed class DiscoveryRequest : IDiscoveryRequest, ITestDiscoveryEventsHa /// The Request Data instance providing services and data for discovery /// Discovery criterion. /// Discovery manager instance. + /// Logger manager instance. internal DiscoveryRequest(IRequestData requestData, DiscoveryCriteria criteria, IProxyDiscoveryManager discoveryManager, ITestLoggerManager loggerManager) : this(requestData, criteria, discoveryManager, loggerManager, JsonDataSerializer.Instance) { @@ -44,6 +45,7 @@ internal DiscoveryRequest(IRequestData requestData, DiscoveryCriteria criteria, /// The Request Data instance providing services and data for discovery /// Discovery criterion. /// Discovery manager instance. + /// Logger manager instance. /// Data Serializer internal DiscoveryRequest( IRequestData requestData, diff --git a/src/Microsoft.TestPlatform.Client/RequestHelper/ITestRequestManager.cs b/src/Microsoft.TestPlatform.Client/RequestHelper/ITestRequestManager.cs index 291d69954f..758c63a6f0 100644 --- a/src/Microsoft.TestPlatform.Client/RequestHelper/ITestRequestManager.cs +++ b/src/Microsoft.TestPlatform.Client/RequestHelper/ITestRequestManager.cs @@ -92,7 +92,7 @@ void StartTestSession( /// Stops a test session. /// /// - /// The stop test session payload. + /// The stop test session payload. /// The events handler. /// Protocol related information. void StopTestSession( diff --git a/src/Microsoft.TestPlatform.Client/TestPlatform.cs b/src/Microsoft.TestPlatform.Client/TestPlatform.cs index 73b7a47627..56a1dea9c2 100644 --- a/src/Microsoft.TestPlatform.Client/TestPlatform.cs +++ b/src/Microsoft.TestPlatform.Client/TestPlatform.cs @@ -231,6 +231,7 @@ private void AddExtensionAssemblies(string? runSettings, TestAdapterLoadingStrat /// /// /// The list of sources. + /// Adapter loading strategy private void AddLoggerAssembliesFromSource(IEnumerable sources, TestAdapterLoadingStrategy strategy) { // Skip discovery unless we're using the default behavior, or NextToSource is specified. diff --git a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs index 055d3d0e39..5fdaf63c00 100644 --- a/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/DataCollectionManager.cs @@ -79,6 +79,8 @@ internal class DataCollectionManager : IDataCollectionManager /// /// The message Sink. /// + /// request data + /// telemetry reporter internal DataCollectionManager(IMessageSink messageSink, IRequestData requestData, ITelemetryReporter telemetryReporter) : this(new DataCollectionAttachmentManager(), messageSink, new DataCollectionTelemetryManager(requestData), telemetryReporter) { } @@ -92,6 +94,8 @@ internal class DataCollectionManager : IDataCollectionManager /// /// The message Sink. /// + /// telemetry manager + /// telemetry reporter /// /// The constructor is not public because the factory method should be used to get instances of this class. /// @@ -136,6 +140,8 @@ private DataCollectorExtensionManager DataCollectorExtensionManager /// /// The message sink. /// + /// request data + /// telemetry reporter /// /// The . /// diff --git a/src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IDataCollectionAttachmentManager.cs b/src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IDataCollectionAttachmentManager.cs index adda6c450e..bcc92420e9 100644 --- a/src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IDataCollectionAttachmentManager.cs +++ b/src/Microsoft.TestPlatform.Common/DataCollection/Interfaces/IDataCollectionAttachmentManager.cs @@ -36,7 +36,7 @@ internal interface IDataCollectionAttachmentManager /// The data collection context. /// /// - /// The . + /// The . /// List GetAttachments(DataCollectionContext dataCollectionContext); diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/DataCollectionExtensionManager.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/DataCollectionExtensionManager.cs index 2d3485ecc0..2fa6b1f1c5 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/DataCollectionExtensionManager.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/DataCollectionExtensionManager.cs @@ -111,6 +111,7 @@ public DataCollectorMetadata(string extension, string friendlyName) /// /// /// The friendly Name. + /// /// /// Indicates if the current data collector registers an attachment processor /// diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestDiscoveryExtensionManager.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestDiscoveryExtensionManager.cs index f64c566eea..885b279e55 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestDiscoveryExtensionManager.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestDiscoveryExtensionManager.cs @@ -141,6 +141,8 @@ internal class TestDiscovererMetadata : ITestDiscovererCapabilities /// /// The file Extensions. /// The default Executor Uri. + /// Type of the assembly. + /// True when the discoverer is based on directories. public TestDiscovererMetadata(IReadOnlyCollection? fileExtensions, string? defaultExecutorUri, AssemblyType assemblyType = default, bool isDirectoryBased = false) { if (fileExtensions != null && fileExtensions.Count > 0) diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginCache.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginCache.cs index 40ca9a1cf3..b7301292e3 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginCache.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginCache.cs @@ -82,6 +82,7 @@ internal set /// Gets a list of all extension paths filtered by input string. /// /// Pattern to filter extension paths. + /// True when default extensions should be skipped. public List GetExtensionPaths(string endsWithPattern, bool skipDefaultExtensions = false) { var extensions = GetFilteredExtensions(_filterableExtensionPaths, endsWithPattern); @@ -115,7 +116,7 @@ public List GetExtensionPaths(string endsWithPattern, bool skipDefaultEx /// Pattern used to select files using String.EndsWith /// /// - /// The . of test plugin info. + /// The . of test plugin info. /// public Dictionary? DiscoverTestExtensions( string endsWithPattern) @@ -306,7 +307,7 @@ internal IEnumerable DefaultExtensionPaths /// Type of extension. /// /// - /// The . + /// The . /// internal Dictionary GetTestExtensions( string extensionAssembly, diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginDiscoverer.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginDiscoverer.cs index 360d29bb92..5c0cdf8354 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginDiscoverer.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginDiscoverer.cs @@ -117,6 +117,7 @@ private static void GetTestExtensionsFromFiles( /// /// Assembly to check for test extension availability /// Test extensions collection to add to. + /// File path of the assembly. /// /// Type of Test Plugin Information. /// @@ -201,6 +202,7 @@ private static void GetTestExtensionsFromAssembly(Assem /// /// Test extensions collection to add to. /// + /// File path of the assembly. private static void GetTestExtensionFromType( Type type, Type extensionType, diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensions.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensions.cs index e1f6c01ebc..5e5055af02 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensions.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensions.cs @@ -176,7 +176,7 @@ internal static void AddExtensionTelemetry( /// The info about new extensions discovered /// /// - /// The of extensions discovered + /// The of extensions discovered /// internal Dictionary? AddExtension(Dictionary? newExtensions) where TPluginInfo : TestPluginInformation @@ -415,7 +415,7 @@ internal void InvalidateCache() /// /// /// - /// The . of extensions discovered in assembly + /// The . of extensions discovered in assembly /// internal static Dictionary GetExtensionsDiscoveredFromAssembly( Dictionary? extensionCollection, diff --git a/src/Microsoft.TestPlatform.Common/Filtering/Condition.cs b/src/Microsoft.TestPlatform.Common/Filtering/Condition.cs index c333120b49..6d112c3fd3 100644 --- a/src/Microsoft.TestPlatform.Common/Filtering/Condition.cs +++ b/src/Microsoft.TestPlatform.Common/Filtering/Condition.cs @@ -167,7 +167,7 @@ internal bool Evaluate(Func propertyValueProvider) } /// - /// Returns a condition object after parsing input string of format 'Operation' + /// Returns a condition object after parsing input string of format 'Operation' /// internal static Condition Parse(string? conditionString) { diff --git a/src/Microsoft.TestPlatform.Common/Filtering/FilterExpression.cs b/src/Microsoft.TestPlatform.Common/Filtering/FilterExpression.cs index a587d1a98d..249b1b5916 100644 --- a/src/Microsoft.TestPlatform.Common/Filtering/FilterExpression.cs +++ b/src/Microsoft.TestPlatform.Common/Filtering/FilterExpression.cs @@ -19,7 +19,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Common.Filtering; /// /// Represents an expression tree. /// Supports: -/// Logical Operators: &, | +/// Logical Operators: &, | /// Equality Operators: =, != /// Parenthesis (, ) for grouping. /// @@ -41,7 +41,7 @@ internal class FilterExpression private readonly FilterExpression? _right; /// - /// If logical expression is using logical And ('&') operator. + /// If logical expression is using logical And ('&') operator. /// private readonly bool _areJoinedByAnd; diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/ITestEngine.cs b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/ITestEngine.cs index eb40e4328c..d249244586 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/ITestEngine.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ClientProtocol/ITestEngine.cs @@ -20,8 +20,9 @@ public interface ITestEngine /// /// The request data for providing discovery services and data. /// - /// Test host manager for the current test discovery. /// The discovery criteria. + /// Details of every source. + /// Logger of warnings. /// /// An IProxyDiscoveryManager object that can do discovery. IProxyDiscoveryManager GetDiscoveryManager( @@ -38,7 +39,8 @@ IProxyDiscoveryManager GetDiscoveryManager( /// /// The request data for providing common execution services and data. /// - /// Test host manager for the current test run. + /// Details of every source. + /// Logger of warnings. /// Test run criteria of the current test run. /// /// An IProxyExecutionManager object that can do execution. @@ -59,6 +61,8 @@ IProxyExecutionManager GetExecutionManager( /// /// Test session criteria of the current test session. /// + /// Details of every source. + /// Logger of warnings. /// /// An IProxyTestSessionManager object that can manage test sessions. IProxyTestSessionManager? GetTestSessionManager( diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/IDataCollectorAttachmentsProcessorsFactory.cs b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/IDataCollectorAttachmentsProcessorsFactory.cs index 250e3460a5..ef1b3f1228 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/IDataCollectorAttachmentsProcessorsFactory.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/IDataCollectorAttachmentsProcessorsFactory.cs @@ -17,7 +17,7 @@ internal interface IDataCollectorAttachmentsProcessorsFactory /// /// Creates and return a list of available attachments processor /// - /// List of invoked data collectors + /// List of invoked data collectors /// Message logger /// List of attachments processors DataCollectorAttachmentProcessor[] Create(InvokedDataCollector[]? invokedDataCollectors, IMessageLogger logger); diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ITestRunAttachmentsProcessingManager.cs b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ITestRunAttachmentsProcessingManager.cs index b04cfc66e5..7bb7692c15 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ITestRunAttachmentsProcessingManager.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/ITestRunAttachmentsProcessingManager.cs @@ -19,6 +19,7 @@ internal interface ITestRunAttachmentsProcessingManager /// Processes attachments and provides results through handler /// /// RunSettings + /// Data in the request. /// Collection of attachments /// Collection of invoked data collectors /// EventHandler for handling test run attachments processing event @@ -29,6 +30,7 @@ internal interface ITestRunAttachmentsProcessingManager /// Processes attachments /// /// RunSettings + /// Data in the request. /// Collection of attachments /// Collection of invoked data collectors /// Cancellation token diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/TesthostProtocol/IDiscoveryManager.cs b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/TesthostProtocol/IDiscoveryManager.cs index c3c2ffdae2..73fc09bdac 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/TesthostProtocol/IDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/TesthostProtocol/IDiscoveryManager.cs @@ -16,6 +16,7 @@ public interface IDiscoveryManager /// Initializes the discovery manager. /// /// The path to additional extensions. + /// The discovery handler. void Initialize(IEnumerable pathToAdditionalExtensions, ITestDiscoveryEventsHandler2? eventHandler); /// diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/TesthostProtocol/IExecutionManager.cs b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/TesthostProtocol/IExecutionManager.cs index 15ca486b19..37f67bab5a 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/Engine/TesthostProtocol/IExecutionManager.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/Engine/TesthostProtocol/IExecutionManager.cs @@ -17,6 +17,7 @@ public interface IExecutionManager /// Initializes the execution manager. /// /// The path to additional extensions. + /// Handler of test messages. void Initialize(IEnumerable pathToAdditionalExtensions, ITestMessageEventHandler? testMessageEventsHandler); /// @@ -48,12 +49,12 @@ public interface IExecutionManager /// /// Cancel the test execution. /// - /// EventHandler for handling execution events from Engine. + /// EventHandler for handling execution events from Engine. void Cancel(IInternalTestRunEventsHandler testRunEventsHandler); /// /// Aborts the test execution. /// - /// EventHandler for handling execution events from Engine. + /// EventHandler for handling execution events from Engine. void Abort(IInternalTestRunEventsHandler testRunEventsHandler); } diff --git a/src/Microsoft.TestPlatform.Common/Interfaces/ITestDiscovererCapabilities.cs b/src/Microsoft.TestPlatform.Common/Interfaces/ITestDiscovererCapabilities.cs index 0d755333da..4a867e366f 100644 --- a/src/Microsoft.TestPlatform.Common/Interfaces/ITestDiscovererCapabilities.cs +++ b/src/Microsoft.TestPlatform.Common/Interfaces/ITestDiscovererCapabilities.cs @@ -29,7 +29,7 @@ public interface ITestDiscovererCapabilities AssemblyType AssemblyType { get; } /// - /// if the discoverer plugin is decorated with , + /// if the discoverer plugin is decorated with ObjectDirectoryBasedTestDiscovererAttribute/>, /// otherwise. /// bool IsDirectoryBased { get; } diff --git a/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs b/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs index feac1e682c..0193c4ebb4 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/FakesUtilities.cs @@ -90,6 +90,7 @@ public static string GenerateFakesSettingsForRunConfiguration(string[] sources, /// /// runsettings /// test sources + /// version of the framework /// true if runSettings was modified; false otherwise. private static bool TryAddFakesDataCollectorSettings( XmlDocument runSettings, diff --git a/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs b/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs index aa691c27d8..4e87b120cc 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsProviderExtensions.cs @@ -89,7 +89,7 @@ public static void UpdateRunSettingsNode(this IRunSettingsProvider runSettingsPr /// /// Matches with test run parameter node pattern and returns that match. /// - /// + /// /// /// public static Match GetTestRunParameterNodeMatch(this IRunSettingsProvider _, string node) diff --git a/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsUtilities.cs b/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsUtilities.cs index f9fb02e684..97376c5f05 100644 --- a/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsUtilities.cs +++ b/src/Microsoft.TestPlatform.Common/Utilities/RunSettingsUtilities.cs @@ -169,7 +169,6 @@ private static bool GetTreatNoTestsAsError(RunConfiguration? runConfiguration) /// Gets the test adapters path from the run configuration /// /// Test run settings - /// True to return null, if adapter paths is not set. /// Test adapters paths public static IEnumerable GetTestAdaptersPaths(string? runSettings) { diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionTestCaseEventHandler.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionTestCaseEventHandler.cs index e472ee3eba..483bf64db1 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionTestCaseEventHandler.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/DataCollectionTestCaseEventHandler.cs @@ -35,6 +35,7 @@ internal DataCollectionTestCaseEventHandler(IMessageSink messageSink) /// /// Initializes a new instance of the class. /// + /// Sink for messages /// Communication manager implementation. /// Data collection manager implementation. /// Serializer for serialization and deserialization of the messages. diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/IDataCollectionTestCaseEventSender.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/IDataCollectionTestCaseEventSender.cs index 6a0efce3ce..1e650f4c21 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/IDataCollectionTestCaseEventSender.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/IDataCollectionTestCaseEventSender.cs @@ -46,7 +46,7 @@ public interface IDataCollectionTestCaseEventSender /// The args containing info about TestResult event. /// /// - /// The Collection of TestCase attachments. + /// The Collection of TestCase attachments. /// Collection? SendTestCaseEnd(TestCaseEndEventArgs e); diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/ITestRequestHandler.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/ITestRequestHandler.cs index ff2b72de40..f7f5ec0994 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/ITestRequestHandler.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Interfaces/ITestRequestHandler.cs @@ -91,7 +91,7 @@ public interface ITestRequestHandler : IDisposable /// /// Attach debugger to an already running process. /// - /// Process ID of the process to which the debugger should be attached. + /// Process ID and tfm of the process to which the debugger should be attached. /// if the debugger was successfully attached to the requested process, otherwise. bool AttachDebuggerToProcess(AttachDebuggerInfo attachDebuggerInfo); } diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Helpers/CommandLineArgumentsHelper.cs b/src/Microsoft.TestPlatform.CoreUtilities/Helpers/CommandLineArgumentsHelper.cs index 6d59b3b1e9..c7d703b878 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Helpers/CommandLineArgumentsHelper.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Helpers/CommandLineArgumentsHelper.cs @@ -61,6 +61,7 @@ public static int GetIntArgFromDict(IDictionary argsDictionary, /// /// Dictionary of all arguments Ex: { "--port":"12312", "--parentprocessid":"2312" } /// The full name for required argument. Ex: "--port" + /// The output value. /// Value of the argument. /// Thrown if value of an argument is not an integer. public static bool TryGetIntArgFromDict(IDictionary argsDictionary, string fullname, out int value) diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Helpers/Interfaces/IFileHelper.cs b/src/Microsoft.TestPlatform.CoreUtilities/Helpers/Interfaces/IFileHelper.cs index 1d61a75296..fb26029518 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Helpers/Interfaces/IFileHelper.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Helpers/Interfaces/IFileHelper.cs @@ -132,6 +132,7 @@ public interface IFileHelper /// /// The directory path. /// + /// If we should delete recursively. void DeleteDirectory(string directoryPath, bool recursive); /// @@ -152,7 +153,6 @@ public interface IFileHelper /// /// Get temporary file path /// - /// public string GetTempPath(); /// diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyexecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyexecutionManager.cs index 4dd1772c99..9ac60d0d1f 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyexecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/InProcessProxyexecutionManager.cs @@ -28,7 +28,7 @@ internal class InProcessProxyExecutionManager : IProxyExecutionManager public bool IsInitialized { get; private set; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The test Host Manager. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs index 5cae5c4eea..417b619585 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs @@ -260,7 +260,9 @@ static DiscoveryCriteria NewDiscoveryCriteriaFromSourceAndSettings(IEnumerable - /// Proxy discovery manager instance. + /// Proxy discovery manager instance. + /// Discovery events handler. + /// Discovery criteria a parameters. private Task InitializeDiscoverTestsOnConcurrentManager(IProxyDiscoveryManager proxyDiscoveryManager, ITestDiscoveryEventsHandler2 eventHandler, DiscoveryCriteria discoveryCriteria) { // Kick off another discovery task for the next source @@ -279,7 +281,11 @@ private Task InitializeDiscoverTestsOnConcurrentManager(IProxyDiscoveryManager p /// Triggers the discovery for the next data object on the concurrent discoverer /// Each concurrent discoverer calls this method, once its completed working on previous data /// - /// Proxy discovery manager instance. + /// + /// + /// + /// + /// private void DiscoverTestsOnConcurrentManager( IProxyDiscoveryManager proxyDiscoveryManager, ITestDiscoveryEventsHandler2 eventHandler, diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs index 4329d4620f..c020d44d85 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs @@ -418,7 +418,6 @@ private Task PrepareTestRunOnConcurrentManager(IProxyExecutionManager proxyExecu /// Triggers the execution for the next data object on the concurrent executor /// Each concurrent executor calls this method, once its completed working on previous data /// - /// Proxy execution manager instance. /// True, if execution triggered private void StartTestRunOnConcurrentManager( IProxyExecutionManager proxyExecutionManager, diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs index caa2643b24..a20d68a7c2 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs @@ -95,6 +95,8 @@ public ProxyDiscoveryManager( /// /// The request sender. /// Test host manager instance. + /// Framework of the manager. + /// Aggregator of discovery data. /// The data serializer. /// The file helper. internal ProxyDiscoveryManager( diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs index 23cb164489..42442f0735 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs @@ -100,6 +100,7 @@ public ProxyExecutionManager( /// /// Test request sender instance. /// Test host manager for this proxy. + /// Framework of testhost public ProxyExecutionManager( IRequestData requestData, ITestRequestSender requestSender, @@ -126,6 +127,7 @@ public ProxyExecutionManager( /// The request data for common services and data for run. /// Request sender instance. /// Test host manager instance. + /// Framework of testhost /// Data serializer instance. /// File helper instance. internal ProxyExecutionManager( diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs index 31cfbc1c20..f6fcaa00b4 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManagerWithDataCollection.cs @@ -33,6 +33,7 @@ internal class ProxyExecutionManagerWithDataCollection : ProxyExecutionManager /// /// Test host manager for this operation. /// + /// Framework of the testhost. /// /// The proxy Data Collection Manager. /// diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs index 59a5f68a47..8c47267c76 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs @@ -1,3 +1,4 @@ + // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. @@ -58,6 +59,7 @@ public class ProxyOperationManager /// Request data instance. /// Request sender instance. /// Test host manager instance. + /// Testhost manager framework public ProxyOperationManager( IRequestData? requestData, ITestRequestSender requestSender, @@ -78,6 +80,7 @@ public ProxyOperationManager( /// Request data instance. /// Request sender instance. /// Test host manager instance. + /// Testhost manager framework /// The base proxy. public ProxyOperationManager( IRequestData? requestData, @@ -395,6 +398,7 @@ public virtual TestProcessStartInfo UpdateTestProcessStartInfo(TestProcessStartI /// /// /// Run settings string. + /// Message logger. /// /// The run settings after removing non-required nodes. public string? RemoveNodesFromRunsettingsIfRequired(string? runsettingsXml, Action logMessage) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManagerWithDataCollection.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManagerWithDataCollection.cs index 1eac8f3d94..3ff84390ed 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManagerWithDataCollection.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManagerWithDataCollection.cs @@ -29,6 +29,7 @@ public class ProxyOperationManagerWithDataCollection : ProxyOperationManager /// The request data. /// The request sender. /// The test host manager. + /// Framework of the testhost. /// The data collection proxy. public ProxyOperationManagerWithDataCollection( IRequestData requestData, diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionTestRunEventsHandler.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionTestRunEventsHandler.cs index 11440b5b15..cc522a6f6b 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionTestRunEventsHandler.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DataCollectionTestRunEventsHandler.cs @@ -41,6 +41,7 @@ internal class DataCollectionTestRunEventsHandler : IInternalTestRunEventsHandle /// /// The proxy Data Collection Manager. /// + /// Cancellation token public DataCollectionTestRunEventsHandler(IInternalTestRunEventsHandler baseTestRunEventsHandler, IProxyDataCollectionManager proxyDataCollectionManager, CancellationToken cancellationToken) : this(baseTestRunEventsHandler, proxyDataCollectionManager, JsonDataSerializer.Instance, cancellationToken) { @@ -58,6 +59,7 @@ public DataCollectionTestRunEventsHandler(IInternalTestRunEventsHandler baseTest /// /// The data Serializer. /// + /// Cancellation token. public DataCollectionTestRunEventsHandler(IInternalTestRunEventsHandler baseTestRunEventsHandler, IProxyDataCollectionManager proxyDataCollectionManager, IDataSerializer dataSerializer, CancellationToken cancellationToken) { _proxyDataCollectionManager = proxyDataCollectionManager; @@ -196,7 +198,7 @@ public bool AttachDebuggerToProcess(AttachDebuggerInfo attachDebuggerInfo) /// The run context attachments. /// /// - /// The . + /// The . /// [return: NotNullIfNotNull("originalAttachmentSets")] [return: NotNullIfNotNull("newAttachments")] diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollectionExtensionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollectionExtensionManager.cs index 89917eaa08..dcd5a59ca1 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollectionExtensionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollectionExtensionManager.cs @@ -50,6 +50,7 @@ internal class InProcDataCollectionExtensionManager /// /// The default code base to be used by in-proc data collector /// + /// The cache of test plugins. public InProcDataCollectionExtensionManager(string? runSettings, ITestEventsPublisher testEventsPublisher, string? defaultCodeBase, TestPluginCache testPluginCache) : this(runSettings, testEventsPublisher, defaultCodeBase, testPluginCache, new FileHelper()) { } @@ -90,12 +91,6 @@ protected InProcDataCollectionExtensionManager(string? runSettings, ITestEventsP /// /// Creates data collector instance based on datacollector settings provided. /// - /// - /// Settings to be used for creating DataCollector. - /// - /// - /// TypeInfo of datacollector. - /// /// /// The . /// diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs index 466b8d16b4..ee4dd85be0 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/InProcDataCollector.cs @@ -57,12 +57,13 @@ public InProcDataCollector( /// /// /// - /// + /// /// /// /// /// /// + /// internal InProcDataCollector(string codeBase, string assemblyQualifiedName, Type interfaceType, string? configXml, IAssemblyLoadContext assemblyLoadContext, TestPluginCache testPluginCache) { _configXml = configXml; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyOutOfProcDataCollectionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyOutOfProcDataCollectionManager.cs index 8ae2a30f3c..4596d38202 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyOutOfProcDataCollectionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/ProxyOutOfProcDataCollectionManager.cs @@ -32,8 +32,8 @@ internal class ProxyOutOfProcDataCollectionManager /// /// The data collection test case event sender. /// - /// - /// The data collection test case event manager. + /// + /// Test events publisher. /// public ProxyOutOfProcDataCollectionManager(IDataCollectionTestCaseEventSender dataCollectionTestCaseEventSender, ITestEventsPublisher testEventsPublisher) { diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs index 418d5a32d4..882e06fcbd 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscovererEnumerator.cs @@ -45,6 +45,7 @@ internal class DiscovererEnumerator /// /// The request data for providing discovery services and data. /// The discovery result cache. + /// Cancellation token. public DiscovererEnumerator(IRequestData requestData, DiscoveryResultCache discoveryResultCache, CancellationToken token) : this(requestData, discoveryResultCache, TestPlatformEventSource.Instance, token) { @@ -346,6 +347,7 @@ private static void SetAdapterLoggingSettings(IMessageLogger messageLogger, IRun /// The extension assembly. /// The sources. /// The logger instance. + /// Assembly properties /// The map between an extension type and a source. internal static Dictionary, IEnumerable>? GetDiscovererToSourcesMap( string extensionAssembly, @@ -448,7 +450,7 @@ private static void SetAdapterLoggingSettings(IMessageLogger messageLogger, IRun /// Get assembly type to sources map. /// /// Sources. - /// Assembly type. + /// Assembly properties. /// Sources with matching assembly type. private static IDictionary> GetAssemblyTypeToSoucesMap(IEnumerable sources, IAssemblyProperties assemblyProperties) { diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs index 7651367a15..d572894568 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Discovery/DiscoveryManager.cs @@ -71,6 +71,7 @@ protected DiscoveryManager(IRequestData requestData, ITestPlatformEventSource te /// Initializes the discovery manager. /// /// The path to additional extensions. + /// Handler of discovery events. public void Initialize(IEnumerable? pathToAdditionalExtensions, ITestDiscoveryEventsHandler2? eventHandler) { // Clear the request data metrics left over from a potential previous run. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs index a8a53fefa7..04c0065d76 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs @@ -49,6 +49,7 @@ public ExecutionManager(IRequestData requestData) /// Initializes a new instance of the class. /// /// Test platform event source. + /// Request data protected ExecutionManager(ITestPlatformEventSource testPlatformEventSource, IRequestData requestData) { _testPlatformEventSource = testPlatformEventSource; @@ -61,6 +62,7 @@ protected ExecutionManager(ITestPlatformEventSource testPlatformEventSource, IRe /// Initializes the execution manager. /// /// The path to additional extensions. + /// Handler of test messages public void Initialize(IEnumerable? pathToAdditionalExtensions, ITestMessageEventHandler? testMessageEventsHandler) { // Clear the request data metrics left over from a potential previous run. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithSources.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithSources.cs index 36c157c4c1..98fe1799f1 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithSources.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithSources.cs @@ -48,7 +48,6 @@ public RunTestsWithSources(IRequestData requestData, Dictionary /// /// - /// internal RunTestsWithSources(IRequestData requestData, Dictionary> adapterSourceMap, string? package, string? runSettings, TestExecutionContext testExecutionContext, ITestCaseEventsHandler? testCaseEventsHandler, IInternalTestRunEventsHandler testRunEventsHandler, Dictionary, IEnumerable>? executorUriVsSourceList) : base(requestData, package, runSettings, testExecutionContext, testCaseEventsHandler, testRunEventsHandler, TestPlatformEventSource.Instance) { diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithTests.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithTests.cs index 2049a17bcf..17cf101666 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithTests.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/RunTestsWithTests.cs @@ -34,7 +34,7 @@ public RunTestsWithTests(IRequestData requestData, IEnumerable testCas /// /// /// The user input test source(package) if it differ from actual test source otherwise null. - /// + /// /// /// /// diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs index 74e2e22db1..ccb312023b 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs @@ -76,6 +76,7 @@ private enum TestSessionState /// The test session criteria. /// The testhost count. /// The proxy creator. + /// Runtime providers. public ProxyTestSessionManager( StartTestSessionCriteria criteria, int maxTesthostCount, diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs index 3628a29c89..b3bcbf9d99 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameCollector.cs @@ -91,6 +91,7 @@ public BlameCollector() /// /// Filehelper instance. /// + /// Process helper instance. internal BlameCollector( IBlameReaderWriter blameReaderWriter, IProcessDumpUtility processDumpUtility, diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Interfaces/IProcessDumpUtility.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Interfaces/IProcessDumpUtility.cs index a5a559197d..121fc0ffee 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Interfaces/IProcessDumpUtility.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Interfaces/IProcessDumpUtility.cs @@ -36,6 +36,7 @@ public interface IProcessDumpUtility /// /// Collect the dump on process exit even if there is no exception /// + /// Action to log a warning. void StartTriggerBasedProcessDump(int processId, string testResultsDirectory, bool isFullDump, string targetFramework, bool collectAlways, Action logWarning); /// diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestResult.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestResult.cs index d2ca29bae7..07c66ea347 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestResult.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestResult.cs @@ -212,12 +212,18 @@ internal class TestResult : ITestResult, IXmlTestStore /// /// The run id. /// - /// - /// The test. + /// Execution id. + /// Parent execution id. + /// Result name. + /// + /// The test id. /// /// /// The outcome. /// + /// + /// + /// public TestResult( Guid runId, Guid testId, diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs index 2b37511660..7809c0acd1 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs @@ -591,7 +591,7 @@ private void CreateTestRun() /// /// /// - /// + /// /// Trx test element private ITestElement GetOrCreateTestElement(Guid executionId, Guid parentExecutionId, TestType testType, ITestElement? parentTestElement, ObjectModel.TestResult rockSteadyTestResult) { diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs index 3a8a7b69c1..5967dbb202 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs @@ -43,7 +43,7 @@ public Converter(IFileHelper fileHelper, TrxFileHelper trxFileHelper) /// /// /// - /// + /// /// /// /// Trx test element diff --git a/src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/ITestExecutor.cs b/src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/ITestExecutor.cs index 2b043cd81f..785a65ac16 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/ITestExecutor.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Adapter/Interfaces/ITestExecutor.cs @@ -19,7 +19,7 @@ public interface ITestExecutor /// /// Tests to be run. /// Context to use when executing the tests. - /// Handle to the framework to record results and to do framework operations. + /// Handle to the framework to record results and to do framework operations. void RunTests(IEnumerable? tests, IRunContext? runContext, IFrameworkHandle? frameworkHandle); /// @@ -27,7 +27,7 @@ public interface ITestExecutor /// /// Path to test container files to look for tests in. /// Context to use when executing the tests. - /// Handle to the framework to record results and to do framework operations. + /// Handle to the framework to record results and to do framework operations. void RunTests(IEnumerable? sources, IRunContext? runContext, IFrameworkHandle? frameworkHandle); /// diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/TestRunCompleteEventArgs.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/TestRunCompleteEventArgs.cs index 8ae21a7809..58a6b412b2 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Events/TestRunCompleteEventArgs.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Events/TestRunCompleteEventArgs.cs @@ -58,7 +58,7 @@ public TestRunCompleteEventArgs( /// Specifies whether the test run is aborted. /// Specifies the error encountered during the execution of the test run. /// Attachment sets associated with the run. - /// Invoked data collectors + /// Invoked data collectors /// Time elapsed in just running tests public TestRunCompleteEventArgs( ITestRunStatistics? stats, diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/FilterOptions.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/FilterOptions.cs index 86c40e5b77..7c087014c9 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/FilterOptions.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/FilterOptions.cs @@ -20,7 +20,7 @@ public class FilterOptions public string? FilterRegEx { get; set; } /// - /// Gets or sets the optional regular expression replacement string. When this property is set, + /// Gets or sets the optional regular expression replacement string. When this property is set, /// will be called upon property value instead of before matching. /// [DataMember] diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IInternalTestRunEventsHandler.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IInternalTestRunEventsHandler.cs index b35e59c2cc..58023601b0 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IInternalTestRunEventsHandler.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/IInternalTestRunEventsHandler.cs @@ -39,7 +39,7 @@ public interface IInternalTestRunEventsHandler : ITestMessageEventHandler /// /// Attach debugger to an already running process. /// - /// Process ID of the process to which the debugger should be attached. + /// Process ID of the process and tfm to which the debugger should be attached. /// if the debugger was successfully attached to the requested process, otherwise. bool AttachDebuggerToProcess(AttachDebuggerInfo attachDebuggerInfo); } diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs index edebdbce74..789a84d3f3 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestPlatform.cs @@ -38,6 +38,8 @@ void UpdateExtensions( /// Providing common services and data for discovery. /// Specifies the discovery parameters. /// Test platform options. + /// Details of each dll (source). + /// Logger to use for warnings. /// /// A DiscoveryRequest object. IDiscoveryRequest CreateDiscoveryRequest( @@ -54,6 +56,8 @@ IDiscoveryRequest CreateDiscoveryRequest( /// Providing common services and data for execution. /// Specifies the test run criteria. /// Test platform options. + /// Details of each dll (source). + /// Logger to use for warnings. /// /// A RunRequest object. ITestRunRequest CreateTestRunRequest( @@ -72,6 +76,8 @@ ITestRunRequest CreateTestRunRequest( /// /// Specifies the start test session criteria. /// Events handler for handling session events. + /// Details of each dll (source). + /// Logger to use for warnings. /// /// True if the operation succeeded, false otherwise. bool StartTestSession( diff --git a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestRunAttachmentsProcessingEventsHandler.cs b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestRunAttachmentsProcessingEventsHandler.cs index c586949c2d..be41a6689c 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestRunAttachmentsProcessingEventsHandler.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Client/Interfaces/ITestRunAttachmentsProcessingEventsHandler.cs @@ -14,7 +14,7 @@ public interface ITestRunAttachmentsProcessingEventsHandler : ITestMessageEventH /// Dispatch TestRunAttachmentsProcessingComplete event to listeners. /// /// AttachmentsProcessing Complete event args. - /// Last set of processed attachment sets. + /// Last set of processed attachment sets. void HandleTestRunAttachmentsProcessingComplete(TestRunAttachmentsProcessingCompleteEventArgs attachmentsProcessingCompleteEventArgs, IEnumerable? lastChunk); /// diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectionRunSettings.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectionRunSettings.cs index 42f179557a..ef4d693cac 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectionRunSettings.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectionRunSettings.cs @@ -183,8 +183,9 @@ public static DataCollectionRunSettings CreateDataCollectionRunSettings( /// /// The reader. /// + /// Name of the datacollector. /// - /// The . + /// The . /// /// /// diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectorSettings.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectorSettings.cs index dbc436744d..bedb92e5ba 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectorSettings.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/DataCollectorSettings.cs @@ -137,7 +137,7 @@ public XmlElement ToXml(string dataCollectorName) /// The reader. /// /// - /// The . + /// The . /// /// /// Settings exception diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Events/SessionEvents.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Events/SessionEvents.cs index bd5cd80fb5..773f3bd6b4 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Events/SessionEvents.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Events/SessionEvents.cs @@ -49,6 +49,7 @@ public SessionStartEventArgs(IDictionary properties) /// /// Context information for the session /// + /// Properties for the session. public SessionStartEventArgs(DataCollectionContext context, IDictionary properties) : base(context) { diff --git a/src/Microsoft.TestPlatform.ObjectModel/DefaultExecutorUriAttribute.cs b/src/Microsoft.TestPlatform.ObjectModel/DefaultExecutorUriAttribute.cs index 754881f19a..2e7fd6c0cc 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DefaultExecutorUriAttribute.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DefaultExecutorUriAttribute.cs @@ -14,7 +14,7 @@ public sealed class DefaultExecutorUriAttribute : Attribute /// /// Initializes with the Uri of the executor. /// - /// The Uri of the executor + /// The Uri of the executor public DefaultExecutorUriAttribute(string executorUri) { ValidateArg.NotNullOrWhiteSpace(executorUri, nameof(executorUri)); diff --git a/src/Microsoft.TestPlatform.ObjectModel/DirectoryBasedTestDiscovererAttribute.cs b/src/Microsoft.TestPlatform.ObjectModel/DirectoryBasedTestDiscovererAttribute.cs index 8ebfc8c0be..0114d5afe7 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DirectoryBasedTestDiscovererAttribute.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DirectoryBasedTestDiscovererAttribute.cs @@ -6,7 +6,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel; /// -/// This attribute is applied to s. It indicates the test discoverer discovers tests +/// This attribute is applied to s. It indicates the test discoverer discovers tests /// present inside a directory (as opposed to the which indicates that the /// discoverer discovers tests present in files with a specified extension). /// diff --git a/src/Microsoft.TestPlatform.ObjectModel/InvokedDataCollector.cs b/src/Microsoft.TestPlatform.ObjectModel/InvokedDataCollector.cs index 89d8ef2b61..9422e8e491 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/InvokedDataCollector.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/InvokedDataCollector.cs @@ -12,6 +12,7 @@ public sealed class InvokedDataCollector : IEquatable /// Initialize an InvokedDataCollector /// /// Data collector Uri + /// Friendly name of the datacollector. /// Data collector assembly qualified name /// Data collector file path /// True if data collector registers an attachment processor diff --git a/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/NuGetFrameworkUtility.cs b/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/NuGetFrameworkUtility.cs index b5367a43b5..b01fe1ab34 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/NuGetFrameworkUtility.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Nuget.Frameworks/NuGetFrameworkUtility.cs @@ -27,6 +27,7 @@ internal static class NuGetFrameworkUtility /// project target framework /// retrieves the framework from the group /// framework mappings + /// compatibility provider public static T? GetNearest(IEnumerable items, NuGetFramework framework, IFrameworkNameProvider frameworkMappings, @@ -66,6 +67,8 @@ internal static class NuGetFrameworkUtility /// /// framework specific groups or items /// project target framework + /// framework mappings + /// compatibility provider public static T? GetNearest(IEnumerable items, NuGetFramework framework, IFrameworkNameProvider frameworkMappings, diff --git a/src/Microsoft.TestPlatform.ObjectModel/RegistryFreeActivationContext.cs b/src/Microsoft.TestPlatform.ObjectModel/RegistryFreeActivationContext.cs index 6ab0cd3b74..2558cb3d39 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/RegistryFreeActivationContext.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/RegistryFreeActivationContext.cs @@ -113,6 +113,7 @@ private void DeactivateContext() } } +/// /// ActivationContextNativeMethods class needed for registry-free context /// internal static class ActivationContextNativeMethods diff --git a/src/Microsoft.TestPlatform.ObjectModel/Utilities/FilterHelper.cs b/src/Microsoft.TestPlatform.ObjectModel/Utilities/FilterHelper.cs index eda82c44ca..f2f6239863 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Utilities/FilterHelper.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Utilities/FilterHelper.cs @@ -15,7 +15,7 @@ public static class FilterHelper private static readonly HashSet SpecialCharactersSet = new(SpecialCharacters); /// - /// Escapes a set of special characters for filter (%, (, ), &, |, =, !, ~) by replacing them with their escape sequences. + /// Escapes a set of special characters for filter (%, (, ), &, |, =, !, ~) by replacing them with their escape sequences. /// /// The input string that contains the text to convert. /// A string of characters with special characters converted to their escaped form. diff --git a/src/Microsoft.TestPlatform.ObjectModel/Utilities/Sha1Helper.cs b/src/Microsoft.TestPlatform.ObjectModel/Utilities/Sha1Helper.cs index f424fbba41..7b2a249fa3 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Utilities/Sha1Helper.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Utilities/Sha1Helper.cs @@ -44,17 +44,17 @@ internal class Sha1Implementation /// /// A sequence of logical functions to be used in SHA-1. - /// Each f(t), 0 <= t <= 79, operates on three 32-bit words B, C, D and produces a 32-bit word as output. + /// Each f(t), 0 <= t <= 79, operates on three 32-bit words B, C, D and produces a 32-bit word as output. /// - /// Function index. 0 <= t <= 79 + /// Function index. 0 <= t <= 79 /// Word B /// Word C /// Word D /// - /// f(t;B,C,D) = (B AND C) OR ((NOT B) AND D) ( 0 <= t <= 19) - /// f(t;B,C,D) = B XOR C XOR D (20 <= t <= 39) - /// f(t;B,C,D) = (B AND C) OR (B AND D) OR (C AND D) (40 <= t <= 59) - /// f(t;B,C,D) = B XOR C XOR D (60 <= t <= 79) + /// f(t;B,C,D) = (B AND C) OR ((NOT B) AND D) ( 0 <= t <= 19) + /// f(t;B,C,D) = B XOR C XOR D (20 <= t <= 39) + /// f(t;B,C,D) = (B AND C) OR (B AND D) OR (C AND D) (40 <= t <= 59) + /// f(t;B,C,D) = B XOR C XOR D (60 <= t <= 79) /// private static uint F(int t, uint b, uint c, uint d) { @@ -73,10 +73,10 @@ private static uint F(int t, uint b, uint c, uint d) /// /// Word index. /// - /// K(t) = 0x5A827999 ( 0 <= t <= 19) - /// K(t) = 0x6ED9EBA1 (20 <= t <= 39) - /// K(t) = 0x8F1BBCDC (40 <= t <= 59) - /// K(t) = 0xCA62C1D6 (60 <= t <= 79) + /// K(t) = 0x5A827999 ( 0 <= t <= 19) + /// K(t) = 0x6ED9EBA1 (20 <= t <= 39) + /// K(t) = 0x8F1BBCDC (40 <= t <= 59) + /// K(t) = 0xCA62C1D6 (60 <= t <= 79) /// private static uint K(int t) { @@ -95,8 +95,8 @@ private static uint K(int t) /// The circular left shift operation. /// /// An uint word. - /// 0 <= n < 32 - /// S^n(X) = (X << n) OR (X >> 32-n) + /// 0 <= n < 32 + /// S^n(X) = (X << n) OR (X >> 32-n) private static uint S(uint x, byte n) { return n > 32 ? throw new ArgumentOutOfRangeException(nameof(n)) : (x << n) | (x >> (32 - n)); diff --git a/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlReaderUtilities.cs b/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlReaderUtilities.cs index 833143fe88..02e723b398 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlReaderUtilities.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlReaderUtilities.cs @@ -42,7 +42,6 @@ public static void SkipToNextElement(this XmlReader reader) /// /// Reads to the root node of the run settings and verifies that it is a "RunSettings" node. /// - /// Path to the file. /// XmlReader for the file. public static void ReadToRootNode(XmlReader reader) { diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IProcessHelper.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IProcessHelper.cs index 6d468d0dd2..0824fd314c 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IProcessHelper.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/IProcessHelper.cs @@ -17,10 +17,10 @@ public interface IProcessHelper /// The full file name of the process. /// The command-line arguments. /// The working directory for this process. - /// Environment variables to set while bootstrapping the process. + /// Environment variables to set while bootstrapping the process. /// Call back for to read error stream data /// Call back for on process exit - /// Call back for on process output + /// Call back for on process output /// The process created. object LaunchProcess(string processPath, string? arguments, string? workingDirectory, IDictionary? envVariables, Action? errorCallback, Action? exitCallBack, Action? outputCallBack); diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/ThreadApartmentStateNotSupportedException.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/ThreadApartmentStateNotSupportedException.cs index eee94a5adf..5fca45c871 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/ThreadApartmentStateNotSupportedException.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Interfaces/System/ThreadApartmentStateNotSupportedException.cs @@ -14,7 +14,6 @@ public class ThreadApartmentStateNotSupportedException : Exception /// Initializes a new instance of the class. /// Initializes with the message. /// - /// Message for the exception. public ThreadApartmentStateNotSupportedException() { } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyResolver.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyResolver.cs index ff39358c97..914e93f998 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyResolver.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/Runtime/PlatformAssemblyResolver.cs @@ -22,7 +22,6 @@ public class PlatformAssemblyResolver : IAssemblyResolver /// /// Initializes a new instance of the class. /// - /// The search directories. public PlatformAssemblyResolver() { AssemblyLoadContext.Default.Resolving += AssemblyResolverEvent; diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs index 9d5fd5e4ef..21b343dad7 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs @@ -89,6 +89,7 @@ public DefaultTestHostManager() /// Process helper instance. /// File helper instance. /// Instance of platform environment. + /// The environment helper. /// Instance of dotnet host helper. internal DefaultTestHostManager( IProcessHelper processHelper, diff --git a/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs b/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs index 8d28e6c5dc..86a694fa1a 100644 --- a/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs +++ b/src/Microsoft.TestPlatform.Utilities/InferRunSettingsHelper.cs @@ -402,7 +402,7 @@ public static bool TryGetLegacySettingElements(string runsettingsXml, out Dictio /// /// Returns a dictionary of environment variables given in run settings /// - /// The run settings xml string + /// The run settings xml string /// Environment Variables Dictionary public static Dictionary? GetEnvironmentVariables(string? runSettings) { diff --git a/src/Microsoft.TestPlatform.Utilities/ParallelRunSettingsUtilities.cs b/src/Microsoft.TestPlatform.Utilities/ParallelRunSettingsUtilities.cs index 6e1a602818..1eca08118f 100644 --- a/src/Microsoft.TestPlatform.Utilities/ParallelRunSettingsUtilities.cs +++ b/src/Microsoft.TestPlatform.Utilities/ParallelRunSettingsUtilities.cs @@ -29,7 +29,7 @@ public static class ParallelRunSettingsUtilities /// /// This will update the RunSetting with MaxCpuCount 0 if RunSetting doesn't configured with this setting. /// - /// RunSetting file. + /// XPATH navigator. public static void UpdateRunSettingsWithParallelSettingIfNotConfigured(XPathNavigator navigator) { var node = navigator.SelectSingleNode(XpathOfMaxCpuCount); diff --git a/src/testhost.x86/AppDomainEngineInvoker.cs b/src/testhost.x86/AppDomainEngineInvoker.cs index 344790949b..f26ac8557b 100644 --- a/src/testhost.x86/AppDomainEngineInvoker.cs +++ b/src/testhost.x86/AppDomainEngineInvoker.cs @@ -93,8 +93,7 @@ private AppDomain CreateNewAppDomain(string testSourcePath) /// /// Create the Engine Invoker in new AppDomain based on test source path /// - /// Test Source to run/discover tests for - /// Merged config file if there is any merging of test config and test host config + /// The appdomain in which the invoker should be created. /// private static IEngineInvoker CreateInvokerInAppDomain(AppDomain appDomain) { diff --git a/src/vstest.console/Processors/EnableBlameArgumentProcessor.cs b/src/vstest.console/Processors/EnableBlameArgumentProcessor.cs index 139eb92e86..6afdcd808e 100644 --- a/src/vstest.console/Processors/EnableBlameArgumentProcessor.cs +++ b/src/vstest.console/Processors/EnableBlameArgumentProcessor.cs @@ -176,8 +176,6 @@ public void Initialize(string? argument) /// /// Initialize blame. /// - /// Enable dump. - /// Blame parameters. private void InitializeBlame(bool enableCrashDump, bool enableHangDump, bool monitorPostMortemDebugger, Dictionary? collectDumpParameters) { // Add Blame Logger @@ -333,9 +331,6 @@ private static void AddMonitorPostMortemDebuggerNode(Dictionary /// /// Adds node in outer node. /// - /// Parameters. - /// Xml document. - /// Outer node. private static void AddNode(Dictionary? parameters, XmlDocument xmlDocument, XmlElement outernode, string nodeName) { var dumpNode = xmlDocument.CreateElement(nodeName); diff --git a/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs b/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs index 21b04d3976..db2ce05372 100644 --- a/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs +++ b/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs @@ -192,7 +192,6 @@ public ArgumentProcessorResult Execute() /// /// Updates with code coverage settings if not configured. /// - /// The run settings document. private void UpdateWithCodeCoverageSettingsIfNotConfigured() { var runsettingsXml = _runSettingsManager.ActiveRunSettings?.SettingsXml; diff --git a/src/vstest.console/Processors/EnableDiagArgumentProcessor.cs b/src/vstest.console/Processors/EnableDiagArgumentProcessor.cs index c5cee215fe..d3bc5e6a6b 100644 --- a/src/vstest.console/Processors/EnableDiagArgumentProcessor.cs +++ b/src/vstest.console/Processors/EnableDiagArgumentProcessor.cs @@ -101,6 +101,7 @@ internal class EnableDiagArgumentExecutor : IArgumentExecutor /// Default constructor. /// /// The file helper. + /// Process helper public EnableDiagArgumentExecutor(IFileHelper fileHelper, IProcessHelper processHelper) { _fileHelper = fileHelper; diff --git a/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs b/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs index f6580388e6..8bd9581d09 100644 --- a/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs @@ -107,6 +107,8 @@ internal class ListFullyQualifiedTestsArgumentExecutor : IArgumentExecutor /// /// The options. /// + /// Runsettings provider. + /// Test request manager. public ListFullyQualifiedTestsArgumentExecutor( CommandLineOptions options, IRunSettingsProvider runSettingsProvider, @@ -121,6 +123,9 @@ public ListFullyQualifiedTestsArgumentExecutor( /// /// The options. /// + /// Runsettings provider. + /// Test request manager. + /// Output such as console. internal ListFullyQualifiedTestsArgumentExecutor( CommandLineOptions options, IRunSettingsProvider runSettingsProvider, diff --git a/src/vstest.console/Processors/ListTestsArgumentProcessor.cs b/src/vstest.console/Processors/ListTestsArgumentProcessor.cs index a8e3a84d7c..18dcba4914 100644 --- a/src/vstest.console/Processors/ListTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/ListTestsArgumentProcessor.cs @@ -111,6 +111,8 @@ internal class ListTestsArgumentExecutor : IArgumentExecutor /// /// The options. /// + /// Runsettings provider. + /// Test request manager. public ListTestsArgumentExecutor( CommandLineOptions options, IRunSettingsProvider runSettingsProvider, @@ -125,6 +127,9 @@ public ListTestsArgumentExecutor( /// /// The options. /// + /// Run setting provider. + /// Output such as console. + /// Test request manager internal ListTestsArgumentExecutor( CommandLineOptions options, IRunSettingsProvider runSettingsProvider, diff --git a/src/vstest.console/Processors/ResultsDirectoryArgumentProcessor.cs b/src/vstest.console/Processors/ResultsDirectoryArgumentProcessor.cs index 3855941ce0..b7e03835fd 100644 --- a/src/vstest.console/Processors/ResultsDirectoryArgumentProcessor.cs +++ b/src/vstest.console/Processors/ResultsDirectoryArgumentProcessor.cs @@ -83,7 +83,7 @@ internal class ResultsDirectoryArgumentExecutor : IArgumentExecutor /// Default constructor. /// /// The options. - /// The test platform + /// Runsettings manager. public ResultsDirectoryArgumentExecutor(CommandLineOptions options, IRunSettingsProvider runSettingsManager) { ValidateArg.NotNull(options, nameof(options)); diff --git a/src/vstest.console/Processors/TestAdapterLoadingStrategyArgumentProcessor.cs b/src/vstest.console/Processors/TestAdapterLoadingStrategyArgumentProcessor.cs index 5fcb2d2b99..91ee48d550 100644 --- a/src/vstest.console/Processors/TestAdapterLoadingStrategyArgumentProcessor.cs +++ b/src/vstest.console/Processors/TestAdapterLoadingStrategyArgumentProcessor.cs @@ -100,7 +100,9 @@ internal class TestAdapterLoadingStrategyArgumentExecutor : IArgumentExecutor /// Default constructor. /// /// The options. - /// The test platform + /// Run setting manager. + /// Output such as console. + /// File helper public TestAdapterLoadingStrategyArgumentExecutor(CommandLineOptions options, IRunSettingsProvider runSettingsManager, IOutput output, IFileHelper fileHelper) { _commandLineOptions = options ?? throw new ArgumentNullException(nameof(options)); diff --git a/src/vstest.console/Processors/TestAdapterPathArgumentProcessor.cs b/src/vstest.console/Processors/TestAdapterPathArgumentProcessor.cs index 701d1b37ce..8ae3214634 100644 --- a/src/vstest.console/Processors/TestAdapterPathArgumentProcessor.cs +++ b/src/vstest.console/Processors/TestAdapterPathArgumentProcessor.cs @@ -104,7 +104,9 @@ internal class TestAdapterPathArgumentExecutor : IArgumentExecutor /// Default constructor. /// /// The options. - /// The test platform + /// Run setting manager. + /// Output such as console. + /// File helper public TestAdapterPathArgumentExecutor(CommandLineOptions options, IRunSettingsProvider runSettingsManager, IOutput output, IFileHelper fileHelper) { _commandLineOptions = options ?? throw new ArgumentNullException(nameof(options)); diff --git a/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs b/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs index 321df61125..81f6123af8 100644 --- a/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs +++ b/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs @@ -23,14 +23,12 @@ internal class ArgumentProcessorFactory private Dictionary? _commandToProcessorMap; private Dictionary? _specialCommandToProcessorMap; + /// /// Initializes the argument processor factory. /// /// /// The argument Processors. /// - /// - /// The feature flag support. - /// /// /// This is not public because the static Create method should be used to access the instance. /// @@ -298,7 +296,7 @@ public static IArgumentProcessor WrapLazyProcessorToInitializeOnInstantiation(IA /// Decorates a lazy argument processor so that the real processor is initialized when the lazy value is obtained. /// /// The lazy processor. - /// The argument with which the real processor should be initialized. + /// The argument with which the real processor should be initialized. /// The decorated lazy processor. private static IArgumentProcessor WrapLazyProcessorToInitializeOnInstantiation( IArgumentProcessor processor, diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index 4a8134cd03..d95891c425 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -1278,7 +1278,6 @@ private void RunTests( /// This method either looks at runsettings directly when running as a server (DesignMode / IDE / via VSTestConsoleWrapper, or how you wanna call it) /// or uses the pre-parsed runsettings when in console mode. /// - /// /// private bool IsFrameworkSetByRunSettings( XPathNavigator navigator, @@ -1314,7 +1313,6 @@ private bool IsFrameworkSetByRunSettings( /// This method either looks at runsettings directly when running as a server (DesignMode / IDE / via VSTestConsoleWrapper, or how you wanna call it) /// or uses the pre-parsed runsettings when in console mode. /// - /// /// private bool IsPlatformSetByRunSettings( XPathNavigator navigator, out Architecture chosenPlatform) diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreRunnerAttribute.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreRunnerAttribute.cs index 7af2fedb77..a1362f1c56 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreRunnerAttribute.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/NetCoreRunnerAttribute.cs @@ -25,7 +25,7 @@ public class NetCoreRunnerAttribute : Attribute, ITestDataSource private readonly string _targetFrameworks; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// To run tests with desktop runner(vstest.console.exe), use AcceptanceTestBase.Net462TargetFramework or alike values. public NetCoreRunnerAttribute(string targetFrameworks = AcceptanceTestBase.NETFX462_NET50) diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/RunnnerInfo.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/RunnnerInfo.cs index b052591c78..c25929c04b 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/RunnnerInfo.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Extension/RunnnerInfo.cs @@ -9,12 +9,6 @@ namespace Microsoft.TestPlatform.AcceptanceTests; -/// -/// -/// -/// -/// -/// Supported value = /InIsolation. [Serializable] // Type should be serializable to allow the tree-view behavior of test discovery in Test Explorer public class RunnerInfo { diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/PerfInstrumentation/PerfAnalyzer.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/PerfInstrumentation/PerfAnalyzer.cs index ff51365afb..3e89d97d85 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/PerfInstrumentation/PerfAnalyzer.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/PerfInstrumentation/PerfAnalyzer.cs @@ -148,7 +148,7 @@ public double GetElapsedTimeByTaskName(string taskName) /// The task name. /// /// - /// The . + /// The . /// public IDictionary GetEventDataByTaskName(string taskName) { diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs index d1a72e3716..cb4a59b220 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/Performance/TranslationLayer/TelemetryPerfTestBase.cs @@ -34,8 +34,6 @@ public TelemetryPerfTestBase() /// /// Used for posting the telemetry to AppInsights /// - /// - /// public void PostTelemetry(IDictionary handlerMetrics, PerfAnalyzer perfAnalyzer, string projectName, [CallerMemberName] string? scenario = null) { var properties = new Dictionary @@ -114,8 +112,6 @@ private static string GetAdapterName(string projectName) /// /// Returns the full path to the test asset dll /// - /// Name of the directory of the test dll - /// Name of the test project without extension /// public string[] GetPerfAssetFullPath(string name, string framework = "net48") { diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/RunsettingsTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/RunsettingsTests.cs index 9675f8766c..3546759ab5 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/RunsettingsTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/RunsettingsTests.cs @@ -94,9 +94,6 @@ public void CLIRunsettingsShouldWinBetweenCLISwitchesAndCLIRunsettings(RunnerInf /// /// Command line switches should have high precedence if runsetting file and command line switch specified /// - /// - /// - /// [TestMethod] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] diff --git a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/BlameCollectorTests.cs b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/BlameCollectorTests.cs index e1f1970f0c..e2d3e41e48 100644 --- a/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/BlameCollectorTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests/BlameCollectorTests.cs @@ -761,6 +761,7 @@ internal class TestableBlameCollector : BlameCollector /// /// MockFileHelper instance. /// + /// Mockd process helper internal TestableBlameCollector(IBlameReaderWriter blameReaderWriter, IProcessDumpUtility processDumpUtility, IInactivityTimer? inactivityTimer, IFileHelper mockFileHelper, IProcessHelper mockProcessHelper) : base(blameReaderWriter, processDumpUtility, inactivityTimer, mockFileHelper, mockProcessHelper) diff --git a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs index 123a0167a7..cdbe0a44d1 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs @@ -100,8 +100,9 @@ public void TempDirectoryCleanup() /// List of test assemblies. /// Path to test adapter. /// Text of run settings. - /// - /// + /// Framework to use. + /// If we should run in a separate process. + /// The directory where results are stored. /// Command line arguments string. public static string PrepareArguments(string[] testAssemblies, string? testAdapterPath, string? runSettings, string framework, string? inIsolation = "", string? resultsDirectory = null) @@ -169,8 +170,9 @@ public static string PrepareArguments(string[] testAssemblies, string? testAdapt /// Name of the test assembly. /// Path to test adapter. /// Text of run settings. - /// - /// + /// The framework to use. + /// If we should run in separate process. + /// The directory in which results will be stored. /// Command line arguments string. public static string PrepareArguments(string testAssembly, string? testAdapterPath, string? runSettings, string framework, string? inIsolation = "", string? resultsDirectory = null) @@ -181,6 +183,7 @@ public static string PrepareArguments(string testAssembly, string? testAdapterPa /// Invokes vstest.console with specified arguments. /// /// Arguments provided to vstest.console.exe + /// Environment variables to set to the started process. public void InvokeVsTest(string? arguments, Dictionary? environmentVariables = null) { var debugEnvironmentVariables = AddDebugEnvironmentVariables(environmentVariables); @@ -192,6 +195,7 @@ public void InvokeVsTest(string? arguments, Dictionary? environ /// Invokes our local copy of dotnet that is patched with artifacts from the build with specified arguments. /// /// Arguments provided to vstest.console.exe + /// Environment variables to set to the started process. public void InvokeDotnetTest(string arguments, Dictionary? environmentVariables = null) { var debugEnvironmentVariables = AddDebugEnvironmentVariables(environmentVariables); @@ -229,6 +233,7 @@ public void InvokeDotnetTest(string arguments, Dictionary? envi /// Path to test adapters. /// Dotnet Framework of test assembly. /// Run settings for execution. + /// Environment variables to set to the started process. public void InvokeVsTestForExecution(string testAssembly, string? testAdapterPath, string framework, @@ -275,6 +280,8 @@ public void InvokeVsTestForExecution(string testAssembly, /// A test assembly. /// Path to test adapters. /// Run settings for execution. + /// The target framework to use. + /// Environment variables to set to the started process. public void InvokeVsTestForDiscovery(string testAssembly, string testAdapterPath, string runSettings = "", string targetFramework = "", Dictionary? environmentVariables = null) { @@ -782,6 +789,7 @@ protected void ExecuteVsTestConsole(string? args, out string stdOut, out string /// /// /// + /// Environment variables to set to the started process. private static void ExecutePatchedDotnet(string command, string args, out string stdOut, out string stdError, out int exitCode, Dictionary? environmentVariables = null) { diff --git a/test/vstest.ProgrammerTests/Fakes/FakeTestBatchBuilder.cs b/test/vstest.ProgrammerTests/Fakes/FakeTestBatchBuilder.cs index 03b1a781d6..e3c40d179a 100644 --- a/test/vstest.ProgrammerTests/Fakes/FakeTestBatchBuilder.cs +++ b/test/vstest.ProgrammerTests/Fakes/FakeTestBatchBuilder.cs @@ -49,7 +49,7 @@ internal FakeTestBatchBuilder WithBatchSize(int batchSize) /// /// Sets the dll path (source) to be the provided value. /// - /// + /// /// internal FakeTestBatchBuilder WithDllPath(string path) { diff --git a/test/vstest.ProgrammerTests/Fakes/FakeTestDllBuilder.cs b/test/vstest.ProgrammerTests/Fakes/FakeTestDllBuilder.cs index 7b05974c8a..a8703938ec 100644 --- a/test/vstest.ProgrammerTests/Fakes/FakeTestDllBuilder.cs +++ b/test/vstest.ProgrammerTests/Fakes/FakeTestDllBuilder.cs @@ -46,7 +46,6 @@ internal FakeTestDllBuilder WithTestBatches(List> testBatches) /// /// Use this to get basic test batch, or use WithTestBatches together with TestBatchBuilder, to get a custom batch. /// - /// /// internal FakeTestDllBuilder WithTestCount(int totalCount, int? batchSize = null) { diff --git a/test/vstest.ProgrammerTests/Fakes/FakeTestHostResponsesBuilder.cs b/test/vstest.ProgrammerTests/Fakes/FakeTestHostResponsesBuilder.cs index a0f53bd5e9..bfb459fc84 100644 --- a/test/vstest.ProgrammerTests/Fakes/FakeTestHostResponsesBuilder.cs +++ b/test/vstest.ProgrammerTests/Fakes/FakeTestHostResponsesBuilder.cs @@ -41,7 +41,6 @@ internal FakeTestHostResponsesBuilder VersionCheck(FakeMessage message) /// For VersionCheck message it does the given before action and responds with the given FakeMessage and then does the given after action. /// Use FakeMessage.NoResponse to not respond. /// - /// /// internal FakeTestHostResponsesBuilder VersionCheck(FakeMessage message, Action? beforeAction = null, Action? afterAction = null) { From b028b3edaf719902eb8bbeb8090a82ee09e4c540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 10 Jul 2024 20:05:14 +0200 Subject: [PATCH 16/94] Update dependencies (#5092) * Update dependencies * Revert xunit --- eng/Versions.props | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 42c8c210f9..79ce373819 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -66,9 +66,10 @@ 17.9.0 - 3.3.1 - 3.3.1 + 3.4.3 + 3.4.3 1.0.3-preview + 2.4.2 2.4.5 2.4.2 @@ -81,9 +82,9 @@ These versions need to be "statically" readable because we read this file as xml in our build and tests. --> - [3.3.1] - [3.3.1] - [3.2.2] + [3.4.3] + [3.4.3] + [3.3.1] [2.2.10] [2.2.10] [1.4.0] @@ -91,9 +92,9 @@ See Invoke-TestAssetsBuild in scripts/build.ps1. Exact versions are used to avoid Nuget substituting them by closest match, if we make a typo. These versions need to be "statically" readable because we read this file as xml in our build and tests. --> - [17.10.0-release-24177-07] - [17.9.0] - [17.8.0] + [17.10.0] + [17.10.0] + [17.9.0] [17.6.2] [16.11.0] [15.9.2] From 525565dba3d2cefed3522afbf478514055fbe2d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Fri, 12 Jul 2024 13:55:15 +0200 Subject: [PATCH 17/94] Add option to overwrite trx without warning (#5141) --- playground/TestPlatform.Playground/Program.cs | 2 +- .../TestPlatform.Playground.csproj | 2 ++ .../TrxLogger.cs | 17 ++++++++++++++--- .../Utility/Constants.cs | 5 +++++ 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/playground/TestPlatform.Playground/Program.cs b/playground/TestPlatform.Playground/Program.cs index 142b324cb3..0cebf6d996 100644 --- a/playground/TestPlatform.Playground/Program.cs +++ b/playground/TestPlatform.Playground/Program.cs @@ -105,7 +105,7 @@ static void Main() // var processStartInfo = new ProcessStartInfo // { // FileName = console, - // Arguments = $"{string.Join(" ", sources)} --settings:{settingsFile} --listtests", + // Arguments = $"{string.Join(" ", sources)} --settings:{settingsFile} --logger:trx;LogFileName=my.trx;WarnOnFileOverwrite=false", // UseShellExecute = false, // }; // EnvironmentVariables.Variables.ToList().ForEach(processStartInfo.Environment.Add); diff --git a/playground/TestPlatform.Playground/TestPlatform.Playground.csproj b/playground/TestPlatform.Playground/TestPlatform.Playground.csproj index f20a1bd4d8..9a5dcbffbe 100644 --- a/playground/TestPlatform.Playground/TestPlatform.Playground.csproj +++ b/playground/TestPlatform.Playground/TestPlatform.Playground.csproj @@ -32,6 +32,7 @@ + @@ -74,6 +75,7 @@ + diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs index 7809c0acd1..ea3720b118 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs @@ -87,6 +87,7 @@ internal TrxLogger(IFileHelper fileHelper, TrxFileHelper trxFileHelper) /// Gets the directory under which default trx file and test results attachments should be saved. /// private string? _testResultsDirPath; + private bool _warnOnFileOverwrite; #region ITestLogger @@ -135,6 +136,13 @@ public void Initialize(TestLoggerEvents events, Dictionary para var isLogFilePrefixParameterExists = parameters.TryGetValue(TrxLoggerConstants.LogFilePrefixKey, out _); var isLogFileNameParameterExists = parameters.TryGetValue(TrxLoggerConstants.LogFileNameKey, out _); + _warnOnFileOverwrite = parameters.TryGetValue(TrxLoggerConstants.WarnOnFileOverwrite, out string? warnOnOverwriteString) + ? bool.TryParse(warnOnOverwriteString, out bool providedValue) + ? providedValue + // We found the option but could not parse the value. + : true + // We did not find the option and want to fallback to warning on write, because that was the default before. + : true; if (isLogFilePrefixParameterExists && isLogFileNameParameterExists) { @@ -450,9 +458,12 @@ private void ReserveTrxFilePath() if (shouldOverwrite && File.Exists(filePath)) { - var overwriteWarningMsg = string.Format(CultureInfo.CurrentCulture, TrxLoggerResources.TrxLoggerResultsFileOverwriteWarning, filePath); - ConsoleOutput.Instance.Warning(false, overwriteWarningMsg); - EqtTrace.Warning(overwriteWarningMsg); + if (_warnOnFileOverwrite) + { + var overwriteWarningMsg = string.Format(CultureInfo.CurrentCulture, TrxLoggerResources.TrxLoggerResultsFileOverwriteWarning, filePath); + ConsoleOutput.Instance.Warning(false, overwriteWarningMsg); + EqtTrace.Warning(overwriteWarningMsg); + } } else { diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Constants.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Constants.cs index 2987b6e448..c8cee63592 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Constants.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Constants.cs @@ -75,6 +75,11 @@ internal static class Constants /// public const string TmiTestIdPropertyIdentifier = "MSTestDiscoverer.TmiTestId"; + /// + /// Warn when overwriting the trx file. + /// + public static string WarnOnFileOverwrite = "WarnOnFileOverwrite"; + /// /// Mstest adapter string /// From 205ed17eab6879a6872cf462ff9bc9acaa1d099e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Mon, 15 Jul 2024 13:18:14 +0200 Subject: [PATCH 18/94] Fix timing in simple log (#5143) --- src/vstest.console/Internal/ConsoleLogger.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 5df4885ebc..7d6ef0278f 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -909,6 +909,20 @@ public MinimalTestResult(TestResult testResult) Outcome = testResult.Outcome; StartTime = testResult.StartTime; EndTime = testResult.EndTime; + + // When the test framework (e.g. xUnit 2.x.x) does not report start or end time + // we assign it to UTC now when constructing the test result. But that does not + // work for our logger, because we take the earliest StartTime and oldest EndTime + // to calculate the duration and this makes the first test to be "missing" from the + // duration. + // + // Instead we subtract the duration to get a more accurate result. We also + // don't compare the times for equality because the times in the TestResult are assigned + // on two different lines so they don't have to be the same. + if (EndTime - StartTime < testResult.Duration) + { + StartTime = EndTime - testResult.Duration; + } } public TestCase TestCase { get; } From dedb51fae7dea9f97ea43261ac1514037ba94733 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2024 15:14:17 +0200 Subject: [PATCH 19/94] Update dependencies from https://github.com/dotnet/source-build-externals build 20240708.3 (#5146) Microsoft.SourceBuild.Intermediate.source-build-externals From Version 9.0.0-alpha.1.24324.1 -> To Version 9.0.0-alpha.1.24358.3 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f20f8314bb..c12bf74840 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -16,9 +16,9 @@ - + https://github.com/dotnet/source-build-externals - 311ef7fef52828f4a70a94d13e32c394fd3292ee + 52c45e529d6a5956136ba3cddf849a16b65eb1f2 From b98f9777288e638a67a0fb379d8bf0f9ad490f53 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2024 15:14:25 +0200 Subject: [PATCH 20/94] Update dependencies from https://github.com/dotnet/diagnostics build 20240710.1 (#5147) Microsoft.SourceBuild.Intermediate.diagnostics , Microsoft.Diagnostics.NETCore.Client From Version 8.0.0-preview.24355.1 -> To Version 8.0.0-preview.24360.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c12bf74840..2054827eb9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,14 +5,14 @@ https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage db16c1314168cbf73ba20ff4bc8f1256e9013b38 - + https://github.com/dotnet/diagnostics - bc0513ef320ee4e4d8c3981737975c18778c88bb + 36f19c4904821895ca4d08969adb65b46964b3ce - + https://github.com/dotnet/diagnostics - bc0513ef320ee4e4d8c3981737975c18778c88bb + 36f19c4904821895ca4d08969adb65b46964b3ce diff --git a/eng/Versions.props b/eng/Versions.props index 79ce373819..ef99573c53 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -35,7 +35,7 @@ 3.11.0-beta1.23525.2 3.11.0-beta1.23525.2 17.7.0 - 0.2.0-preview.24355.1 + 0.2.0-preview.24360.1 3.0.0 2.0.0 17.9.0-beta.24058.4 From 02a8ba17b12757e0787b5e787b17533f21432b16 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2024 15:14:31 +0200 Subject: [PATCH 21/94] Update dependencies from https://github.com/dotnet/arcade build 20240710.4 (#5144) Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24360.4 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 12 ++++----- .../job/publish-build-assets.yml | 27 +++---------------- eng/common/cross/build-rootfs.sh | 2 +- eng/common/tools.ps1 | 2 +- eng/common/tools.sh | 2 +- global.json | 2 +- 6 files changed, 14 insertions(+), 33 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2054827eb9..e3578c3194 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -44,14 +44,14 @@ - + https://github.com/dotnet/arcade - 4a7d983f833d6b86365ea1b2b4d6ee72fbdbf944 + 731d793be2d0a66bafc96b1a79dc96b4d1f0301b - + https://github.com/dotnet/arcade - 4a7d983f833d6b86365ea1b2b4d6ee72fbdbf944 + 731d793be2d0a66bafc96b1a79dc96b4d1f0301b @@ -62,9 +62,9 @@ https://github.com/dotnet/symreader-converter c5ba7c88f92e2dde156c324a8c8edc04d9fa4fe0 - + https://github.com/dotnet/arcade - 4a7d983f833d6b86365ea1b2b4d6ee72fbdbf944 + 731d793be2d0a66bafc96b1a79dc96b4d1f0301b diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml index d99a1a3b28..ec3cd14191 100644 --- a/eng/common/core-templates/job/publish-build-assets.yml +++ b/eng/common/core-templates/job/publish-build-assets.yml @@ -113,38 +113,19 @@ jobs: Add-Content -Path $filePath -Value "$(DefaultChannels)" Add-Content -Path $filePath -Value $(IsStableBuild) - - template: /eng/common/core-templates/steps/publish-build-artifacts.yml - parameters: - is1ESPipeline: ${{ parameters.is1ESPipeline }} - args: - displayName: Publish ReleaseConfigs Artifact - pathToPublish: '$(Build.StagingDirectory)/ReleaseConfigs' - publishLocation: Container - artifactName: ReleaseConfigs - - - task: powershell@2 - displayName: Check if SymbolPublishingExclusionsFile.txt exists - inputs: - targetType: inline - script: | $symbolExclusionfile = "$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt" - if(Test-Path -Path $symbolExclusionfile) + if (Test-Path -Path $symbolExclusionfile) { Write-Host "SymbolExclusionFile exists" - Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]true" - } - else{ - Write-Host "Symbols Exclusion file does not exist" - Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]false" + Copy-Item -Path $symbolExclusionfile -Destination "$(Build.StagingDirectory)/ReleaseConfigs" } - template: /eng/common/core-templates/steps/publish-build-artifacts.yml parameters: is1ESPipeline: ${{ parameters.is1ESPipeline }} args: - displayName: Publish SymbolPublishingExclusionsFile Artifact - condition: eq(variables['SymbolExclusionFile'], 'true') - pathToPublish: '$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' + displayName: Publish ReleaseConfigs Artifact + pathToPublish: '$(Build.StagingDirectory)/ReleaseConfigs' publishLocation: Container artifactName: ReleaseConfigs diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index eb1a908046..6d99d1263c 100644 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -72,7 +72,7 @@ __AlpinePackages+=" krb5-dev" __AlpinePackages+=" openssl-dev" __AlpinePackages+=" zlib-dev" -__FreeBSDBase="13.2-RELEASE" +__FreeBSDBase="13.3-RELEASE" __FreeBSDPkg="1.17.0" __FreeBSDABI="13" __FreeBSDPackages="libunwind" diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 8e715d79fd..9574f4eb9d 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -262,7 +262,7 @@ function GetDotNetInstallScript([string] $dotnetRoot) { if (!(Test-Path $installScript)) { Create-Directory $dotnetRoot $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit - $uri = "https://raw.githubusercontent.com/dotnet/install-scripts/main/src/dotnet-install.ps1" + $uri = "https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.ps1" Retry({ Write-Host "GET $uri" diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 861408794b..00473c9f91 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -295,7 +295,7 @@ function with_retries { function GetDotNetInstallScript { local root=$1 local install_script="$root/dotnet-install.sh" - local install_script_url="https://raw.githubusercontent.com/dotnet/install-scripts/main/src/dotnet-install.sh" + local install_script_url="https://dotnet.microsoft.com/download/dotnet/scripts/$dotnetInstallScriptVersion/dotnet-install.sh" if [[ ! -a "$install_script" ]]; then mkdir -p "$root" diff --git a/global.json b/global.json index 9e9971dc9b..1719c50e95 100644 --- a/global.json +++ b/global.json @@ -32,6 +32,6 @@ "dotnet": "9.0.100-preview.5.24307.3" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24352.2" + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24360.4" } } From 4af0f0dcb3d8293ded6cc3f7ef09ffc57abadadf Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:05:32 +0000 Subject: [PATCH 22/94] Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20240718.5 (#5153) Microsoft.Internal.CodeCoverage From Version 17.11.3 -> To Version 17.12.0-preview.24368.5 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e3578c3194..6f805dcef7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage - db16c1314168cbf73ba20ff4bc8f1256e9013b38 + 7f5a7d212e980136deb8a2f84aaa555bad41d310 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index ef99573c53..8276dd0346 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -39,7 +39,7 @@ 3.0.0 2.0.0 17.9.0-beta.24058.4 - 17.11.3 + 17.12.0-preview.24368.5 17.10.34924.118 $(MicrosoftVisualStudioDiagnosticsUtilitiesVersion) 17.10.525-preview.1 From 1fcc71702acb43860b137c2043d65b100f9e19b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Mon, 22 Jul 2024 09:52:20 +0200 Subject: [PATCH 23/94] Check vstest.console.dll instead of .exe (#5149) --- eng/verify-nupkgs.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eng/verify-nupkgs.ps1 b/eng/verify-nupkgs.ps1 index 0b2dfce5f3..728c6e60b2 100644 --- a/eng/verify-nupkgs.ps1 +++ b/eng/verify-nupkgs.ps1 @@ -281,9 +281,10 @@ function Verify-NugetPackageVersion { $UnzipNugetPackages ) - $exes = $UnzipNugetPackages | Get-ChildItem -Filter vstest.console.exe -Recurse -Force - if (0 -eq @($exes).Length) { - throw "No vstest.console.exe was found." + # look for vstest.console.dll because unified build for .NET does not produce vstest.console.exe + $exes = $UnzipNugetPackages | Get-ChildItem -Filter vstest.console.dll -Recurse -Force + if (0 -eq @($exes).Length) { + throw "No vstest.console.dll files were found." } $exes | ForEach-Object { From de8c4cc66892a608559dfecb3c2651a45184edf9 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Mon, 22 Jul 2024 19:32:59 +1000 Subject: [PATCH 24/94] fix Refernce typos (#5155) --- .../JsonDataSerializerTests.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/JsonDataSerializerTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/JsonDataSerializerTests.cs index 05a8c8650f..fed8fb3d84 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/JsonDataSerializerTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/JsonDataSerializerTests.cs @@ -49,16 +49,16 @@ public void SerializePayloadShouldNotPickDefaultSettings(int version) var classWithSelfReferencingLoop = new ClassWithSelfReferencingLoop(null); classWithSelfReferencingLoop = new ClassWithSelfReferencingLoop(classWithSelfReferencingLoop); - classWithSelfReferencingLoop.InfiniteRefernce!.InfiniteRefernce = classWithSelfReferencingLoop; + classWithSelfReferencingLoop.InfiniteReference!.InfiniteReference = classWithSelfReferencingLoop; string serializedPayload = _jsonDataSerializer.SerializePayload("dummy", classWithSelfReferencingLoop, version); if (version <= 1) { - Assert.AreEqual("{\"MessageType\":\"dummy\",\"Payload\":{\"InfiniteRefernce\":{}}}", serializedPayload); + Assert.AreEqual("{\"MessageType\":\"dummy\",\"Payload\":{\"InfiniteReference\":{}}}", serializedPayload); } else { - Assert.AreEqual($"{{\"Version\":{version},\"MessageType\":\"dummy\",\"Payload\":{{\"InfiniteRefernce\":{{}}}}}}", serializedPayload); + Assert.AreEqual($"{{\"Version\":{version},\"MessageType\":\"dummy\",\"Payload\":{{\"InfiniteReference\":{{}}}}}}", serializedPayload); } JsonConvert.DefaultSettings = null; @@ -76,7 +76,7 @@ public void DeserializeMessageShouldNotPickDefaultSettings() PreserveReferencesHandling = PreserveReferencesHandling.All, }; - Message message = _jsonDataSerializer.DeserializeMessage("{\"MessageType\":\"dummy\",\"Payload\":{\"InfiniteRefernce\":{}}}"); + Message message = _jsonDataSerializer.DeserializeMessage("{\"MessageType\":\"dummy\",\"Payload\":{\"InfiniteReference\":{}}}"); Assert.AreEqual("dummy", message?.MessageType); JsonConvert.DefaultSettings = null; } @@ -137,7 +137,7 @@ public void DeserializePayloadIsUnaffectedByJsonConverterDefaultSettings(int ver }; // This line should deserialize properly - Message message = _jsonDataSerializer.DeserializeMessage($"{{\"Version\":\"{version}\",\"MessageType\":\"dummy\",\"Payload\":{{\"InfiniteRefernce\":{{}}}}}}"); + Message message = _jsonDataSerializer.DeserializeMessage($"{{\"Version\":\"{version}\",\"MessageType\":\"dummy\",\"Payload\":{{\"InfiniteReference\":{{}}}}}}"); //restore the default settings to null @@ -150,7 +150,7 @@ public void SerializePayloadShouldSerializeAnObjectWithSelfReferencingLoop() { var classWithSelfReferencingLoop = new ClassWithSelfReferencingLoop(null); classWithSelfReferencingLoop = new ClassWithSelfReferencingLoop(classWithSelfReferencingLoop); - classWithSelfReferencingLoop.InfiniteRefernce!.InfiniteRefernce = classWithSelfReferencingLoop; + classWithSelfReferencingLoop.InfiniteReference!.InfiniteReference = classWithSelfReferencingLoop; // This line should not throw exception _jsonDataSerializer.SerializePayload("dummy", classWithSelfReferencingLoop); @@ -161,7 +161,7 @@ public void DeserializeShouldDeserializeAnObjectWhichHadSelfReferencingLoopBefor { var classWithSelfReferencingLoop = new ClassWithSelfReferencingLoop(null); classWithSelfReferencingLoop = new ClassWithSelfReferencingLoop(classWithSelfReferencingLoop); - classWithSelfReferencingLoop.InfiniteRefernce!.InfiniteRefernce = classWithSelfReferencingLoop; + classWithSelfReferencingLoop.InfiniteReference!.InfiniteReference = classWithSelfReferencingLoop; var json = _jsonDataSerializer.SerializePayload("dummy", classWithSelfReferencingLoop); @@ -169,7 +169,7 @@ public void DeserializeShouldDeserializeAnObjectWhichHadSelfReferencingLoopBefor var result = _jsonDataSerializer.Deserialize(json, 1)!; Assert.AreEqual(typeof(ClassWithSelfReferencingLoop), result.GetType()); - Assert.IsNull(result.InfiniteRefernce); + Assert.IsNull(result.InfiniteReference); } [TestMethod] @@ -255,9 +255,9 @@ public class ClassWithSelfReferencingLoop { public ClassWithSelfReferencingLoop(ClassWithSelfReferencingLoop? ir) { - InfiniteRefernce = ir; + InfiniteReference = ir; } - public ClassWithSelfReferencingLoop? InfiniteRefernce { get; set; } + public ClassWithSelfReferencingLoop? InfiniteReference { get; set; } } } From 636ce35409e24424388389a0fd47f8b8ece42117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 23 Jul 2024 09:54:09 +0200 Subject: [PATCH 25/94] Report version (#5161) --- eng/verify-nupkgs.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/verify-nupkgs.ps1 b/eng/verify-nupkgs.ps1 index 728c6e60b2..b3698ce7cc 100644 --- a/eng/verify-nupkgs.ps1 +++ b/eng/verify-nupkgs.ps1 @@ -289,7 +289,7 @@ function Verify-NugetPackageVersion { $exes | ForEach-Object { if ($_.VersionInfo.ProductVersion.Contains("+")) { - throw "Some files contain '+' in the ProductVersion, this breaks DTAAgent in AzDO." + throw "$_ contains '+' in the ProductVersion $($_.VersionInfo.ProductVersion), this breaks DTAAgent in AzDO." } else { "$_ version $($_.VersionInfo.ProductVersion) is ok." From f26adda34d3ef02748b2e1cb359488d223f1e3a0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 15:17:08 +0200 Subject: [PATCH 26/94] [main] Update dependencies from dotnet/source-build-externals (#5158) * Update dependencies from https://github.com/dotnet/source-build-externals build 20240719.5 Microsoft.SourceBuild.Intermediate.source-build-externals From Version 9.0.0-alpha.1.24358.3 -> To Version 9.0.0-alpha.1.24369.5 * Update dependencies from https://github.com/dotnet/source-build-externals build 20240726.4 Microsoft.SourceBuild.Intermediate.source-build-externals From Version 9.0.0-alpha.1.24358.3 -> To Version 9.0.0-alpha.1.24376.4 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6f805dcef7..29b526e47f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -16,9 +16,9 @@ - + https://github.com/dotnet/source-build-externals - 52c45e529d6a5956136ba3cddf849a16b65eb1f2 + d6e05f9c80394626ffb7af82d0e84547ddd265c0 From 082e5dadda4d952b3d8c6d41a5476b27e7504ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Mon, 5 Aug 2024 15:17:17 +0200 Subject: [PATCH 27/94] Move IncludeSourceRevisionInInformationalVersion to directory.build.props (#5166) --- azure-pipelines-official.yml | 3 --- eng/Versions.props | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index f426ce637a..f11577b7dd 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -100,8 +100,6 @@ variables: - name: VisualStudioDropName value: Products/$(System.TeamProject)/$(Build.DefinitionName)/$(Build.SourceBranchName)/$(Build.BuildNumber) - name: _InternalBuildArgs - # IncludeSourceRevisionInInformationalVersion prevents ProductVersion (on file), and AssemblyInformationalVersion - # from appending +, which breaks DTAAgent. value: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName) /p:DotNetFinalVersionKind=$(_ReleaseVersionKind) @@ -111,7 +109,6 @@ variables: /p:OfficialBuildId=$(BUILD.BUILDNUMBER) /p:VisualStudioDropName=$(VisualStudioDropName) /p:GenerateSbom=true - /p:IncludeSourceRevisionInInformationalVersion=false resources: repositories: diff --git a/eng/Versions.props b/eng/Versions.props index 8276dd0346..164bba653d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,6 +8,11 @@ is trying to parse that version and will consider any version with more than 4 `.` in it as invalid. --> true + + false 17.12.0 preview From d4d7162593354c39d2d20c8f4853439821890171 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 15:17:30 +0200 Subject: [PATCH 28/94] [main] Update dependencies from dotnet/diagnostics (#5159) * Update dependencies from https://github.com/dotnet/diagnostics build 20240719.1 Microsoft.SourceBuild.Intermediate.diagnostics , Microsoft.Diagnostics.NETCore.Client From Version 8.0.0-preview.24360.1 -> To Version 8.0.0-preview.24369.1 * Update dependencies from https://github.com/dotnet/diagnostics build 20240726.1 Microsoft.SourceBuild.Intermediate.diagnostics , Microsoft.Diagnostics.NETCore.Client From Version 8.0.0-preview.24360.1 -> To Version 8.0.0-preview.24376.1 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 29b526e47f..1b2e2622e0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,14 +5,14 @@ https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage 7f5a7d212e980136deb8a2f84aaa555bad41d310 - + https://github.com/dotnet/diagnostics - 36f19c4904821895ca4d08969adb65b46964b3ce + 1f8c2213b61e90ea960b33e5d7fb7a9a88c82296 - + https://github.com/dotnet/diagnostics - 36f19c4904821895ca4d08969adb65b46964b3ce + 1f8c2213b61e90ea960b33e5d7fb7a9a88c82296 diff --git a/eng/Versions.props b/eng/Versions.props index 164bba653d..46af213835 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -40,7 +40,7 @@ 3.11.0-beta1.23525.2 3.11.0-beta1.23525.2 17.7.0 - 0.2.0-preview.24360.1 + 0.2.0-preview.24376.1 3.0.0 2.0.0 17.9.0-beta.24058.4 From b1e15e51243982a3396d0136f4fd889a707e1d0e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:15:50 +0200 Subject: [PATCH 29/94] [main] Update dependencies from dotnet/arcade (#5157) * Update dependencies from https://github.com/dotnet/arcade build 20240718.9 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24360.4 -> To Version 9.0.0-beta.24368.9 * Update dependencies from https://github.com/dotnet/arcade build 20240725.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24360.4 -> To Version 9.0.0-beta.24375.3 * Update dependencies from https://github.com/dotnet/arcade build 20240801.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24360.4 -> To Version 9.0.0-beta.24401.1 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 12 ++-- .../job/publish-build-assets.yml | 5 +- .../job/source-index-stage1.yml | 6 +- .../core-templates/post-build/post-build.yml | 5 +- .../steps/get-federated-access-token.yml | 16 +++++- .../core-templates/steps/publish-logs.yml | 1 - eng/common/cross/build-rootfs.sh | 14 ++--- eng/common/native/init-compiler.sh | 56 +++++++------------ eng/common/post-build/publish-using-darc.ps1 | 1 + global.json | 2 +- 10 files changed, 60 insertions(+), 58 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1b2e2622e0..fbfd201ffb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -44,14 +44,14 @@ - + https://github.com/dotnet/arcade - 731d793be2d0a66bafc96b1a79dc96b4d1f0301b + a3dae8d4fd5a17c147cbecfd31e61463731ac0cc - + https://github.com/dotnet/arcade - 731d793be2d0a66bafc96b1a79dc96b4d1f0301b + a3dae8d4fd5a17c147cbecfd31e61463731ac0cc @@ -62,9 +62,9 @@ https://github.com/dotnet/symreader-converter c5ba7c88f92e2dde156c324a8c8edc04d9fa4fe0 - + https://github.com/dotnet/arcade - 731d793be2d0a66bafc96b1a79dc96b4d1f0301b + a3dae8d4fd5a17c147cbecfd31e61463731ac0cc diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml index ec3cd14191..3d3356e319 100644 --- a/eng/common/core-templates/job/publish-build-assets.yml +++ b/eng/common/core-templates/job/publish-build-assets.yml @@ -143,9 +143,10 @@ jobs: scriptType: ps scriptLocation: scriptPath scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: -BuildId $(BARBuildId) + arguments: > + -BuildId $(BARBuildId) -PublishingInfraVersion 3 - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' + -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/core-templates/job/source-index-stage1.yml b/eng/common/core-templates/job/source-index-stage1.yml index 945c1c19e8..205fb5b3a3 100644 --- a/eng/common/core-templates/job/source-index-stage1.yml +++ b/eng/common/core-templates/job/source-index-stage1.yml @@ -34,10 +34,12 @@ jobs: pool: ${{ if eq(variables['System.TeamProject'], 'public') }}: name: $(DncEngPublicBuildPool) - image: windows.vs2022.amd64.open + image: 1es-windows-2022-open + os: windows ${{ if eq(variables['System.TeamProject'], 'internal') }}: name: $(DncEngInternalBuildPool) - image: windows.vs2022.amd64 + image: 1es-windows-2022 + os: windows steps: - ${{ if eq(parameters.is1ESPipeline, '') }}: diff --git a/eng/common/core-templates/post-build/post-build.yml b/eng/common/core-templates/post-build/post-build.yml index 20924366b8..454fd75c7a 100644 --- a/eng/common/core-templates/post-build/post-build.yml +++ b/eng/common/core-templates/post-build/post-build.yml @@ -307,9 +307,10 @@ stages: scriptType: ps scriptLocation: scriptPath scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: -BuildId $(BARBuildId) + arguments: > + -BuildId $(BARBuildId) -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' + -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/core-templates/steps/get-federated-access-token.yml b/eng/common/core-templates/steps/get-federated-access-token.yml index c8c49cc0e8..3a4d4410c4 100644 --- a/eng/common/core-templates/steps/get-federated-access-token.yml +++ b/eng/common/core-templates/steps/get-federated-access-token.yml @@ -3,6 +3,14 @@ parameters: type: string - name: outputVariableName type: string +- name: is1ESPipeline + type: boolean +- name: stepName + type: string + default: 'getFederatedAccessToken' +- name: condition + type: string + default: '' # Resource to get a token for. Common values include: # - '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps # - 'https://storage.azure.com/' for storage @@ -10,10 +18,16 @@ parameters: - name: resource type: string default: '499b84ac-1321-427f-aa17-267ca6975798' +- name: isStepOutputVariable + type: boolean + default: false steps: - task: AzureCLI@2 displayName: 'Getting federated access token for feeds' + name: ${{ parameters.stepName }} + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} inputs: azureSubscription: ${{ parameters.federatedServiceConnection }} scriptType: 'pscore' @@ -25,4 +39,4 @@ steps: exit 1 } Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value" - Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true]$accessToken" \ No newline at end of file + Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true;isOutput=${{ parameters.isStepOutputVariable }}]$accessToken" \ No newline at end of file diff --git a/eng/common/core-templates/steps/publish-logs.yml b/eng/common/core-templates/steps/publish-logs.yml index 8c5ea77b58..80788c5231 100644 --- a/eng/common/core-templates/steps/publish-logs.yml +++ b/eng/common/core-templates/steps/publish-logs.yml @@ -32,7 +32,6 @@ steps: '$(MaestroAccessToken)' '$(dn-bot-all-orgs-artifact-feeds-rw)' '$(akams-client-id)' - '$(akams-client-secret)' '$(microsoft-symbol-server-pat)' '$(symweb-symbol-server-pat)' '$(dn-bot-all-orgs-build-rw-code-rw)' diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 6d99d1263c..4b5e8d7166 100644 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -605,18 +605,18 @@ elif [[ "$__CodeName" == "illumos" ]]; then fi echo "Building binutils. Please wait.." if [[ "$__hasWget" == 1 ]]; then - wget -O- https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.bz2 | tar -xjf - + wget -O- https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz | tar -xJf - else - curl -SL https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.bz2 | tar -xjf - + curl -SL https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz | tar -xJf - fi mkdir build-binutils && cd build-binutils - ../binutils-2.33.1/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.10" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" + ../binutils-2.42/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.11" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" make -j "$JOBS" && make install && cd .. echo "Building gcc. Please wait.." if [[ "$__hasWget" == 1 ]]; then - wget -O- https://ftp.gnu.org/gnu/gcc/gcc-8.4.0/gcc-8.4.0.tar.xz | tar -xJf - + wget -O- https://ftp.gnu.org/gnu/gcc/gcc-13.3.0/gcc-13.3.0.tar.xz | tar -xJf - else - curl -SL https://ftp.gnu.org/gnu/gcc/gcc-8.4.0/gcc-8.4.0.tar.xz | tar -xJf - + curl -SL https://ftp.gnu.org/gnu/gcc/gcc-13.3.0/gcc-13.3.0.tar.xz | tar -xJf - fi CFLAGS="-fPIC" CXXFLAGS="-fPIC" @@ -624,7 +624,7 @@ elif [[ "$__CodeName" == "illumos" ]]; then CFLAGS_FOR_TARGET="-fPIC" export CFLAGS CXXFLAGS CXXFLAGS_FOR_TARGET CFLAGS_FOR_TARGET mkdir build-gcc && cd build-gcc - ../gcc-8.4.0/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.10" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" --with-gnu-as \ + ../gcc-13.3.0/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.11" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" --with-gnu-as \ --with-gnu-ld --disable-nls --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --disable-libcilkrts --disable-libada --disable-libsanitizer \ --disable-libquadmath-support --disable-shared --enable-tls make -j "$JOBS" && make install && cd .. @@ -632,7 +632,7 @@ elif [[ "$__CodeName" == "illumos" ]]; then if [[ "$__UseMirror" == 1 ]]; then BaseUrl=https://pkgsrc.smartos.skylime.net fi - BaseUrl="$BaseUrl/packages/SmartOS/trunk/${__illumosArch}/All" + BaseUrl="$BaseUrl/packages/SmartOS/2019Q4/${__illumosArch}/All" echo "Downloading manifest" if [[ "$__hasWget" == 1 ]]; then wget "$BaseUrl" diff --git a/eng/common/native/init-compiler.sh b/eng/common/native/init-compiler.sh index 62900e12b2..9a0e1f2b45 100644 --- a/eng/common/native/init-compiler.sh +++ b/eng/common/native/init-compiler.sh @@ -19,11 +19,9 @@ case "$compiler" in # clangx.y or clang-x.y version="$(echo "$compiler" | tr -d '[:alpha:]-=')" majorVersion="${version%%.*}" - [ -z "${version##*.*}" ] && minorVersion="${version#*.}" - if [ -z "$minorVersion" ] && [ -n "$majorVersion" ] && [ "$majorVersion" -le 6 ]; then - minorVersion=0; - fi + # LLVM based on v18 released in early 2024, with two releases per year + maxVersion="$((18 + ((($(date +%Y) - 2024) * 12 + $(date +%-m) - 3) / 6)))" compiler=clang ;; @@ -31,7 +29,9 @@ case "$compiler" in # gccx.y or gcc-x.y version="$(echo "$compiler" | tr -d '[:alpha:]-=')" majorVersion="${version%%.*}" - [ -z "${version##*.*}" ] && minorVersion="${version#*.}" + + # GCC based on v14 released in early 2024, with one release per year + maxVersion="$((14 + ((($(date +%Y) - 2024) * 12 + $(date +%-m) - 3) / 12)))" compiler=gcc ;; esac @@ -49,12 +49,10 @@ check_version_exists() { desired_version=-1 # Set up the environment to be used for building with the desired compiler. - if command -v "$compiler-$1.$2" > /dev/null; then - desired_version="-$1.$2" - elif command -v "$compiler$1$2" > /dev/null; then - desired_version="$1$2" - elif command -v "$compiler-$1$2" > /dev/null; then - desired_version="-$1$2" + if command -v "$compiler-$1" > /dev/null; then + desired_version="-$1" + elif command -v "$compiler$1" > /dev/null; then + desired_version="$1" fi echo "$desired_version" @@ -75,7 +73,7 @@ set_compiler_version_from_CC() { fi # gcc and clang often display 3 part versions. However, gcc can show only 1 part in some environments. - IFS=. read -r majorVersion minorVersion _ < /dev/null; then - echo "Error: No usable version of $compiler found." + echo "Error: No compatible version of $compiler was found within the range of $minVersion to $maxVersion. Please upgrade your toolchain or specify the compiler explicitly using CLR_CC and CLR_CXX environment variables." exit 1 fi CC="$(command -v "$compiler" 2> /dev/null)" CXX="$(command -v "$cxxCompiler" 2> /dev/null)" set_compiler_version_from_CC - else - if [ "$compiler" = "clang" ] && [ "$majorVersion" -lt 5 ] && { [ "$build_arch" = "arm" ] || [ "$build_arch" = "armel" ]; }; then - # If a major version was provided explicitly, and it was too old, find a newer compiler instead - if ! command -v "$compiler" > /dev/null; then - echo "Error: Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH." - exit 1 - fi - - CC="$(command -v "$compiler" 2> /dev/null)" - CXX="$(command -v "$cxxCompiler" 2> /dev/null)" - set_compiler_version_from_CC - fi fi else - desired_version="$(check_version_exists "$majorVersion" "$minorVersion")" + desired_version="$(check_version_exists "$majorVersion")" if [ "$desired_version" = "-1" ]; then - echo "Error: Could not find specific version of $compiler: $majorVersion $minorVersion." + echo "Error: Could not find specific version of $compiler: $majorVersion." exit 1 fi fi diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 4ff587ca46..90b58e32a8 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -42,6 +42,7 @@ try { --azdev-pat "$AzdoToken" ` --bar-uri "$MaestroApiEndPoint" ` --ci ` + --verbose ` @optionalParams if ($LastExitCode -ne 0) { diff --git a/global.json b/global.json index 1719c50e95..66fb9ff5f1 100644 --- a/global.json +++ b/global.json @@ -32,6 +32,6 @@ "dotnet": "9.0.100-preview.5.24307.3" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24360.4" + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24401.1" } } From bc9d7a7f30528611b4598abb06f1f6ce4985f8d8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 09:52:15 +0200 Subject: [PATCH 30/94] Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20240809.1 (#5168) Microsoft.Internal.CodeCoverage From Version 17.12.0-preview.24368.5 -> To Version 17.12.0-preview.24409.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index fbfd201ffb..3419ca5d77 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage - 7f5a7d212e980136deb8a2f84aaa555bad41d310 + ddf66849211bf20fa2a60c447cf0f20d723e6617 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index 46af213835..6751e16758 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -44,7 +44,7 @@ 3.0.0 2.0.0 17.9.0-beta.24058.4 - 17.12.0-preview.24368.5 + 17.12.0-preview.24409.1 17.10.34924.118 $(MicrosoftVisualStudioDiagnosticsUtilitiesVersion) 17.10.525-preview.1 From 5da720886b639dbe6c8c0ca9e69bb2cdf4f843c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Mon, 12 Aug 2024 15:20:40 +0200 Subject: [PATCH 31/94] Enable or disable new logger based on TL flag (#5167) * Enable or disable new logger based on TL flag * Output --- .../Microsoft.TestPlatform.targets | 6 ++++-- .../DotnetTestMSBuildOutputTests.cs | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.TestPlatform.Build/Microsoft.TestPlatform.targets b/src/Microsoft.TestPlatform.Build/Microsoft.TestPlatform.targets index 6c4b0b8853..531c23b520 100644 --- a/src/Microsoft.TestPlatform.Build/Microsoft.TestPlatform.targets +++ b/src/Microsoft.TestPlatform.Build/Microsoft.TestPlatform.targets @@ -29,9 +29,11 @@ Copyright (c) .NET Foundation. All rights reserved. --> - + + - + + - + https://github.com/dotnet/diagnostics - 1f8c2213b61e90ea960b33e5d7fb7a9a88c82296 + 5838149521e80185e0dbe79720bd9ce6e81d2d35 diff --git a/eng/Versions.props b/eng/Versions.props index 6751e16758..a0c3955ed2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -40,7 +40,7 @@ 3.11.0-beta1.23525.2 3.11.0-beta1.23525.2 17.7.0 - 0.2.0-preview.24376.1 + 0.2.0-preview.24408.1 3.0.0 2.0.0 17.9.0-beta.24058.4 From c5c8ee586c6bd58eee6e845aee32e88f789c127d Mon Sep 17 00:00:00 2001 From: fhnaseer Date: Mon, 12 Aug 2024 15:23:46 +0200 Subject: [PATCH 33/94] Updating Microsoft.CodeCoverage package structure (#5169) 1. VanguardInstrumentationProfiler_XYZ.config => Cov_XYZ.config 2. rootFolder\InstrumentationEngine => rootFolder --- eng/Version.Details.xml | 4 +-- eng/Versions.props | 2 +- .../Microsoft.CodeCoverage.nuspec | 30 +++++++++---------- .../Microsoft.TestPlatform.nuspec | 6 ++-- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f5fec3b212..bd91f713b6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage - ddf66849211bf20fa2a60c447cf0f20d723e6617 + 2fabb6cdbce2e64fa7a9dc483991f6ce475ab334 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index a0c3955ed2..739e8e252f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -44,7 +44,7 @@ 3.0.0 2.0.0 17.9.0-beta.24058.4 - 17.12.0-preview.24409.1 + 17.12.0-preview.24409.2 17.10.34924.118 $(MicrosoftVisualStudioDiagnosticsUtilitiesVersion) 17.10.525-preview.1 diff --git a/src/package/Microsoft.CodeCoverage/Microsoft.CodeCoverage.nuspec b/src/package/Microsoft.CodeCoverage/Microsoft.CodeCoverage.nuspec index 117a6ba933..530ba92536 100644 --- a/src/package/Microsoft.CodeCoverage/Microsoft.CodeCoverage.nuspec +++ b/src/package/Microsoft.CodeCoverage/Microsoft.CodeCoverage.nuspec @@ -33,34 +33,34 @@ - + - + - + - - - + + + - - - + + + - - - + + + - - - + + + diff --git a/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec b/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec index 812cab1cfe..921d46e25c 100644 --- a/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec +++ b/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec @@ -448,16 +448,16 @@ - + - + - + From dc1e4f67aaa590b3e77588919bf44b775d7d89a6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 17:34:08 +0200 Subject: [PATCH 34/94] [main] Update dependencies from dotnet/source-build-externals (#5173) Microsoft.SourceBuild.Intermediate.source-build-externals From Version 9.0.0-alpha.1.24376.4 -> To Version 9.0.0-alpha.1.24407.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bd91f713b6..60035d098b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -16,9 +16,9 @@ - + https://github.com/dotnet/source-build-externals - d6e05f9c80394626ffb7af82d0e84547ddd265c0 + 51b029e3272f35af0af337823cd122725f316c69 From 80af388e851d0d8b88f93d07d46d47054acb9951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Tue, 13 Aug 2024 11:16:37 +0200 Subject: [PATCH 35/94] Wait for Discovery to initialize before Cancelling it (#5177) --- .../TestPlatformHelpers/TestRequestManager.cs | 194 ++++++++++-------- 1 file changed, 110 insertions(+), 84 deletions(-) diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index d95891c425..f93857b671 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -78,6 +78,13 @@ internal class TestRequestManager : ITestRequestManager /// Assumption: There can only be one active discovery request. /// private IDiscoveryRequest? _currentDiscoveryRequest; + /// + /// Guards cancellation of the current discovery request, by resetting when the request is received, + /// because the request needs time to setup and populate the _currentTestRunRequest. This might take a relatively + /// long time when the machine is slow, because the setup is called as an async task, so it needs to be processed by thread pool + /// and there might be a queue of existing tasks. + /// + private readonly ManualResetEvent _discoveryStarting = new(true); /// /// Maintains the current active test run attachments processing cancellation token source. @@ -163,106 +170,119 @@ public void DiscoverTests( ITestDiscoveryEventsRegistrar discoveryEventsRegistrar, ProtocolConfig protocolConfig) { - EqtTrace.Info("TestRequestManager.DiscoverTests: Discovery tests started."); - - // TODO: Normalize rest of the data on the request as well - discoveryPayload.Sources = KnownPlatformSourceFilter.FilterKnownPlatformSources(discoveryPayload.Sources?.Distinct().ToList()); - discoveryPayload.RunSettings ??= ""; - - var runsettings = discoveryPayload.RunSettings; - - if (discoveryPayload.TestPlatformOptions != null) + try { - _telemetryOptedIn = discoveryPayload.TestPlatformOptions.CollectMetrics; - } + // Flag that that discovery is being initialized, so all requests to cancel discovery will wait till we set the discovery up. + _discoveryStarting.Reset(); - var requestData = GetRequestData(protocolConfig); - if (UpdateRunSettingsIfRequired( - runsettings, - discoveryPayload.Sources.ToList(), - discoveryEventsRegistrar, - isDiscovery: true, - out string updatedRunsettings, - out IDictionary sourceToArchitectureMap, - out IDictionary sourceToFrameworkMap)) - { - runsettings = updatedRunsettings; - } + // Make sure to run the run request inside a lock as the below section is not thread-safe. + // There can be only one discovery or execution request at a given point in time. + lock (_syncObject) + { + EqtTrace.Info("TestRequestManager.DiscoverTests: Discovery tests started."); - var sourceToSourceDetailMap = discoveryPayload.Sources.Select(source => new SourceDetail - { - Source = source, - Architecture = sourceToArchitectureMap[source], - Framework = sourceToFrameworkMap[source], - }).ToDictionary(k => k.Source!); + // TODO: Normalize rest of the data on the request as well + discoveryPayload.Sources = KnownPlatformSourceFilter.FilterKnownPlatformSources(discoveryPayload.Sources?.Distinct().ToList()); + discoveryPayload.RunSettings ??= ""; - var runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(runsettings); - var batchSize = runConfiguration.BatchSize; - var testCaseFilterFromRunsettings = runConfiguration.TestCaseFilter; + var runsettings = discoveryPayload.RunSettings; - if (requestData.IsTelemetryOptedIn) - { - // Collect metrics. - CollectMetrics(requestData, runConfiguration); + if (discoveryPayload.TestPlatformOptions != null) + { + _telemetryOptedIn = discoveryPayload.TestPlatformOptions.CollectMetrics; + } - // Collect commands. - LogCommandsTelemetryPoints(requestData); - } + var requestData = GetRequestData(protocolConfig); + if (UpdateRunSettingsIfRequired( + runsettings, + discoveryPayload.Sources.ToList(), + discoveryEventsRegistrar, + isDiscovery: true, + out string updatedRunsettings, + out IDictionary sourceToArchitectureMap, + out IDictionary sourceToFrameworkMap)) + { + runsettings = updatedRunsettings; + } - // Create discovery request. - var criteria = new DiscoveryCriteria( - discoveryPayload.Sources, - batchSize, - _commandLineOptions.TestStatsEventTimeout, - runsettings, - discoveryPayload.TestSessionInfo) - { - TestCaseFilter = _commandLineOptions.TestCaseFilterValue - ?? testCaseFilterFromRunsettings - }; + var sourceToSourceDetailMap = discoveryPayload.Sources.Select(source => new SourceDetail + { + Source = source, + Architecture = sourceToArchitectureMap[source], + Framework = sourceToFrameworkMap[source], + }).ToDictionary(k => k.Source!); - // Make sure to run the run request inside a lock as the below section is not thread-safe. - // There can be only one discovery or execution request at a given point in time. - lock (_syncObject) - { - try - { - EqtTrace.Info("TestRequestManager.DiscoverTests: Synchronization context taken"); + var runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(runsettings); + var batchSize = runConfiguration.BatchSize; + var testCaseFilterFromRunsettings = runConfiguration.TestCaseFilter; - _currentDiscoveryRequest = _testPlatform.CreateDiscoveryRequest( - requestData, - criteria, - discoveryPayload.TestPlatformOptions, - sourceToSourceDetailMap, - new EventRegistrarToWarningLoggerAdapter(discoveryEventsRegistrar)); - discoveryEventsRegistrar?.RegisterDiscoveryEvents(_currentDiscoveryRequest); + if (requestData.IsTelemetryOptedIn) + { + // Collect metrics. + CollectMetrics(requestData, runConfiguration); - // Notify start of discovery start. - _testPlatformEventSource.DiscoveryRequestStart(); + // Collect commands. + LogCommandsTelemetryPoints(requestData); + } - // Start the discovery of tests and wait for completion. - _currentDiscoveryRequest.DiscoverAsync(); - _currentDiscoveryRequest.WaitForCompletion(); - } - finally - { - if (_currentDiscoveryRequest != null) + // Create discovery request. + var criteria = new DiscoveryCriteria( + discoveryPayload.Sources, + batchSize, + _commandLineOptions.TestStatsEventTimeout, + runsettings, + discoveryPayload.TestSessionInfo) { - // Dispose the discovery request and unregister for events. - discoveryEventsRegistrar?.UnregisterDiscoveryEvents(_currentDiscoveryRequest); - _currentDiscoveryRequest.Dispose(); - _currentDiscoveryRequest = null; - } + TestCaseFilter = _commandLineOptions.TestCaseFilterValue + ?? testCaseFilterFromRunsettings + }; - EqtTrace.Info("TestRequestManager.DiscoverTests: Discovery tests completed."); - _testPlatformEventSource.DiscoveryRequestStop(); - // Posts the discovery complete event. - _metricsPublisher.Result.PublishMetrics( - TelemetryDataConstants.TestDiscoveryCompleteEvent, - requestData.MetricsCollection.Metrics!); + try + { + EqtTrace.Info("TestRequestManager.DiscoverTests: Synchronization context taken"); + + _currentDiscoveryRequest = _testPlatform.CreateDiscoveryRequest( + requestData, + criteria, + discoveryPayload.TestPlatformOptions, + sourceToSourceDetailMap, + new EventRegistrarToWarningLoggerAdapter(discoveryEventsRegistrar)); + // Discovery started, allow cancellations to proceed. + _currentDiscoveryRequest.OnDiscoveryStart += (s, e) => _discoveryStarting.Set(); + discoveryEventsRegistrar?.RegisterDiscoveryEvents(_currentDiscoveryRequest); + + // Notify start of discovery start. + _testPlatformEventSource.DiscoveryRequestStart(); + + // Start the discovery of tests and wait for completion. + _currentDiscoveryRequest.DiscoverAsync(); + _currentDiscoveryRequest.WaitForCompletion(); + } + finally + { + if (_currentDiscoveryRequest != null) + { + // Dispose the discovery request and unregister for events. + discoveryEventsRegistrar?.UnregisterDiscoveryEvents(_currentDiscoveryRequest); + _currentDiscoveryRequest.Dispose(); + _currentDiscoveryRequest = null; + } + + EqtTrace.Info("TestRequestManager.DiscoverTests: Discovery tests completed."); + _testPlatformEventSource.DiscoveryRequestStop(); + + // Posts the discovery complete event. + _metricsPublisher.Result.PublishMetrics( + TelemetryDataConstants.TestDiscoveryCompleteEvent, + requestData.MetricsCollection.Metrics!); + } } } + finally + { + _discoveryStarting.Set(); + } } /// @@ -624,6 +644,12 @@ public void CancelTestRun() public void CancelDiscovery() { EqtTrace.Info("TestRequestManager.CancelDiscovery: Sending cancel request."); + + // Wait for discovery request to initialize, before cancelling it, otherwise the + // _currentDiscoveryRequest might be null, because discovery did not have enough time to + // initialize and did not manage to populate _currentDiscoveryRequest yet, leading to hanging run + // that "ignores" the cancellation. + _discoveryStarting.WaitOne(3000); _currentDiscoveryRequest?.Abort(); } From a090bba24c9d786a328acbcc344f57e61c08428a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 12:23:50 +0200 Subject: [PATCH 36/94] Update dependencies from https://github.com/dotnet/source-build-externals build 20240815.1 (#5181) Microsoft.SourceBuild.Intermediate.source-build-externals From Version 9.0.0-alpha.1.24407.1 -> To Version 10.0.0-alpha.1.24415.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 60035d098b..9f44458690 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -16,9 +16,9 @@ - + https://github.com/dotnet/source-build-externals - 51b029e3272f35af0af337823cd122725f316c69 + 2cef086137a68586fdd69848261e2a8cf8c48b73 From 54964cdbcd254cbce066d3a2afa2b3908db51abd Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 12:24:22 +0200 Subject: [PATCH 37/94] Update dependencies from https://github.com/dotnet/diagnostics build 20240816.1 (#5182) Microsoft.SourceBuild.Intermediate.diagnostics , Microsoft.Diagnostics.NETCore.Client From Version 8.0.0-preview.24408.1 -> To Version 8.0.0-preview.24416.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9f44458690..8f77ddbc7b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,14 +5,14 @@ https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage 2fabb6cdbce2e64fa7a9dc483991f6ce475ab334 - + https://github.com/dotnet/diagnostics - 5838149521e80185e0dbe79720bd9ce6e81d2d35 + 513150c2f25077b1fcb194407e53c433c975f39b - + https://github.com/dotnet/diagnostics - 5838149521e80185e0dbe79720bd9ce6e81d2d35 + 513150c2f25077b1fcb194407e53c433c975f39b diff --git a/eng/Versions.props b/eng/Versions.props index 739e8e252f..899a093382 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -40,7 +40,7 @@ 3.11.0-beta1.23525.2 3.11.0-beta1.23525.2 17.7.0 - 0.2.0-preview.24408.1 + 0.2.0-preview.24416.1 3.0.0 2.0.0 17.9.0-beta.24058.4 From d677692c05e21d311d4837550d6c0c2e6bb08c80 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 09:33:02 +0000 Subject: [PATCH 38/94] [main] Update dependencies from dotnet/arcade (#5172) Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24401.1 -> To Version 9.0.0-beta.24408.2 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 12 ++++++------ eng/common/darc-init.ps1 | 2 +- eng/common/darc-init.sh | 2 +- global.json | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8f77ddbc7b..7cae1aa1c9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -44,14 +44,14 @@ - + https://github.com/dotnet/arcade - a3dae8d4fd5a17c147cbecfd31e61463731ac0cc + 60ae233c3d77f11c5fdb53e570b64d503b13ba59 - + https://github.com/dotnet/arcade - a3dae8d4fd5a17c147cbecfd31e61463731ac0cc + 60ae233c3d77f11c5fdb53e570b64d503b13ba59 @@ -62,9 +62,9 @@ https://github.com/dotnet/symreader-converter c5ba7c88f92e2dde156c324a8c8edc04d9fa4fe0 - + https://github.com/dotnet/arcade - a3dae8d4fd5a17c147cbecfd31e61463731ac0cc + 60ae233c3d77f11c5fdb53e570b64d503b13ba59 diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 8fda30bdce..e337431056 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -1,6 +1,6 @@ param ( $darcVersion = $null, - $versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2019-01-16', + $versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2020-02-20', $verbosity = 'minimal', $toolpath = $null ) diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index c305ae6bd7..36dbd45e1c 100644 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -2,7 +2,7 @@ source="${BASH_SOURCE[0]}" darcVersion='' -versionEndpoint='https://maestro.dot.net/api/assets/darc-version?api-version=2019-01-16' +versionEndpoint='https://maestro.dot.net/api/assets/darc-version?api-version=2020-02-20' verbosity='minimal' while [[ $# > 0 ]]; do diff --git a/global.json b/global.json index 66fb9ff5f1..7ef6d61a2c 100644 --- a/global.json +++ b/global.json @@ -32,6 +32,6 @@ "dotnet": "9.0.100-preview.5.24307.3" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24401.1" + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24408.2" } } From b189b5486fd255dac5ad5884aa60846743650d04 Mon Sep 17 00:00:00 2001 From: fhnaseer Date: Tue, 27 Aug 2024 17:57:14 +0200 Subject: [PATCH 39/94] Adding condition to disable MsCoverage refrenced path maps (#5189) --- .../Microsoft.CodeCoverage/Microsoft.CodeCoverage.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/package/Microsoft.CodeCoverage/Microsoft.CodeCoverage.targets b/src/package/Microsoft.CodeCoverage/Microsoft.CodeCoverage.targets index cefa2d2c35..0e75c6c723 100644 --- a/src/package/Microsoft.CodeCoverage/Microsoft.CodeCoverage.targets +++ b/src/package/Microsoft.CodeCoverage/Microsoft.CodeCoverage.targets @@ -24,7 +24,7 @@ - + <_msCoverageSdkNETCoreSdkVersion>$(NETCoreSdkVersion) <_msCoverageSdkNETCoreSdkVersion Condition="$(_msCoverageSdkNETCoreSdkVersion.Contains('-'))">$(_msCoverageSdkNETCoreSdkVersion.Split('-')[0]) <_msCoverageSdkMinVersionWithDependencyTarget>6.0.100 @@ -34,7 +34,7 @@ - + Date: Thu, 29 Aug 2024 11:00:52 +0200 Subject: [PATCH 40/94] Forward error output from testhost as info (#5192) --- .../Hosting/TestHostManagerCallbacks.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/TestHostManagerCallbacks.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/TestHostManagerCallbacks.cs index 9709607005..645db3c0a2 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/TestHostManagerCallbacks.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/TestHostManagerCallbacks.cs @@ -58,7 +58,9 @@ public void ErrorReceivedCallback(StringBuilder testHostProcessStdError, string? testHostProcessStdError.AppendSafeWithNewLine(data); if (_forwardOutput && _messageLogger != null && !StringUtils.IsNullOrWhiteSpace(data)) { - _messageLogger.SendMessage(TestMessageLevel.Error, data); + // Forward the error output, but DO NOT forward it as error. Until now it was only written into logs, + // and applications love to write Debug messages into error stream. Which we do not want to fail the test run. + _messageLogger.SendMessage(TestMessageLevel.Informational, data); } } From c056ac5d16e54dd3416db13fd3e5da97dc2df9ef Mon Sep 17 00:00:00 2001 From: Pavel Horak <22235234+pavelhorak@users.noreply.github.com> Date: Thu, 5 Sep 2024 11:40:51 +0200 Subject: [PATCH 41/94] Update AzureDevOps.yml (#5249) Replacing usage of PAT with Entra ID service principal via federated identity --- .github/workflows/AzureDevOps.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/AzureDevOps.yml b/.github/workflows/AzureDevOps.yml index d497856f1e..2b75d1e2c8 100644 --- a/.github/workflows/AzureDevOps.yml +++ b/.github/workflows/AzureDevOps.yml @@ -4,20 +4,43 @@ on: issues: types: [labeled] #, opened, edited, deleted, closed, reopened, labeled, unlabeled, assigned + issue_comment: + types: [created, edited, deleted] + +concurrency: + group: issue-${{ github.event.issue.number }} + cancel-in-progress: false + +# Extra permissions needed to login with Entra ID service principal via federated identity +permissions: + id-token: write + issues: write jobs: updateAzDO: if: github.event.label.name == 'sprint' runs-on: ubuntu-latest steps: + - name: Login to Azure + uses: azure/login@v2 + with: + client-id: ${{ secrets.ENTRA_APP_CLIENT_ID }} + tenant-id: ${{ secrets.ENTRA_APP_TENANT_ID }} + allow-no-subscriptions: true + - name: Get Azure DevOps token + id: get_ado_token + run: + # The resource ID for Azure DevOps is always 499b84ac-1321-427f-aa17-267ca6975798 + # https://learn.microsoft.com/azure/devops/integrate/get-started/authentication/service-principal-managed-identity + echo "ado_token=$(az account get-access-token --resource 499b84ac-1321-427f-aa17-267ca6975798 --query "accessToken" --output tsv)" >> $GITHUB_ENV - uses: pavelhorak/github-actions-issue-to-work-item@main env: - ado_token: "${{ secrets.ADO_PERSONAL_ACCESS_TOKEN }}" + ado_token: "${{ env.ado_token }}" github_token: "${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}" ado_organization: "${{ secrets.ADO_ORGANIZATION }}" ado_project: "${{ secrets.ADO_PROJECT }}" ado_area_path: "${{ secrets.ADO_AREA_PATH }}" - ado_iteration_path: "${{ secrets.ADO_ITERATION_PATH }}" # this doesn't work: "@CurrentIteration('[DevDiv]\\.NET DevExp Prague')" + ado_iteration_path: "${{ secrets.ADO_ITERATION_PATH }}" ado_wit: "User Story" ado_new_state: "Committed" ado_active_state: "In Progress" From fc564d9833a2ae822880aed15998d274ebe045a4 Mon Sep 17 00:00:00 2001 From: Pavel Horak <22235234+pavelhorak@users.noreply.github.com> Date: Mon, 9 Sep 2024 09:57:29 +0200 Subject: [PATCH 42/94] Update AzureDevOps.yml (#8858) added environment value needed to Federated Credential --- .github/workflows/AzureDevOps.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/AzureDevOps.yml b/.github/workflows/AzureDevOps.yml index 2b75d1e2c8..ec1dd85b71 100644 --- a/.github/workflows/AzureDevOps.yml +++ b/.github/workflows/AzureDevOps.yml @@ -20,6 +20,7 @@ jobs: updateAzDO: if: github.event.label.name == 'sprint' runs-on: ubuntu-latest + environment: ado steps: - name: Login to Azure uses: azure/login@v2 From 96977dbeec2d51f920338c303eba8c23bafb35b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 11 Sep 2024 11:03:41 +0200 Subject: [PATCH 43/94] Update Microsoft.Extensions.DependencyModel to 3.1.0 (#5188) * Update Microsoft.Extensions.DependencyModel to 3.1.0 * sb * sb * dep * add to prebuilts --- eng/SourceBuildPrebuiltBaseline.xml | 1 + eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/eng/SourceBuildPrebuiltBaseline.xml b/eng/SourceBuildPrebuiltBaseline.xml index 2ecba660e9..f0d724be70 100644 --- a/eng/SourceBuildPrebuiltBaseline.xml +++ b/eng/SourceBuildPrebuiltBaseline.xml @@ -18,5 +18,6 @@ + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7cae1aa1c9..144ab0666f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -33,8 +33,8 @@ 30ab651fcb4354552bd4891619a0bdd81e0ebdbf - - https://github.com/dotnet/core-setup + + https://github.com/dotnet/runtime 7d57652f33493fa022125b7f63aad0d70c52d810 diff --git a/eng/Versions.props b/eng/Versions.props index 899a093382..88e5ef1f8f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -41,7 +41,7 @@ 3.11.0-beta1.23525.2 17.7.0 0.2.0-preview.24416.1 - 3.0.0 + 3.1.0 2.0.0 17.9.0-beta.24058.4 17.12.0-preview.24409.2 From 1eb6f23d7739d540ca479b5c031c5fbbb5458a26 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Wed, 18 Sep 2024 09:03:47 -0700 Subject: [PATCH 44/94] ExcludeFromSourceBuild->ExcludeFromSourceOnlyBuild (#10354) --- playground/Directory.Build.props | 2 +- samples/Directory.Build.props | 2 +- src/AttachVS/AttachVS.csproj | 2 +- src/DataCollectors/DumpMinitool.arm64/DumpMinitool.arm64.csproj | 2 +- src/DataCollectors/DumpMinitool.x86/DumpMinitool.x86.csproj | 2 +- src/DataCollectors/DumpMinitool/DumpMinitool.csproj | 2 +- src/package/Directory.Build.props | 2 +- .../Microsoft.TestPlatform.CLI.csproj | 2 +- .../Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI.csproj | 2 +- test/Directory.Build.props | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/playground/Directory.Build.props b/playground/Directory.Build.props index 60fd349d0a..6f5b8d7bf3 100644 --- a/playground/Directory.Build.props +++ b/playground/Directory.Build.props @@ -2,6 +2,6 @@ - true + true diff --git a/samples/Directory.Build.props b/samples/Directory.Build.props index 60fd349d0a..6f5b8d7bf3 100644 --- a/samples/Directory.Build.props +++ b/samples/Directory.Build.props @@ -2,6 +2,6 @@ - true + true diff --git a/src/AttachVS/AttachVS.csproj b/src/AttachVS/AttachVS.csproj index 621a7d9654..480945c0e3 100644 --- a/src/AttachVS/AttachVS.csproj +++ b/src/AttachVS/AttachVS.csproj @@ -4,7 +4,7 @@ Exe net7;net472 AttachVS - true + true diff --git a/src/DataCollectors/DumpMinitool.arm64/DumpMinitool.arm64.csproj b/src/DataCollectors/DumpMinitool.arm64/DumpMinitool.arm64.csproj index 1efec3f46e..1163b54034 100644 --- a/src/DataCollectors/DumpMinitool.arm64/DumpMinitool.arm64.csproj +++ b/src/DataCollectors/DumpMinitool.arm64/DumpMinitool.arm64.csproj @@ -11,7 +11,7 @@ so order here matters. --> AnyCPU false - true + true - false + false $(OutputPath) Microsoft.TestPlatform.CLI vstest visual-studio unittest testplatform mstest microsoft test testing diff --git a/src/package/Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI/Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI.csproj b/src/package/Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI/Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI.csproj index f711b8068a..c2fb1120e9 100644 --- a/src/package/Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI/Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI.csproj +++ b/src/package/Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI/Microsoft.VisualStudio.TestTools.TestPlatform.V2.CLI.csproj @@ -11,7 +11,7 @@ - true + true false false false diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 60fd349d0a..6f5b8d7bf3 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -2,6 +2,6 @@ - true + true From 4f16fc041b85e102c7ee783ed4124d733d067c74 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 14:40:42 +0200 Subject: [PATCH 45/94] [main] Update dependencies from devdiv/DevDiv/vs-code-coverage (#10353) * Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20240916.3 Microsoft.Internal.CodeCoverage From Version 17.12.0-preview.24409.2 -> To Version 17.12.5-preview.24466.3 * Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20240923.1 Microsoft.Internal.CodeCoverage From Version 17.12.5-preview.24466.3 -> To Version 17.12.5-preview.24473.1 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 144ab0666f..058a1acddf 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage - 2fabb6cdbce2e64fa7a9dc483991f6ce475ab334 + f14ac991b7cd6ee20b87f8721ef561aee3f07451 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index 88e5ef1f8f..242855a5f8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -44,7 +44,7 @@ 3.1.0 2.0.0 17.9.0-beta.24058.4 - 17.12.0-preview.24409.2 + 17.12.5-preview.24473.1 17.10.34924.118 $(MicrosoftVisualStudioDiagnosticsUtilitiesVersion) 17.10.525-preview.1 From 09b76005ba2026b27b8272f1230a136ebd618ac2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 14:34:32 +0200 Subject: [PATCH 46/94] [main] Update dependencies from devdiv/DevDiv/vs-code-coverage (#10360) * Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20240930.1 Microsoft.Internal.CodeCoverage From Version 17.12.5-preview.24473.1 -> To Version 17.12.5-preview.24480.1 * Using latest stable version of code coverage, * fix, --------- Co-authored-by: dotnet-maestro[bot] Co-authored-by: fhnaseer --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 058a1acddf..17c42d33bd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage - f14ac991b7cd6ee20b87f8721ef561aee3f07451 + aaf54e61f7eebd65bb437a4a9643bf7976311f2b https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index 242855a5f8..f522e9ed74 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -44,7 +44,7 @@ 3.1.0 2.0.0 17.9.0-beta.24058.4 - 17.12.5-preview.24473.1 + 17.12.5 17.10.34924.118 $(MicrosoftVisualStudioDiagnosticsUtilitiesVersion) 17.10.525-preview.1 From ec81d7d38cfea9a894426c515baa9593affcc8c6 Mon Sep 17 00:00:00 2001 From: Jakub Chocholowicz <59966772+jakubch1@users.noreply.github.com> Date: Wed, 2 Oct 2024 21:43:19 +0200 Subject: [PATCH 47/94] Enable policheck (#10363) --- azure-pipelines-official.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index f11577b7dd..2ed70e75da 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -120,6 +120,9 @@ resources: extends: template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates parameters: + sdl: + policheck: + enabled: true pool: name: $(DncEngInternalBuildPool) image: 1es-windows-2022 From c02e98d3342b63085ffc57ac6796d6a2cbe3d2c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Thu, 3 Oct 2024 10:52:20 +0200 Subject: [PATCH 48/94] Update diagnose.md --- docs/diagnose.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/diagnose.md b/docs/diagnose.md index 6956fd5401..cd7a965ab2 100644 --- a/docs/diagnose.md +++ b/docs/diagnose.md @@ -139,3 +139,19 @@ Copyright (c) Microsoft Corporation. All rights reserved. Starting test execution, please wait... Host debugging is enabled. Please attach debugger to testhost process to continue. ``` + +## In Visual Studio + +Set test logging to trace: + +![image](https://github.com/user-attachments/assets/0ee53d10-4f95-469a-91bd-8577d79b99bc) + +Run your tests. + +Go to Output > Tests window: + +Please provide all files from the listed folder, and complete content of the Tests window. + +![image](https://github.com/user-attachments/assets/c942642d-e10a-4bf3-9920-8ddd22d99ba8) + + From 5e82d232be9785e121299d311a1dca3a48f532ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Thu, 3 Oct 2024 16:54:38 +0200 Subject: [PATCH 49/94] Convert to auto property (#10365) * Convert to auto property * Another field * revert * suppress --- .editorconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index b78e7a35b8..39f9dc14c9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -105,8 +105,8 @@ dotnet_style_prefer_compound_assignment = true:warning # not default, default i dotnet_diagnostic.IDE0074.severity = warning # not default, set in accordance to previous setting # IDE0032: Use auto property -dotnet_style_prefer_auto_properties = true:warning # not default, default is true:suggestion, increased severity to ensure it is used -dotnet_diagnostic.IDE0032.severity = warning # not default, set in accordance to previous setting +dotnet_style_prefer_auto_properties = true:suggestion # not default, default is true:suggestion, increased severity to ensure it is used +dotnet_diagnostic.IDE0032.severity = suggestion # not default, set in accordance to previous setting # Field preferences dotnet_style_readonly_field = true:warning From 84d23e34f7dfd6ba566183f2ff1a532985b04bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Fri, 4 Oct 2024 16:40:39 +0200 Subject: [PATCH 50/94] Update Versions.props (#10378) Update branding to 17.13 --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index f522e9ed74..42d025050e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -13,7 +13,7 @@ from appending +, which breaks DTAAgent. --> false - 17.12.0 + 17.13.0 preview From 4e244e1ab9d7122046b88b30f6e93e5a88a069da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 9 Oct 2024 15:25:47 +0200 Subject: [PATCH 51/94] Downgrade xunit skip warning to info (#10381) --- src/vstest.console/Internal/MSBuildLogger.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/vstest.console/Internal/MSBuildLogger.cs b/src/vstest.console/Internal/MSBuildLogger.cs index 7a087592eb..691236db32 100644 --- a/src/vstest.console/Internal/MSBuildLogger.cs +++ b/src/vstest.console/Internal/MSBuildLogger.cs @@ -78,7 +78,15 @@ private void TestMessageHandler(object? sender, TestRunMessageEventArgs e) SendMessage($"output-info", e.Message); break; case TestMessageLevel.Warning: - SendMessage($"output-warning", e.Message); + // Downgrade xUnit skip warning to info, otherwise any skipped test will report warning, which is often upgraded to error. + if (e.Message.EndsWith("[SKIP]")) + { + SendMessage($"output-info", e.Message); + } + else + { + SendMessage($"output-warning", e.Message); + } break; case TestMessageLevel.Error: SendMessage($"output-error", e.Message); From ba273e1848c009dd0cd5517e483505830b615712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 9 Oct 2024 16:27:48 +0200 Subject: [PATCH 52/94] Add msdia for arm64 into nuget (#10382) --- eng/verify-nupkgs.ps1 | 2 +- .../Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/verify-nupkgs.ps1 b/eng/verify-nupkgs.ps1 index b3698ce7cc..e6d54183c1 100644 --- a/eng/verify-nupkgs.ps1 +++ b/eng/verify-nupkgs.ps1 @@ -19,7 +19,7 @@ function Verify-Nuget-Packages { $expectedNumOfFiles = @{ "Microsoft.CodeCoverage" = 59; "Microsoft.NET.Test.Sdk" = 15; - "Microsoft.TestPlatform" = 608; + "Microsoft.TestPlatform" = 609; "Microsoft.TestPlatform.Build" = 20; "Microsoft.TestPlatform.CLI" = 471; "Microsoft.TestPlatform.Extensions.TrxLogger" = 34; diff --git a/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec b/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec index 921d46e25c..9ccf7d60c4 100644 --- a/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec +++ b/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec @@ -284,6 +284,7 @@ + From a736e4d52fa3a902c8519a67f14abdf34df35985 Mon Sep 17 00:00:00 2001 From: Jakub Chocholowicz <59966772+jakubch1@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:18:17 +0200 Subject: [PATCH 53/94] Enable TSA (#10385) --- .config/tsaoptions.json | 10 ++++++++++ azure-pipelines-official.yml | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 .config/tsaoptions.json diff --git a/.config/tsaoptions.json b/.config/tsaoptions.json new file mode 100644 index 0000000000..f4bedc3725 --- /dev/null +++ b/.config/tsaoptions.json @@ -0,0 +1,10 @@ +{ + "instanceUrl": "https://devdiv.visualstudio.com/", + "template": "TFSDEVDIV", + "projectName": "DEVDIV", + "areaPath": "DevDiv\\Testing Platforms\\VSTest", + "iterationPath": "DevDiv", + "notificationAliases": [ "dotnetdevexprague@microsoft.com" ], + "repositoryName":"vstest", + "codebaseName": "vstest" +} diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 2ed70e75da..74309bc0ae 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -123,6 +123,8 @@ extends: sdl: policheck: enabled: true + tsa: + enabled: true pool: name: $(DncEngInternalBuildPool) image: 1es-windows-2022 From a5745bc80d39b689aebcb622cfbab40a26d333f2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 11:38:59 +0200 Subject: [PATCH 54/94] Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20241013.1 (#10389) Microsoft.Internal.CodeCoverage From Version 17.12.5 -> To Version 17.13.0-preview.24513.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 17c42d33bd..96463bfd85 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage - aaf54e61f7eebd65bb437a4a9643bf7976311f2b + 16a7c15ea661cd431732189bc3bffa79644dc0cb https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index 42d025050e..90be62df7a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -44,7 +44,7 @@ 3.1.0 2.0.0 17.9.0-beta.24058.4 - 17.12.5 + 17.13.0-preview.24513.1 17.10.34924.118 $(MicrosoftVisualStudioDiagnosticsUtilitiesVersion) 17.10.525-preview.1 From d44d08b0ba09889633c73d5627d459edd8f654af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Mon, 14 Oct 2024 18:06:39 +0200 Subject: [PATCH 55/94] Arm64 dia (#10390) * Revert "Add msdia for arm64 into nuget (#10382)" This reverts commit ba273e1848c009dd0cd5517e483505830b615712. * Add arm64 --- .../Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec b/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec index 9ccf7d60c4..569b7be7d9 100644 --- a/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec +++ b/src/package/Microsoft.TestPlatform/Microsoft.TestPlatform.nuspec @@ -284,7 +284,6 @@ - @@ -414,6 +413,7 @@ + From d68194caa414a35f95315c150f86b7bcf11f1793 Mon Sep 17 00:00:00 2001 From: Michael Simons Date: Wed, 16 Oct 2024 10:16:47 -0500 Subject: [PATCH 56/94] Update source-build team references (#10388) --- eng/DotNetBuild.props | 2 +- eng/SourceBuildPrebuiltBaseline.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/DotNetBuild.props b/eng/DotNetBuild.props index 7b80f43420..ca7b2fbbeb 100644 --- a/eng/DotNetBuild.props +++ b/eng/DotNetBuild.props @@ -1,4 +1,4 @@ - + diff --git a/eng/SourceBuildPrebuiltBaseline.xml b/eng/SourceBuildPrebuiltBaseline.xml index f0d724be70..0503321d03 100644 --- a/eng/SourceBuildPrebuiltBaseline.xml +++ b/eng/SourceBuildPrebuiltBaseline.xml @@ -1,4 +1,4 @@ - + From 04f230cb0625f3beb27dbf95cb6190605c62fb85 Mon Sep 17 00:00:00 2001 From: Eric Bouchard Date: Wed, 23 Oct 2024 11:07:35 -0400 Subject: [PATCH 57/94] Enable native debugging for vstest.console (#10401) --- .../WellKnownDebugEnvironmentVariables.cs | 1 + src/vstest.console/CommandLine/Executor.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Microsoft.TestPlatform.Execution.Shared/WellKnownDebugEnvironmentVariables.cs b/src/Microsoft.TestPlatform.Execution.Shared/WellKnownDebugEnvironmentVariables.cs index 83402bceb7..61fe4fa054 100644 --- a/src/Microsoft.TestPlatform.Execution.Shared/WellKnownDebugEnvironmentVariables.cs +++ b/src/Microsoft.TestPlatform.Execution.Shared/WellKnownDebugEnvironmentVariables.cs @@ -13,4 +13,5 @@ internal static class WellKnownDebugEnvironmentVariables public const string VSTEST_HOST_DEBUG_ATTACHVS = nameof(VSTEST_HOST_DEBUG_ATTACHVS); public const string VSTEST_RUNNER_DEBUG_ATTACHVS = nameof(VSTEST_RUNNER_DEBUG_ATTACHVS); public const string VSTEST_HOST_NATIVE_DEBUG = nameof(VSTEST_HOST_NATIVE_DEBUG); + public const string VSTEST_RUNNER_NATIVE_DEBUG = nameof(VSTEST_RUNNER_NATIVE_DEBUG); } diff --git a/src/vstest.console/CommandLine/Executor.cs b/src/vstest.console/CommandLine/Executor.cs index 951a4166e1..a153dd4957 100644 --- a/src/vstest.console/CommandLine/Executor.cs +++ b/src/vstest.console/CommandLine/Executor.cs @@ -91,6 +91,7 @@ internal class Executor internal Executor(IOutput output, ITestPlatformEventSource testPlatformEventSource, IProcessHelper processHelper, IEnvironment environment) { DebuggerBreakpoint.AttachVisualStudioDebugger(WellKnownDebugEnvironmentVariables.VSTEST_RUNNER_DEBUG_ATTACHVS); + DebuggerBreakpoint.WaitForNativeDebugger(WellKnownDebugEnvironmentVariables.VSTEST_RUNNER_NATIVE_DEBUG); DebuggerBreakpoint.WaitForDebugger(WellKnownDebugEnvironmentVariables.VSTEST_RUNNER_DEBUG); Output = output; From e621c399fe4edffbcea24aa67cf8de34d1548c83 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:10:17 +0200 Subject: [PATCH 58/94] [main] Update dependencies from dotnet/diagnostics (#5187) --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 96463bfd85..e990ce7387 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,14 +5,14 @@ https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage 16a7c15ea661cd431732189bc3bffa79644dc0cb - + https://github.com/dotnet/diagnostics - 513150c2f25077b1fcb194407e53c433c975f39b + 335c0c013c3a761792bfa83c0dbaadd1f0545f07 - + https://github.com/dotnet/diagnostics - 513150c2f25077b1fcb194407e53c433c975f39b + 335c0c013c3a761792bfa83c0dbaadd1f0545f07 diff --git a/eng/Versions.props b/eng/Versions.props index 90be62df7a..4dce7a746c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -40,7 +40,7 @@ 3.11.0-beta1.23525.2 3.11.0-beta1.23525.2 17.7.0 - 0.2.0-preview.24416.1 + 0.2.0-preview.24520.1 3.1.0 2.0.0 17.9.0-beta.24058.4 From eb00b269d6b8734597b8ea888219e105144e7794 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:10:34 +0200 Subject: [PATCH 59/94] [main] Update dependencies from dotnet/source-build-externals (#5186) --- eng/Version.Details.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e990ce7387..7996ad90e0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -16,9 +16,9 @@ - + https://github.com/dotnet/source-build-externals - 2cef086137a68586fdd69848261e2a8cf8c48b73 + 4df883d781a4290873b3b968afc0ff0df7132507 From dfd8d91012b4021e6ee1379ef9144e35374b9b44 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:52:16 +0200 Subject: [PATCH 60/94] Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20241018.1 (#10400) Microsoft.Internal.CodeCoverage From Version 17.13.0-preview.24513.1 -> To Version 17.13.0-preview.24518.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7996ad90e0..5c7b25448c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage - 16a7c15ea661cd431732189bc3bffa79644dc0cb + 30b8eb1de4e5da999af0b9d03a30e5897ae5e8d6 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index 4dce7a746c..3c59ea5403 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -44,7 +44,7 @@ 3.1.0 2.0.0 17.9.0-beta.24058.4 - 17.13.0-preview.24513.1 + 17.13.0-preview.24518.1 17.10.34924.118 $(MicrosoftVisualStudioDiagnosticsUtilitiesVersion) 17.10.525-preview.1 From 32698454421738e51370c86cfd272e58464a0dce Mon Sep 17 00:00:00 2001 From: Ella Hathaway <67609881+ellahathaway@users.noreply.github.com> Date: Thu, 7 Nov 2024 12:54:57 -0800 Subject: [PATCH 61/94] Exclude .signature.p7s from nupkg file count (#10418) --- eng/verify-nupkgs.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/verify-nupkgs.ps1 b/eng/verify-nupkgs.ps1 index e6d54183c1..6fb1274ada 100644 --- a/eng/verify-nupkgs.ps1 +++ b/eng/verify-nupkgs.ps1 @@ -84,7 +84,7 @@ function Verify-Nuget-Packages { $packageKey = $packageBaseName.Replace([string]".$version", [string]"") Write-Host "Verifying package '$packageBaseName'." - $actualNumOfFiles = (Get-ChildItem -Recurse -File -Path $unzipNugetPackageDir).Count + $actualNumOfFiles = (Get-ChildItem -Recurse -File -Path $unzipNugetPackageDir | Where-Object { $_.Name -ne '.signature.p7s' }).Count if (-not $expectedNumOfFiles.ContainsKey($packageKey)) { $errors += "Package '$packageKey' is not present in file expectedNumOfFiles table. Is that package known?" continue From b03d1cd9b93717829f878c4a5743e4bb1a441967 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Tue, 12 Nov 2024 10:33:22 +0100 Subject: [PATCH 62/94] Fix RFCs links (#10424) --- .../ManagedNameHelper.Reflection.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameHelper.Reflection.cs b/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameHelper.Reflection.cs index d8eefb9288..cead7a6b1d 100644 --- a/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameHelper.Reflection.cs +++ b/src/Microsoft.TestPlatform.AdapterUtilities/ManagedNameUtilities/ManagedNameHelper.Reflection.cs @@ -22,12 +22,12 @@ public static partial class ManagedNameHelper /// /// When this method returns, contains the fully qualified managed type name of the . /// This parameter is passed uninitialized; any value originally supplied in result will be overwritten. - /// The format is defined in the RFC. + /// The format is defined in the RFC. /// /// /// When this method returns, contains the fully qualified managed method name of the . /// This parameter is passed uninitialized; any value originally supplied in result will be overwritten. - /// The format is defined in the RFC. + /// The format is defined in the RFC. /// /// /// is null. @@ -40,7 +40,7 @@ public static partial class ManagedNameHelper /// /// /// More information about and can be found in - /// the RFC. + /// the RFC. /// public static void GetManagedName(MethodBase method, out string managedTypeName, out string managedMethodName) => GetManagedNameAndHierarchy(method, false, out managedTypeName, out managedMethodName, out _); @@ -54,12 +54,12 @@ public static void GetManagedName(MethodBase method, out string managedTypeName, /// /// When this method returns, contains the fully qualified managed type name of the . /// This parameter is passed uninitialized; any value originally supplied in result will be overwritten. - /// The format is defined in the RFC. + /// The format is defined in the RFC. /// /// /// When this method returns, contains the fully qualified managed method name of the . /// This parameter is passed uninitialized; any value originally supplied in result will be overwritten. - /// The format is defined in the RFC. + /// The format is defined in the RFC. /// /// /// When this method returns, contains the default test hierarchy values of the . @@ -76,7 +76,7 @@ public static void GetManagedName(MethodBase method, out string managedTypeName, /// /// /// More information about and can be found in - /// the RFC. + /// the RFC. /// public static void GetManagedName(MethodBase method, out string managedTypeName, out string managedMethodName, out string?[] hierarchyValues) { @@ -213,11 +213,11 @@ private static void GetManagedNameAndHierarchy(MethodBase method, bool useClosed /// /// /// The fully qualified managed name of the type. - /// The format is defined in the RFC. + /// The format is defined in the RFC. /// /// /// The fully qualified managed name of the method. - /// The format is defined in the RFC. + /// The format is defined in the RFC. /// /// /// A object that represents specified parameters, throws if null. @@ -228,7 +228,7 @@ private static void GetManagedNameAndHierarchy(MethodBase method, bool useClosed /// /// /// More information about and can be found in - /// the RFC. + /// the RFC. /// public static MethodBase GetMethod(Assembly assembly, string managedTypeName, string managedMethodName) { From 4429079587192ccd9089fb3f44cadf39bd551da5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:19:17 +0100 Subject: [PATCH 63/94] [main] Update dependencies from dotnet/diagnostics (#10404) * Update dependencies from https://github.com/dotnet/diagnostics build 20241027.1 Microsoft.SourceBuild.Intermediate.diagnostics , Microsoft.Diagnostics.NETCore.Client From Version 8.0.0-preview.24520.1 -> To Version 8.0.0-preview.24527.1 * Update dependencies from https://github.com/dotnet/diagnostics build 20241103.1 Microsoft.SourceBuild.Intermediate.diagnostics , Microsoft.Diagnostics.NETCore.Client From Version 8.0.0-preview.24520.1 -> To Version 9.0.0-preview.24553.1 * Update dependencies from https://github.com/dotnet/diagnostics build 20241110.1 Microsoft.SourceBuild.Intermediate.diagnostics , Microsoft.Diagnostics.NETCore.Client From Version 8.0.0-preview.24520.1 -> To Version 9.0.0-preview.24560.1 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5c7b25448c..7935580168 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,14 +5,14 @@ https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage 30b8eb1de4e5da999af0b9d03a30e5897ae5e8d6 - + https://github.com/dotnet/diagnostics - 335c0c013c3a761792bfa83c0dbaadd1f0545f07 + 141a406a4c74d9ff6d6452dc999f78c08eee49a0 - + https://github.com/dotnet/diagnostics - 335c0c013c3a761792bfa83c0dbaadd1f0545f07 + 141a406a4c74d9ff6d6452dc999f78c08eee49a0 diff --git a/eng/Versions.props b/eng/Versions.props index 3c59ea5403..b6a45646dd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -40,7 +40,7 @@ 3.11.0-beta1.23525.2 3.11.0-beta1.23525.2 17.7.0 - 0.2.0-preview.24520.1 + 0.2.0-preview.24560.1 3.1.0 2.0.0 17.9.0-beta.24058.4 From b4e4d7d6b3f7a35ab7baeb04dec54490652dbbe8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 18:34:29 +0100 Subject: [PATCH 64/94] [main] Update dependencies from dotnet/source-build-reference-packages (#5145) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240712.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24352.1 -> To Version 9.0.0-alpha.1.24362.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240715.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24352.1 -> To Version 9.0.0-alpha.1.24365.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240724.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24352.1 -> To Version 9.0.0-alpha.1.24374.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240805.2 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24374.1 -> To Version 9.0.0-alpha.1.24405.2 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240815.3 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24405.2 -> To Version 10.0.0-alpha.1.24415.3 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240819.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 10.0.0-alpha.1.24415.3 -> To Version 10.0.0-alpha.1.24419.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240821.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 10.0.0-alpha.1.24419.1 -> To Version 10.0.0-alpha.1.24421.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240828.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 10.0.0-alpha.1.24421.1 -> To Version 10.0.0-alpha.1.24428.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240905.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 10.0.0-alpha.1.24428.1 -> To Version 10.0.0-alpha.1.24455.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240909.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 10.0.0-alpha.1.24455.1 -> To Version 10.0.0-alpha.1.24459.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240917.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 10.0.0-alpha.1.24459.1 -> To Version 10.0.0-alpha.1.24467.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240923.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 10.0.0-alpha.1.24467.1 -> To Version 10.0.0-alpha.1.24473.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20241004.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 10.0.0-alpha.1.24473.1 -> To Version 10.0.0-alpha.1.24504.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20241007.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 10.0.0-alpha.1.24504.1 -> To Version 10.0.0-alpha.1.24507.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20241011.4 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 10.0.0-alpha.1.24507.1 -> To Version 10.0.0-alpha.1.24511.4 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20241015.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 10.0.0-alpha.1.24511.4 -> To Version 10.0.0-alpha.1.24515.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20241021.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24352.1 -> To Version 10.0.0-alpha.1.24521.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20241030.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24352.1 -> To Version 10.0.0-alpha.1.24530.1 * prebuilt * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20241108.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24352.1 -> To Version 10.0.0-alpha.1.24558.1 --------- Co-authored-by: dotnet-maestro[bot] Co-authored-by: Jakub Jareš --- eng/SourceBuildPrebuiltBaseline.xml | 2 ++ eng/Version.Details.xml | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/eng/SourceBuildPrebuiltBaseline.xml b/eng/SourceBuildPrebuiltBaseline.xml index 0503321d03..60430ce23a 100644 --- a/eng/SourceBuildPrebuiltBaseline.xml +++ b/eng/SourceBuildPrebuiltBaseline.xml @@ -18,6 +18,8 @@ + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7935580168..97f71a8692 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -22,9 +22,9 @@ - + https://github.com/dotnet/source-build-reference-packages - cc732c57199f725857c201da146525e3be6bc504 + 1ebd9ce245112164207d961c0d2faea741c7c489 From 7892673cf1302662e4aee495628a25dd6e32ef0d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 16:37:35 +0100 Subject: [PATCH 65/94] [main] Update dependencies from devdiv/DevDiv/vs-code-coverage (#10405) * Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20241022.1 Microsoft.Internal.CodeCoverage From Version 17.13.0-preview.24518.1 -> To Version 17.13.0-preview.24522.1 * Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20241101.2 Microsoft.Internal.CodeCoverage From Version 17.13.0-preview.24518.1 -> To Version 17.13.0-preview.24551.2 * Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20241107.5 Microsoft.Internal.CodeCoverage From Version 17.13.0-preview.24518.1 -> To Version 17.13.0-preview.24557.5 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 97f71a8692..9f5178f671 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage - 30b8eb1de4e5da999af0b9d03a30e5897ae5e8d6 + 5511d9f5b22a1f2203b8ad003998bace35b2a543 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index b6a45646dd..c0f9f4c060 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -44,7 +44,7 @@ 3.1.0 2.0.0 17.9.0-beta.24058.4 - 17.13.0-preview.24518.1 + 17.13.0-preview.24557.5 17.10.34924.118 $(MicrosoftVisualStudioDiagnosticsUtilitiesVersion) 17.10.525-preview.1 From 969c298adda05f6847b762a95a860eaab7fdd4f0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:03:32 +0100 Subject: [PATCH 66/94] [main] Update dependencies from dotnet/arcade (#10359) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update dependencies from https://github.com/dotnet/arcade build 20240903.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24408.2 -> To Version 9.0.0-beta.24453.1 * Update dependencies from https://github.com/dotnet/arcade build 20240913.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24453.1 -> To Version 9.0.0-beta.24463.2 * Update dependencies from https://github.com/dotnet/arcade build 20240916.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24463.2 -> To Version 9.0.0-beta.24466.2 * Update dependencies from https://github.com/dotnet/arcade build 20240923.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24466.2 -> To Version 9.0.0-beta.24473.1 * Update dependencies from https://github.com/dotnet/arcade build 20241003.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24473.1 -> To Version 9.0.0-beta.24503.2 * Update dependencies from https://github.com/dotnet/arcade build 20241009.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24503.2 -> To Version 9.0.0-beta.24509.3 * Update dependencies from https://github.com/dotnet/arcade build 20241016.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24509.3 -> To Version 9.0.0-beta.24516.2 * Update to net9 * Revert "Update to net9" This reverts commit 14585862f62cd0531e8bad668921d3355fe96e65. * Update * tl false * linebreak in multiline * terminal output --------- Co-authored-by: dotnet-maestro[bot] Co-authored-by: Jakub Jareš --- eng/Version.Details.xml | 12 +-- eng/common/SetupNugetSources.ps1 | 2 +- eng/common/SetupNugetSources.sh | 2 +- eng/common/core-templates/job/job.yml | 5 - .../steps/get-delegation-sas.yml | 11 ++- eng/common/internal/Tools.csproj | 1 + eng/common/templates-official/job/job.yml | 15 +++ eng/common/templates/job/job.yml | 97 +++++++++---------- eng/common/tools.ps1 | 2 +- global.json | 6 +- .../DotnetTestMSBuildOutputTests.cs | 11 +-- .../IntegrationTestBase.cs | 2 +- 12 files changed, 88 insertions(+), 78 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9f5178f671..3708dfcbf7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -44,14 +44,14 @@ - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d @@ -62,9 +62,9 @@ https://github.com/dotnet/symreader-converter c5ba7c88f92e2dde156c324a8c8edc04d9fa4fe0 - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index 2b0a5c9e66..5db4ad71ee 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -157,7 +157,7 @@ if ($dotnet31Source -ne $null) { AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password } -$dotnetVersions = @('5','6','7','8') +$dotnetVersions = @('5','6','7','8','9') foreach ($dotnetVersion in $dotnetVersions) { $feedPrefix = "dotnet" + $dotnetVersion; diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index b493479a1d..4604b61b03 100644 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -99,7 +99,7 @@ if [ "$?" == "0" ]; then PackageSources+=('dotnet3.1-internal-transport') fi -DotNetVersions=('5' '6' '7' '8') +DotNetVersions=('5' '6' '7' '8' '9') for DotNetVersion in ${DotNetVersions[@]} ; do FeedPrefix="dotnet${DotNetVersion}"; diff --git a/eng/common/core-templates/job/job.yml b/eng/common/core-templates/job/job.yml index c732bee9f4..ba53ebfbd5 100644 --- a/eng/common/core-templates/job/job.yml +++ b/eng/common/core-templates/job/job.yml @@ -33,11 +33,6 @@ parameters: artifactPublishSteps: [] runAsPublic: false -# Sbom related params - enableSbom: true - PackageVersion: 9.0.0 - BuildDropPath: '$(Build.SourcesDirectory)/artifacts' - # 1es specific parameters is1ESPipeline: '' diff --git a/eng/common/core-templates/steps/get-delegation-sas.yml b/eng/common/core-templates/steps/get-delegation-sas.yml index d2901470a7..9db5617ea7 100644 --- a/eng/common/core-templates/steps/get-delegation-sas.yml +++ b/eng/common/core-templates/steps/get-delegation-sas.yml @@ -31,7 +31,16 @@ steps: # Calculate the expiration of the SAS token and convert to UTC $expiry = (Get-Date).AddHours(${{ parameters.expiryInHours }}).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") - $sas = az storage container generate-sas --account-name ${{ parameters.storageAccount }} --name ${{ parameters.container }} --permissions ${{ parameters.permissions }} --expiry $expiry --auth-mode login --as-user -o tsv + # Temporarily work around a helix issue where SAS tokens with / in them will cause incorrect downloads + # of correlation payloads. https://github.com/dotnet/dnceng/issues/3484 + $sas = "" + do { + $sas = az storage container generate-sas --account-name ${{ parameters.storageAccount }} --name ${{ parameters.container }} --permissions ${{ parameters.permissions }} --expiry $expiry --auth-mode login --as-user -o tsv + if ($LASTEXITCODE -ne 0) { + Write-Error "Failed to generate SAS token." + exit 1 + } + } while($sas.IndexOf('/') -ne -1) if ($LASTEXITCODE -ne 0) { Write-Error "Failed to generate SAS token." diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj index e925952d56..32f79dfb34 100644 --- a/eng/common/internal/Tools.csproj +++ b/eng/common/internal/Tools.csproj @@ -4,6 +4,7 @@ net472 false + false diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml index 0c2928d5c7..605692d2fb 100644 --- a/eng/common/templates-official/job/job.yml +++ b/eng/common/templates-official/job/job.yml @@ -1,8 +1,23 @@ +parameters: +# Sbom related params + enableSbom: true + runAsPublic: false + PackageVersion: 9.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + jobs: - template: /eng/common/core-templates/job/job.yml parameters: is1ESPipeline: true + componentGovernanceSteps: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: + - template: /eng/common/templates/steps/generate-sbom.yml + parameters: + PackageVersion: ${{ parameters.packageVersion }} + BuildDropPath: ${{ parameters.buildDropPath }} + publishArtifacts: false + # publish artifacts # for 1ES managed templates, use the templateContext.output to handle multiple outputs. templateContext: diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 8da477dd69..d1aeb92fce 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -4,6 +4,7 @@ parameters: componentGovernanceIgnoreDirectories: '' # Sbom related params enableSbom: true + runAsPublic: false PackageVersion: 9.0.0 BuildDropPath: '$(Build.SourcesDirectory)/artifacts' @@ -19,71 +20,63 @@ jobs: steps: - ${{ each step in parameters.steps }}: - ${{ step }} - + componentGovernanceSteps: - - template: /eng/common/templates/steps/component-governance.yml - parameters: - ${{ if eq(parameters.disableComponentGovernance, '') }}: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: - disableComponentGovernance: false - ${{ else }}: - disableComponentGovernance: true + - template: /eng/common/templates/steps/component-governance.yml + parameters: + ${{ if eq(parameters.disableComponentGovernance, '') }}: + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: + disableComponentGovernance: false ${{ else }}: - disableComponentGovernance: ${{ parameters.disableComponentGovernance }} - componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} - - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: - - template: /eng/common/templates/steps/generate-sbom.yml - parameters: - PackageVersion: ${{ parameters.packageVersion }} - BuildDropPath: ${{ parameters.buildDropPath }} - publishArtifacts: false - + disableComponentGovernance: true + ${{ else }}: + disableComponentGovernance: ${{ parameters.disableComponentGovernance }} + componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} artifactPublishSteps: - - ${{ if ne(parameters.artifacts.publish, '') }}: - - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: - - template: /eng/common/core-templates/steps/publish-build-artifacts.yml - parameters: - is1ESPipeline: false - args: - displayName: Publish pipeline artifacts - pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts' - publishLocation: Container - artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} - continueOnError: true - condition: always() - - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: - - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml - parameters: - is1ESPipeline: false - args: - targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log' - artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} - displayName: 'Publish logs' - continueOnError: true - condition: always() - sbomEnabled: false # we don't need SBOM for logs - - - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: - template: /eng/common/core-templates/steps/publish-build-artifacts.yml parameters: is1ESPipeline: false args: - displayName: Publish Logs - pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + displayName: Publish pipeline artifacts + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts' publishLocation: Container - artifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} + artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} continueOnError: true condition: always() - - - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml parameters: is1ESPipeline: false args: - targetPath: '$(Build.SourcesDirectory)\eng\common\BuildConfiguration' - artifactName: 'BuildConfiguration' - displayName: 'Publish build retry configuration' + targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log' + artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} + displayName: 'Publish logs' continueOnError: true - sbomEnabled: false # we don't need SBOM for BuildConfiguration + condition: always() + sbomEnabled: false # we don't need SBOM for logs + + - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: false + args: + displayName: Publish Logs + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + publishLocation: Container + artifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} + continueOnError: true + condition: always() + + - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: false + args: + targetPath: '$(Build.SourcesDirectory)\eng\common\BuildConfiguration' + artifactName: 'BuildConfiguration' + displayName: 'Publish build retry configuration' + continueOnError: true + sbomEnabled: false # we don't need SBOM for BuildConfiguration diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 9574f4eb9d..22954477a5 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -900,7 +900,7 @@ function IsWindowsPlatform() { } function Get-Darc($version) { - $darcPath = "$TempDir\darc\$(New-Guid)" + $darcPath = "$TempDir\darc\$([guid]::NewGuid())" if ($version -ne $null) { & $PSScriptRoot\darc-init.ps1 -toolpath $darcPath -darcVersion $version | Out-Host } else { diff --git a/global.json b/global.json index 7ef6d61a2c..3a507dc5e0 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.100-preview.5.24307.3", + "version": "9.0.100-rc.2.24474.11", "rollForward": "minor", "allowPrerelease": false, "architecture": "x64" @@ -29,9 +29,9 @@ }, "xcopy-msbuild": "17.8.5", "vswhere": "2.2.7", - "dotnet": "9.0.100-preview.5.24307.3" + "dotnet": "9.0.100-rc.2.24474.11" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24408.2" + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24516.2" } } diff --git a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetTestMSBuildOutputTests.cs b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetTestMSBuildOutputTests.cs index db4cd5f13e..70e18080ef 100644 --- a/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetTestMSBuildOutputTests.cs +++ b/test/Microsoft.TestPlatform.Acceptance.IntegrationTests/DotnetTestMSBuildOutputTests.cs @@ -23,12 +23,8 @@ public void MSBuildLoggerCanBeEnabledByBuildPropertyAndDoesNotEatSpecialChars(Ru SetTestEnvironment(_testEnvironment, runnerInfo); var projectPath = GetIsolatedTestAsset("TerminalLoggerTestProject.csproj"); - InvokeDotnetTest($@"{projectPath} -nodereuse:false /p:PackageVersion={IntegrationTestEnvironment.LatestLocallyBuiltNugetVersion}", new Dictionary - { - // Setting this temporarily, until we upgrade to final net9, which has this option set automatically in the MSBUILD sdk. - // Without this option we don't produce any output to the terminal logger. - ["_MSBUILDTLENABLED"] = "1" - }); + // Forcing terminal logger so we can see the output when it is redirected + InvokeDotnetTest($@"{projectPath} -tl:on -nodereuse:false /p:PackageVersion={IntegrationTestEnvironment.LatestLocallyBuiltNugetVersion}"); // The output: // Determining projects to restore... @@ -38,7 +34,8 @@ public void MSBuildLoggerCanBeEnabledByBuildPropertyAndDoesNotEatSpecialChars(Ru // C:\Users\nohwnd\AppData\Local\Temp\vstest\xvoVt\UnitTest1.cs(41): error VSTEST1: (FailingTest) SampleUnitTestProject.UnitTest1.FailingTest() Assert.AreEqual failed. Expected:<2>. Actual:<3>. [C:\Users\nohwnd\AppData\Local\Temp\vstest\xvoVt\SimpleTestProject.csproj::TargetFramework=net462] // C:\Users\nohwnd\AppData\Local\Temp\vstest\xvoVt\UnitTest1.cs(41): error VSTEST1: (FailingTest) SampleUnitTestProject.UnitTest1.FailingTest() Assert.AreEqual failed. Expected:<2>. Actual:<3>. [C:\Users\nohwnd\AppData\Local\Temp\vstest\xvoVt\SimpleTestProject.csproj::TargetFramework=netcoreapp3.1] - StdOutputContains("error TESTERROR: FailingTest ("); + StdOutputContains("TESTERROR"); + StdOutputContains("FailingTest ("); StdOutputContains("): Error Message: Assert.AreEqual failed. Expected:<ğğğ𦮙我們剛才從𓋴𓅓𓏏𓇏𓇌𓀀>. Actual:."); StdOutputContains("at TerminalLoggerUnitTests.UnitTest1.FailingTest() in"); // We are sending those as low prio messages, they won't show up on screen but will be in binlog. diff --git a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs index cdbe0a44d1..885b65906a 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs @@ -862,7 +862,7 @@ protected static void ExecuteApplication(string path, string? args, out string s process.Start(); process.BeginOutputReadLine(); process.BeginErrorReadLine(); - if (!process.WaitForExit(5 * 60 * 1000)) // 5 minutes + if (!process.WaitForExit(30 * 60 * 1000)) // 30 minutes { Console.WriteLine($"IntegrationTestBase.Execute: Timed out waiting for {executableName}. Terminating the process."); process.Kill(); From ffe9e9aec40de57ede1ddc7e1b23a47032010c30 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:28:27 +0100 Subject: [PATCH 67/94] Update dependencies from https://github.com/dotnet/arcade build 20241112.13 (#10515) Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.XliffTasks From Version 9.0.0-beta.24516.2 -> To Version 9.0.0-beta.24562.13 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 12 ++++++------ global.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3708dfcbf7..6977b171b5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -44,14 +44,14 @@ - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1c7e09a8d9c9c9b15ba574cd6a496553505559de - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1c7e09a8d9c9c9b15ba574cd6a496553505559de @@ -62,9 +62,9 @@ https://github.com/dotnet/symreader-converter c5ba7c88f92e2dde156c324a8c8edc04d9fa4fe0 - + https://github.com/dotnet/arcade - 3c393bbd85ae16ddddba20d0b75035b0c6f1a52d + 1c7e09a8d9c9c9b15ba574cd6a496553505559de diff --git a/global.json b/global.json index 3a507dc5e0..d6470481a5 100644 --- a/global.json +++ b/global.json @@ -32,6 +32,6 @@ "dotnet": "9.0.100-rc.2.24474.11" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24516.2" + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24562.13" } } From 3ce509e432265682d8ec763559c723ae2759f0b7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:04:24 +0100 Subject: [PATCH 68/94] Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20241112.1 (#10519) Microsoft.Internal.CodeCoverage From Version 17.13.0-preview.24557.5 -> To Version 17.13.0-preview.24562.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6977b171b5..d5004cda16 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage - 5511d9f5b22a1f2203b8ad003998bace35b2a543 + 4f6e6afd41ccf30b0be2e0722fe4131106bf1b91 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index c0f9f4c060..e251823634 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -44,7 +44,7 @@ 3.1.0 2.0.0 17.9.0-beta.24058.4 - 17.13.0-preview.24557.5 + 17.13.0-preview.24562.1 17.10.34924.118 $(MicrosoftVisualStudioDiagnosticsUtilitiesVersion) 17.10.525-preview.1 From 7d34b30433259fb914aaaf276fde663a47b6ef2f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:04:42 +0100 Subject: [PATCH 69/94] Update dependencies from https://github.com/dotnet/diagnostics build 20241116.1 (#10517) Microsoft.SourceBuild.Intermediate.diagnostics , Microsoft.Diagnostics.NETCore.Client From Version 9.0.0-preview.24560.1 -> To Version 9.0.0-preview.24566.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d5004cda16..7e309b07ac 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,14 +5,14 @@ https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage 4f6e6afd41ccf30b0be2e0722fe4131106bf1b91 - + https://github.com/dotnet/diagnostics - 141a406a4c74d9ff6d6452dc999f78c08eee49a0 + 8c505ca6921b5f7e9b8acc234cc8f15035537ee4 - + https://github.com/dotnet/diagnostics - 141a406a4c74d9ff6d6452dc999f78c08eee49a0 + 8c505ca6921b5f7e9b8acc234cc8f15035537ee4 diff --git a/eng/Versions.props b/eng/Versions.props index e251823634..3f79407304 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -40,7 +40,7 @@ 3.11.0-beta1.23525.2 3.11.0-beta1.23525.2 17.7.0 - 0.2.0-preview.24560.1 + 0.2.0-preview.24566.1 3.1.0 2.0.0 17.9.0-beta.24058.4 From fc785088a28006c774dcfe0916b69ff54e6f99c1 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 10 Dec 2024 14:16:19 +0100 Subject: [PATCH 70/94] Set NetCurrent so that it doesn't roll forward automatically (#10622) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Set NetCurrent so that it doesn't roll forward automatically The VSTest repo can't use a floating NetCurrent value as the NetCurrent TFM is actually hardcoded in a number of places => .nuspec files. Set it to net9.0 explicitly so that the build continues to work with a .NET 10 SDK and Arcade 10 SDK (which is used inside the VMR). Don't hardcode the value when building from source as in that configuration, the TFM needs to actually target the very latest. * Update Directory.Build.props --------- Co-authored-by: Jakub Jareš --- Directory.Build.props | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Directory.Build.props b/Directory.Build.props index 94e7a2ac6d..778e8f488c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -52,6 +52,8 @@ net462 + + net9.0 netcoreapp3.1 false 17.13.0 - preview + release From edabaf392a0f6d2909e0d1468554b8f7e7974825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Mon, 13 Jan 2025 20:02:30 +0100 Subject: [PATCH 93/94] Move to macos14 (#14137) --- azure-pipelines-official.yml | 2 +- azure-pipelines.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 74309bc0ae..7b3507d431 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -55,7 +55,7 @@ parameters: image: 1es-ubuntu-2204 os: linux - name: Azure Pipelines - image: macOS-12 + image: macos-14 os: macOS variables: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f4cf78e518..5321572575 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -157,7 +157,7 @@ stages: vmImage: ubuntu-22.04 pwsh: true macOS_12: - vmImage: macOS-12 + vmImage: macos-14 pwsh: true pool: vmImage: $[ variables['vmImage'] ] From e8cf3808d0b16dea8d6e1a9b77f1660a5ff45e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 22 Jan 2025 10:45:47 +0100 Subject: [PATCH 94/94] Use 17.3.1 stable CodeCoverage --- eng/Version.Details.xml | 2 +- eng/Versions.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 669af05aef..aa21c12ef1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,7 +1,7 @@ - + https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage 3889f929bc86d4f819c62bfa687b01660c9e195d diff --git a/eng/Versions.props b/eng/Versions.props index 9aeaf2619d..0ef203e70b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -44,7 +44,7 @@ 3.1.0 2.0.0 17.9.0-beta.24058.4 - 17.14.0-preview.25056.1 + 17.13.1 17.10.34924.118 $(MicrosoftVisualStudioDiagnosticsUtilitiesVersion) 17.10.525-preview.1