From bb6aa0437ed379b5f452842dd613a7739f9290da Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Thu, 15 Dec 2022 15:36:21 +0100 Subject: [PATCH 01/29] Update documentation (#4202) Co-authored-by: Marco Rossignoli --- docs/RunSettingsArguments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/RunSettingsArguments.md b/docs/RunSettingsArguments.md index 084e6c0239..73ae9a8ff5 100644 --- a/docs/RunSettingsArguments.md +++ b/docs/RunSettingsArguments.md @@ -46,7 +46,7 @@ For example, in below command the final value for `MapInconclusiveToFailed` will dotnet test --settings additionalargs.runsettings -- MSTest.MapInconclusiveToFailed=False ``` -You can also set `TestRunParameters` using command line option: +Starting from .NET SDK 5.0 you can also set `TestRunParameters` using command line option: ```cmd # cmd From 0d68bf282123e80c2910aa1060056e854ede74de Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 15 Dec 2022 15:00:04 +0000 Subject: [PATCH 02/29] Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20221215.1 (#4204) Microsoft.Internal.CodeCoverage From Version 17.5.1-beta.22613.9 -> To Version 17.5.1-beta.22615.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 5fd5916991..10e1c59357 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 - 2b7d73945e9bcecb205fc6d16436e17c388157a2 + 1331a91abfe31a0aa553faa6a9bb85da6b71a7b9 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index 63a35d01f7..ddcdad3a16 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -82,7 +82,7 @@ JS etc.) is risky. This can break setup authoring and cause runtime failures in workloads where Rolsyn is not installed. --> 3.8.0-3.20427.2 - 17.5.1-beta.22613.9 + 17.5.1-beta.22615.1 0.2.0-preview.22424.1 6.0.0-preview.22424.1 16.6.7 From 2c0128c1d90041c394494558d9d4c8e1658ea1f5 Mon Sep 17 00:00:00 2001 From: Codrin-Victor Poienaru Date: Thu, 15 Dec 2022 08:45:01 -0800 Subject: [PATCH 03/29] Bumped TP version to 17.6.0 (#4203) --- eng/Versions.props | 2 +- scripts/build/TestPlatform.Dependencies.props | 1 + scripts/build/TestPlatform.Settings.targets | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index ddcdad3a16..871473d1fc 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -2,7 +2,7 @@ - 17.5.0 + 17.6.0 preview false diff --git a/scripts/build/TestPlatform.Dependencies.props b/scripts/build/TestPlatform.Dependencies.props index c6a29db2c7..b7f39e7590 100644 --- a/scripts/build/TestPlatform.Dependencies.props +++ b/scripts/build/TestPlatform.Dependencies.props @@ -11,6 +11,7 @@ + 17.5.0-dev - 17.5.0 + 17.6.0 preview true preview From e00bd832372b601b78d13a43b37bdf714cabb116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Thu, 15 Dec 2022 18:25:55 +0100 Subject: [PATCH 04/29] Fix release notes script to allow -release (#4205) --- scripts/write-release-notes.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/write-release-notes.ps1 b/scripts/write-release-notes.ps1 index 073ccabc04..b0484f6fc7 100644 --- a/scripts/write-release-notes.ps1 +++ b/scripts/write-release-notes.ps1 @@ -15,7 +15,7 @@ param ( [string] $Path = ".", - [ValidatePattern("^\d+\.\d+\.\d+(-preview-\d{8}-\d{2})?$")][string] $PackageVersion + [ValidatePattern("^\d+\.\d+\.\d+(-(preview|release)-\d{8}-\d{2})?$")][string] $PackageVersion ) $repoUrl = $(if ((git -C $Path remote -v) -match "upstream") { From 26fe7b7f73789b4b4ac07a58441235ba9edda9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Fri, 16 Dec 2022 11:23:47 +0100 Subject: [PATCH 05/29] Update releases.md --- docs/releases.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/releases.md b/docs/releases.md index cba8fdf5de..2ccc706e0c 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -1,5 +1,18 @@ # Release Notes +## 17.4.1 + +### Issues Fixed + +* Fix satellite resolution for Microsoft.TestPlatform.Common [#4147](https://github.com/microsoft/vstest/pull/4147) + +See full log [here](https://github.com/microsoft/vstest/compare/v17.4.0...v17.4.1) + +### Drops + +* TestPlatform vsix: [17.4.1](https://vsdrop.corp.microsoft.com/file/v1/Products/DevDiv/microsoft/vstest/17.4/20221215-01;/TestPlatform.vsix) +* Microsoft.TestPlatform.ObjectModel : [17.4.1](https://www.nuget.org/packages/Microsoft.TestPlatform.ObjectModel/17.4.1) + ## 17.4.0 ### Issues Fixed From 1dbe541fd5dbb1df4fd245e8fef1b2807a578f37 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Fri, 16 Dec 2022 17:31:04 +0100 Subject: [PATCH 06/29] Improve testing for TryGetDotnetPathByArchitecture (#4210) Improve testing for TryGetDotnetPathByArchitecture --- .../Helpers/DotnetHostHelperTest.cs | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Helpers/DotnetHostHelperTest.cs b/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Helpers/DotnetHostHelperTest.cs index 492686d9a6..ea802a56da 100644 --- a/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Helpers/DotnetHostHelperTest.cs +++ b/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Helpers/DotnetHostHelperTest.cs @@ -343,6 +343,96 @@ public void GetDotnetPathByArchitecture_DefaultInstallation_Unix( Assert.AreEqual(found ? expectedMuxerPath : null, muxerPath); } + [TestMethod] + public void GetDotnetPathByArchitecture_Strategies() + { + foreach (DotnetMuxerResolutionStrategy strategy in Enum.GetValues(typeof(DotnetMuxerResolutionStrategy))) + { + // Arrange + _environmentHelper.Reset(); + _fileHelper.Reset(); + _windowsRegistrytHelper.Reset(); + _environmentVariableHelper.Reset(); + _processHelper.Reset(); + + _environmentVariableHelper.Setup(x => x.GetEnvironmentVariable("ProgramFiles")).Returns("notfound"); + var dotnetHostHelper = new DotnetHostHelper(_fileHelper.Object, _environmentHelper.Object, _windowsRegistrytHelper.Object, _environmentVariableHelper.Object, _processHelper.Object); + dotnetHostHelper.TryGetDotnetPathByArchitecture(PlatformArchitecture.X64, strategy, out string? _); + + // Assert + switch (strategy) + { + case DotnetMuxerResolutionStrategy.DotnetRootArchitecture: + // Assert env vars + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("DOTNET_ROOT_X64"), Times.Once); + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("DOTNET_ROOT"), Times.Never); + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable(It.IsAny()), Times.Once); + + // Assert local installation + _windowsRegistrytHelper.Verify(x => x.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32), Times.Never); + + // Assert default installation folder + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("ProgramFiles"), Times.Never); + + break; + case DotnetMuxerResolutionStrategy.DotnetRootArchitectureLess: + // Assert env vars + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("DOTNET_ROOT_X64"), Times.Never); + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("DOTNET_ROOT"), Times.Once); + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable(It.IsAny()), Times.Once); + + // Assert local installation + _windowsRegistrytHelper.Verify(x => x.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32), Times.Never); + + // Assert default installation folder + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("ProgramFiles"), Times.Never); + + break; + case DotnetMuxerResolutionStrategy.GlobalInstallationLocation: + // Assert env vars + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("DOTNET_ROOT_X64"), Times.Never); + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("DOTNET_ROOT"), Times.Never); + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable(It.IsAny()), Times.Never); + + // Assert local installation + _windowsRegistrytHelper.Verify(x => x.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32), Times.Once); + + // Assert default installation folder + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("ProgramFiles"), Times.Never); + + break; + case DotnetMuxerResolutionStrategy.DefaultInstallationLocation: + // Assert env vars + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("DOTNET_ROOT_X64"), Times.Never); + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("DOTNET_ROOT"), Times.Never); + + // Assert local installation + _windowsRegistrytHelper.Verify(x => x.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32), Times.Never); + + // Assert default installation folder + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("ProgramFiles"), Times.Once); + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable(It.IsAny()), Times.Once); + + break; + case DotnetMuxerResolutionStrategy.Default: + + // Assert env vars + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("DOTNET_ROOT_X64"), Times.Once); + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("DOTNET_ROOT"), Times.Once); + + // Assert local installation + _windowsRegistrytHelper.Verify(x => x.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32), Times.Once); + + // Assert default installation folder + _environmentVariableHelper.Verify(x => x.GetEnvironmentVariable("ProgramFiles"), Times.Once); + + break; + default: + throw new NotImplementedException(); + } + } + } + public void Dispose() => _muxerHelper.Dispose(); private class MockMuxerHelper : IDisposable From 93990247380a6c4757e2f7351ddacc6fd4e43bcf Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 16:04:31 +0100 Subject: [PATCH 07/29] Update dependencies from https://github.com/dotnet/arcade build 20221216.1 (#4213) Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.SignTool , Microsoft.DotNet.SwaggerGenerator.MSBuild From Version 8.0.0-beta.22609.3 -> To Version 8.0.0-beta.22616.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 20 +++++++++---------- eng/Versions.props | 6 +++--- .../build-configuration.json | 4 ++++ eng/common/templates/job/job.yml | 6 ++++++ global.json | 4 ++-- 5 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 eng/common/BuildConfiguration/build-configuration.json diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 10e1c59357..a8d9d73310 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -16,26 +16,26 @@ - + https://github.com/dotnet/arcade - 3e24006ee217f68b0c8a36cf272536ac239c9c47 + 57ba56de330e50f9012493b8ba24818e24ec7817 - + https://github.com/dotnet/arcade - 3e24006ee217f68b0c8a36cf272536ac239c9c47 + 57ba56de330e50f9012493b8ba24818e24ec7817 - + https://github.com/dotnet/arcade - 3e24006ee217f68b0c8a36cf272536ac239c9c47 + 57ba56de330e50f9012493b8ba24818e24ec7817 - + https://github.com/dotnet/arcade - 3e24006ee217f68b0c8a36cf272536ac239c9c47 + 57ba56de330e50f9012493b8ba24818e24ec7817 - + https://github.com/dotnet/arcade - 3e24006ee217f68b0c8a36cf272536ac239c9c47 + 57ba56de330e50f9012493b8ba24818e24ec7817 https://github.com/dotnet/arcade-services diff --git a/eng/Versions.props b/eng/Versions.props index 871473d1fc..12494ddafd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -62,8 +62,8 @@ 2.4.1 2.0.3 2.4.1 - 8.0.0-beta.22609.3 - 8.0.0-beta.22609.3 + 8.0.0-beta.22616.1 + 8.0.0-beta.22616.1 1.22.0 1.1.2 2.0.0 @@ -75,7 +75,7 @@ 1.7.0 1.1.0-beta.20074.1 1.0.0-beta2-19554-01 - 8.0.0-beta.22609.3 + 8.0.0-beta.22616.1 1.0.0-beta.21272.1 3.8.0-3.20427.2 - 17.5.1-beta.22615.1 + 17.6.0-beta.22619.4 0.2.0-preview.22424.1 6.0.0-preview.22424.1 16.6.7 From 0b72a4d6ab32dc74fc959259c73854eedee4c9cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Tue, 20 Dec 2022 18:47:06 +0100 Subject: [PATCH 09/29] Use latest .NET 7 runtime (#4216) --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 091b525247..f257de0578 100644 --- a/global.json +++ b/global.json @@ -1,12 +1,12 @@ { "sdk": { - "version": "7.0.100", + "version": "7.0.101", "rollForward": "minor", "allowPrerelease": false, "architecture": "x64" }, "tools": { - "dotnet": "7.0.100" + "dotnet": "7.0.101" }, "msbuild-sdks": { "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22616.1", From 95b3fddabe0e403d4fde626d2ee3e88f0ddadf24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Tue, 20 Dec 2022 19:04:31 +0100 Subject: [PATCH 10/29] Bump NET SDK version to 17.6.0 (#4218) --- scripts/build/TestPlatform.Dependencies.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build/TestPlatform.Dependencies.props b/scripts/build/TestPlatform.Dependencies.props index b7f39e7590..aebc514461 100644 --- a/scripts/build/TestPlatform.Dependencies.props +++ b/scripts/build/TestPlatform.Dependencies.props @@ -12,7 +12,7 @@ and because during the test `dotnet test` will run and re-build some of the test projects and at that time the version from a build parameter would not be available, so I am writing this version from the build.ps1 script to keep it in sync --> - 17.5.0-dev + 17.6.0-dev From 1018feb184195dcbe315935146b3d5f83192161d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 21 Dec 2022 08:32:37 +0000 Subject: [PATCH 11/29] [main] Update dependencies from devdiv/DevDiv/vs-code-coverage (#4217) * Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20221220.2 Microsoft.Internal.CodeCoverage From Version 17.6.0-beta.22619.4 -> To Version 17.6.0-beta.22620.2 Co-authored-by: dotnet-maestro[bot] Co-authored-by: Jakub Chocholowicz --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a01658912f..d3fedbb38d 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 - c8fbb269f62e4031b5e027c828a5274a44390a24 + a92e38c89cb831ec514c6e2ec57943f76d790905 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index 524ecc359d..5cdfb0728a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -82,11 +82,11 @@ JS etc.) is risky. This can break setup authoring and cause runtime failures in workloads where Rolsyn is not installed. --> 3.8.0-3.20427.2 - 17.6.0-beta.22619.4 + 17.6.0-beta.22620.2 0.2.0-preview.22424.1 6.0.0-preview.22424.1 - 16.6.7 + 16.6.11 16.3.44 - 16.3.36 + 16.3.38 From 992a7c4ec7f25308d0fed594895699bf89787545 Mon Sep 17 00:00:00 2001 From: Codrin-Victor Poienaru Date: Wed, 21 Dec 2022 01:12:56 -0800 Subject: [PATCH 12/29] Added support for checking testhost compatibility with test sessions (#4199) Added support for checking testhost compatibility with test sessions --- .../Client/ProxyOperationManager.cs | 54 +++++++++++++++++- .../PublicAPI/PublicAPI.Shipped.txt | 2 - .../TestEngine.cs | 12 +++- .../TestSession/ProxyTestSessionManager.cs | 30 ++++++++-- .../Hosting/DefaultTestHostManager.cs | 2 + .../Hosting/DotnetTestHostManager.cs | 2 + .../Client/ProxyOperationManagerTests.cs | 32 +++++++++++ .../Client/ProxyTestSessionManagerTests.cs | 55 +++++++++++++++++++ 8 files changed, 179 insertions(+), 10 deletions(-) diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs index 55d11267fe..59a5f68a47 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs @@ -34,6 +34,9 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client; [SuppressMessage("Design", "CA1001:Types that own disposable fields should be disposable", Justification = "Would cause a breaking change if users are inheriting this class and implement IDisposable")] public class ProxyOperationManager { + internal const string DotnetTesthostFriendlyName = "DotnetTestHost"; + internal const string DefaultTesthostFriendlyName = "DefaultTestHost"; + private readonly string _versionCheckPropertyName = "IsVersionCheckRequired"; private readonly string _makeRunsettingsCompatiblePropertyName = "MakeRunsettingsCompatible"; private readonly ManualResetEventSlim _testHostExited = new(false); @@ -114,7 +117,13 @@ public ProxyOperationManager( /// /// Gets the proxy operation manager id for proxy test session manager internal organization. /// - public int Id { get; set; } = -1; + internal int Id { get; set; } = -1; + + /// + /// Gets or sets a value indicating whether the current proxy operation manager is part of a + /// test session. + /// + internal bool IsTestSessionEnabled { get; set; } /// /// Gets or sets the cancellation token source. @@ -177,6 +186,13 @@ public virtual bool SetupChannel(IEnumerable sources, string? runSetting return true; } + // Check whether test sessions are supported if the current proxy operation manager is to + // be part of one. + if (IsTestSessionEnabled && !IsTesthostCompatibleWithTestSessions()) + { + return false; + } + var connTimeout = EnvironmentHelper.GetConnectionTimeout(); _testHostProcessStdError = string.Empty; @@ -403,6 +419,42 @@ public virtual TestProcessStartInfo UpdateTestProcessStartInfo(TestProcessStartI return updatedRunSettingsXml; } + internal virtual string ReadTesthostFriendlyName() + { + var friendlyNameAttribute = TestHostManager.GetType().GetCustomAttributes( + typeof(FriendlyNameAttribute), true) + .FirstOrDefault(); + + return (friendlyNameAttribute is not null and FriendlyNameAttribute friendlyName) + ? friendlyName.FriendlyName : string.Empty; + } + + internal bool IsTesthostCompatibleWithTestSessions() + { + // These constants should be kept in line with the friendly names found in + // DotnetTestHostManager.cs, respectively DefaultTestHostManager.cs. + // + // We agreed on checking the test session compatibility this way (i.e. by reading the + // friendly name and making sure it's one of the testhosts we control) instead of a more + // generic alternative that was initially proposed (i.e. by decorating each testhost + // manager with a capability attribute that could tell us if the test session scenario + // is supported for the testhost in discussion) because of the breaking risks associated + // with the latter approach. Also, there is no formal specification for now of what it + // means to support test sessions. Should extending session functionality to 3rd party + // testhosts be something we want to address in the future, we should come up with such + // a specification first. + var friendlyName = ReadTesthostFriendlyName(); + if (!friendlyName.IsNullOrEmpty()) + { + var isSessionSupported = friendlyName is (DotnetTesthostFriendlyName or DefaultTesthostFriendlyName); + EqtTrace.Verbose($"ProxyOperationManager.IsTesthostCompatibleWithTestSessions: Testhost friendly name: {friendlyName}; Sessions support: {isSessionSupported};"); + + return isSessionSupported; + } + + return false; + } + [return: NotNullIfNotNull("logFile")] private static string? GetTimestampedLogFile(string? logFile) { diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/PublicAPI/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.CrossPlatEngine/PublicAPI/PublicAPI.Shipped.txt index b2b5c873ef..7f4ee98236 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/PublicAPI/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/PublicAPI/PublicAPI.Shipped.txt @@ -41,8 +41,6 @@ Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyDiscoveryManager Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.CancellationTokenSource.get -> System.Threading.CancellationTokenSource! Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.CancellationTokenSource.set -> void -Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.Id.get -> int -Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.Id.set -> void Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.ProxyOperationManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData? requestData, Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces.ITestRequestSender! requestSender, Microsoft.VisualStudio.TestPlatform.ObjectModel.Host.ITestRuntimeProvider! testHostManager, Microsoft.VisualStudio.TestPlatform.ObjectModel.Framework! testhostManagerFramework) -> void Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.ProxyOperationManager(Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IRequestData? requestData, Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces.ITestRequestSender! requestSender, Microsoft.VisualStudio.TestPlatform.ObjectModel.Host.ITestRuntimeProvider! testHostManager, Microsoft.VisualStudio.TestPlatform.ObjectModel.Framework? testhostManagerFramework, Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.IBaseProxy? baseProxy) -> void Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.RemoveNodesFromRunsettingsIfRequired(string? runsettingsXml, System.Action! logMessage) -> string? diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index 6ba0e18253..e94f8fd47d 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -420,14 +420,22 @@ internal IProxyExecutionManager CreateNonParallelExecutionManager(IRequestData r requestSender, hostManager, // There is always at least one, and all of them have the same framework and architecture. - testRuntimeProviderInfo.SourceDetails[0].Framework!); + testRuntimeProviderInfo.SourceDetails[0].Framework!) + { + IsTestSessionEnabled = true + }; }; // TODO: This condition should be returning the maxParallel level to avoid pre-starting way too many testhosts, because maxParallel level, // can be smaller than the number of sources to run. var maxTesthostCount = isParallelRun ? testSessionCriteria.Sources.Count : 1; - return new ProxyTestSessionManager(testSessionCriteria, maxTesthostCount, proxyCreator, testRuntimeProviders); + return new ProxyTestSessionManager(testSessionCriteria, maxTesthostCount, proxyCreator, testRuntimeProviders) + { + // Individual proxy setup failures are tolerated since SetupChannel may fail if the + // testhost it tries to start is not compatible with the test session feature. + DisposalPolicy = ProxyDisposalOnCreationFailPolicy.AllowProxySetupFailures + }; } private List GetTestRuntimeProvidersForUniqueConfigurations( diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs index a05b950f97..69f6699855 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestSession/ProxyTestSessionManager.cs @@ -20,6 +20,12 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine; +internal enum ProxyDisposalOnCreationFailPolicy +{ + DisposeAllOnFailure, + AllowProxySetupFailures +} + /// /// Orchestrates test session operations for the engine communicating with the client. /// @@ -47,6 +53,8 @@ private enum TestSessionState private readonly Dictionary _sourceToRuntimeProviderInfoMap; private Dictionary _testSessionEnvironmentVariables = new(); + internal ProxyDisposalOnCreationFailPolicy DisposalPolicy { get; set; } = ProxyDisposalOnCreationFailPolicy.DisposeAllOnFailure; + private IDictionary TestSessionEnvironmentVariables { get @@ -149,13 +157,25 @@ public virtual bool StartSession(ITestSessionEventsHandler eventsHandler, IReque stopwatch.Elapsed.TotalSeconds); // Dispose of all proxies if even one of them failed during setup. + // + // Update: With the introduction of the proxy creation fail disposal policy, we now support + // the scenario of individual proxy setup failures. What this means is that we don't mark + // the whole session as failed if a single proxy fails, but instead we'll reuse the spinned + // off testhosts when possible and create on-demand testhosts for the sources that we failed + // to create proxies for. if (_proxySetupFailed) { - requestData?.MetricsCollection.Add( - TelemetryDataConstants.TestSessionState, - TestSessionState.Error.ToString()); - DisposeProxies(); - return false; + if (DisposalPolicy == ProxyDisposalOnCreationFailPolicy.DisposeAllOnFailure + || _proxyContainerList.Count == 0) + { + requestData?.MetricsCollection.Add( + TelemetryDataConstants.TestSessionState, + TestSessionState.Error.ToString()); + DisposeProxies(); + return false; + } + + EqtTrace.Info($"ProxyTestSessionManager.StartSession: At least one proxy setup failed, but failures are tolerated by policy."); } // Make the session available. diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs index 02001d23ab..acaa329dad 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs @@ -45,6 +45,8 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting; public class DefaultTestHostManager : ITestRuntimeProvider2 { private const string DefaultTestHostUri = "HostProvider://DefaultTestHost"; + // Should the friendly name ever change, please make sure to change the corresponding constant + // inside ProxyOperationManager::IsTesthostCompatibleWithTestSessions(). private const string DefaultTestHostFriendlyName = "DefaultTestHost"; private const string TestAdapterEndsWithPattern = @"TestAdapter.dll"; diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index c3f44f0a9c..6f62385591 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -50,6 +50,8 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting; public class DotnetTestHostManager : ITestRuntimeProvider2 { private const string DotnetTestHostUri = "HostProvider://DotnetTestHost"; + // Should the friendly name ever change, please make sure to change the corresponding constant + // inside ProxyOperationManager::IsTesthostCompatibleWithTestSessions(). private const string DotnetTestHostFriendlyName = "DotnetTestHost"; private const string TestAdapterRegexPattern = @"TestAdapter.dll"; private const string PROCESSOR_ARCHITECTURE = nameof(PROCESSOR_ARCHITECTURE); diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs index 7f8127035d..f9ec911805 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyOperationManagerTests.cs @@ -102,6 +102,31 @@ public void SetupChannelShouldCreateTimestampedLogFileForHost() #endif } + [TestMethod] + [DataRow("Dummy", true, false, false)] + [DataRow(ProxyOperationManager.DefaultTesthostFriendlyName, true, true, true)] + [DataRow(ProxyOperationManager.DotnetTesthostFriendlyName, true, true, true)] + public void SetupChannelOutcomeShouldTakeTesthostSessionSupportIntoAccount( + string testhostFriendlyName, + bool isTestSessionEnabled, + bool expectedCompatibilityCheckResult, + bool expectedSetupResult) + { + _mockRequestSender.Setup(rs => rs.InitializeCommunication()).Returns(123); + + var testOperationManager = new TestableProxyOperationManager( + _mockRequestData.Object, + _mockRequestSender.Object, + _mockTestHostManager.Object) + { + IsTestSessionEnabled = isTestSessionEnabled, + TesthostFriendlyName = testhostFriendlyName + }; + + Assert.IsTrue(testOperationManager.IsTesthostCompatibleWithTestSessions() == expectedCompatibilityCheckResult); + Assert.IsTrue(testOperationManager.SetupChannel(Enumerable.Empty(), DefaultRunSettings) == expectedSetupResult); + } + [TestMethod] public void SetupChannelShouldAddRunnerProcessIdForTestHost() { @@ -519,6 +544,13 @@ public TestableProxyOperationManager( { CancellationTokenSource = cancellationTokenSource; } + + public string TesthostFriendlyName { get; set; } = "Dummy"; + + internal override string ReadTesthostFriendlyName() + { + return TesthostFriendlyName; + } } private class TestableDotnetTestHostManager : DotnetTestHostManager diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyTestSessionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyTestSessionManagerTests.cs index 6a73de9005..6d8b822b55 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyTestSessionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Client/ProxyTestSessionManagerTests.cs @@ -206,6 +206,61 @@ public void StartSessionShouldFailIfSetupChannelReturnsFalse() Times.Never); } + [TestMethod] + public void StartSessionShouldNotFailIfSetupChannelReturnsFalseButTheProxyDisposalPolicyAllowsFailures() + { + var mockProxyOperationManager = new Mock(null, null, null, null); + mockProxyOperationManager.SetupSequence(pom => pom.SetupChannel(It.IsAny>(), It.IsAny())) + .Returns(true) + .Returns(false) + .Returns(false) + .Returns(false) + .Returns(false) + .Returns(false) + .Returns(false) + .Returns(false); + mockProxyOperationManager.Setup(pom => pom.Close()).Callback(() => { }); + + var testSessionCriteria = CreateTestSession(_fakeTestMultipleSources, _fakeRunSettings); + var proxyManager = CreateProxy(testSessionCriteria, mockProxyOperationManager.Object); + proxyManager.DisposalPolicy = ProxyDisposalOnCreationFailPolicy.AllowProxySetupFailures; + + // Call fails because SetupChannel returns false. + Assert.IsTrue(proxyManager.StartSession(_mockEventsHandler.Object, _mockRequestData.Object)); + mockProxyOperationManager.Verify(pom => pom.SetupChannel( + It.IsAny>(), + It.IsAny()), + Times.Exactly(_fakeTestMultipleSources.Count)); + mockProxyOperationManager.Verify(pom => pom.Close(), Times.Never); + _mockEventsHandler.Verify(eh => eh.HandleStartTestSessionComplete( + It.IsAny()), + Times.Once); + } + + [TestMethod] + public void StartSessionShouldStillFailIfSetupChannelReturnsFalseAndTheProxyDisposalPolicyAllowsFailuresButNoTesthostIsSpawned() + { + var mockProxyOperationManager = new Mock(null, null, null, null); + mockProxyOperationManager.Setup(pom => pom.SetupChannel(It.IsAny>(), It.IsAny())) + .Returns(false); + mockProxyOperationManager.Setup(pom => pom.Close()).Callback(() => { }); + + var testSessionCriteria = CreateTestSession(_fakeTestSources, _fakeRunSettings); + var proxyManager = CreateProxy(testSessionCriteria, mockProxyOperationManager.Object); + proxyManager.DisposalPolicy = ProxyDisposalOnCreationFailPolicy.AllowProxySetupFailures; + + // Call fails because SetupChannel returns false. + Assert.IsFalse(proxyManager.StartSession(_mockEventsHandler.Object, _mockRequestData.Object)); + mockProxyOperationManager.Verify(pom => pom.SetupChannel( + It.IsAny>(), + It.IsAny()), + Times.Exactly(_fakeTestSources.Count)); + mockProxyOperationManager.Verify(pom => pom.Close(), Times.Never); + _mockEventsHandler.Verify(eh => eh.HandleStartTestSessionComplete( + It.IsAny()), + Times.Never); + } + [TestMethod] public void StartSessionShouldFailIfSetupChannelThrowsException() { From 71799688d2a95105dd1b6a4de8d1dbc8aa4341f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Wed, 21 Dec 2022 15:32:09 +0100 Subject: [PATCH 13/29] Update releases.md --- docs/releases.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/releases.md b/docs/releases.md index 2ccc706e0c..ed00eff265 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -1,5 +1,33 @@ # Release Notes +* Add test run serialization feature [#4126](https://github.com/microsoft/vstest/pull/4126) +* Ensure that the OnAbort message is sent if the testhost aborts early [#3993](https://github.com/microsoft/vstest/pull/3993) +* Add custom satellite assemblies resolution [#4133](https://github.com/microsoft/vstest/pull/4133) +* Fixed muxer resolution strategy enum [#4134](https://github.com/microsoft/vstest/pull/4134) +* Fixed dotnet resolution for in-process vstest.console scenarios [#4122](https://github.com/microsoft/vstest/pull/4122) +* Ensure to not produce and ship exe for netcore [#4124](https://github.com/microsoft/vstest/pull/4124) +* Fixed testhost crash for net7 [#4112](https://github.com/microsoft/vstest/pull/4112) +* Revert "Run tests with Server GC enabled & concurrent GC disabled. (#3661)" [#4108](https://github.com/microsoft/vstest/pull/4108) +* Revert making Microsoft.NET.Test.Sdk package transitive [#4104](https://github.com/microsoft/vstest/pull/4104) +* Fix recursive resource lookup [#4095](https://github.com/microsoft/vstest/pull/4095) +* Fixed CC for in-process console scenarios [#4084](https://github.com/microsoft/vstest/pull/4084) +* Fixed test session issues [#4075](https://github.com/microsoft/vstest/pull/4075) +* Fix Invalid target architecture 'S390x' error [#4066](https://github.com/microsoft/vstest/pull/4066) +* Add Mono.Cecil.Rocks [#4071](https://github.com/microsoft/vstest/pull/4071) +* Revert "Revert "Re-enable arm64 ngen (#3931)" (#3948)" [#3951](https://github.com/microsoft/vstest/pull/3951) +* Update docker to the latest tagging schema [#4041](https://github.com/microsoft/vstest/pull/4041) +* Update resources [#4063](https://github.com/microsoft/vstest/pull/4063) +* Use environment variables for AeDebugger mode [#4049](https://github.com/microsoft/vstest/pull/4049) +* Add postmortem blame mode [#4032](https://github.com/microsoft/vstest/pull/4032) +* Add VSTEST_DISABLE_THREADPOOL_SIZE_INCREASE feature flag [#4046](https://github.com/microsoft/vstest/pull/4046) + +See full log [here](https://github.com/microsoft/vstest/compare/v17.5.0-preview-20221003-04...v17.5.0-preview-20221221-03) + +### Artifacts + +* TestPlatform vsix: [17.5.0-preview-20221221-03](https://vsdrop.corp.microsoft.com/file/v1/Products/DevDiv/microsoft/vstest/17.5/20221221-03;/TestPlatform.vsix) +* Microsoft.TestPlatform.ObjectModel : [17.5.0-preview-20221221-03](https://www.nuget.org/packages/Microsoft.TestPlatform.ObjectModel/17.5.0-preview-20221221-03) + ## 17.4.1 ### Issues Fixed From bdfce1cbe66ccf645d88032b0fcc4cb24938ad17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Wed, 21 Dec 2022 15:34:21 +0100 Subject: [PATCH 14/29] Update releases.md --- docs/releases.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/releases.md b/docs/releases.md index ed00eff265..247f9df3f6 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -1,5 +1,9 @@ # Release Notes +## 17.5.0-preview-20221221-03 + +### Issues Fixed + * Add test run serialization feature [#4126](https://github.com/microsoft/vstest/pull/4126) * Ensure that the OnAbort message is sent if the testhost aborts early [#3993](https://github.com/microsoft/vstest/pull/3993) * Add custom satellite assemblies resolution [#4133](https://github.com/microsoft/vstest/pull/4133) From 8f29afc5ae6873e2d17b5046f517c222ebb59800 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 22 Dec 2022 07:37:31 +0100 Subject: [PATCH 15/29] Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20221220.4 (#4219) Microsoft.Internal.CodeCoverage From Version 17.6.0-beta.22620.2 -> To Version 17.6.0-beta.22620.4 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 d3fedbb38d..7d3dc5bad1 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 - a92e38c89cb831ec514c6e2ec57943f76d790905 + 5ceece3656fe3ed02d01652d1948f75f3b0e9383 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index 5cdfb0728a..e46f8f5290 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -82,7 +82,7 @@ JS etc.) is risky. This can break setup authoring and cause runtime failures in workloads where Rolsyn is not installed. --> 3.8.0-3.20427.2 - 17.6.0-beta.22620.2 + 17.6.0-beta.22620.4 0.2.0-preview.22424.1 6.0.0-preview.22424.1 16.6.11 From 236a4283a6fafee6bb5247f30b1a2ea94cea6010 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 22 Dec 2022 17:05:11 +0100 Subject: [PATCH 16/29] Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20221222.1 (#4220) Microsoft.Internal.CodeCoverage From Version 17.6.0-beta.22620.4 -> To Version 17.6.0-beta.22622.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 7d3dc5bad1..1391dd2a99 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 - 5ceece3656fe3ed02d01652d1948f75f3b0e9383 + 042670738c324f6bd85553f6292f168f9160fba7 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index e46f8f5290..f1e35966b3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -82,7 +82,7 @@ JS etc.) is risky. This can break setup authoring and cause runtime failures in workloads where Rolsyn is not installed. --> 3.8.0-3.20427.2 - 17.6.0-beta.22620.4 + 17.6.0-beta.22622.1 0.2.0-preview.22424.1 6.0.0-preview.22424.1 16.6.11 From 16c004d7b078da6f47db414e062019b24555d39f Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Thu, 22 Dec 2022 19:16:28 +0100 Subject: [PATCH 17/29] handle object disposed exception (#4221) Co-authored-by: Marco Rossignoli --- .../LengthPrefixCommunicationChannel.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs index b6ca3549e5..293a5a683b 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/LengthPrefixCommunicationChannel.cs @@ -111,9 +111,17 @@ public Task NotifyDataAvailable() /// public void Dispose() { - EqtTrace.Verbose("LengthPrefixCommunicationChannel.Dispose: Dispose reader and writer."); - _reader.Dispose(); - _writer.Dispose(); + try + { + EqtTrace.Verbose("LengthPrefixCommunicationChannel.Dispose: Dispose reader and writer."); + _reader.Dispose(); + _writer.Dispose(); + } + catch (ObjectDisposedException) + { + // We don't own the underlying stream lifecycle so it's possible that it's already disposed. + } + GC.SuppressFinalize(this); } } From f4aab6d4d791bd0f5f5ad05d3431b79405072781 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 23 Dec 2022 14:42:37 +0000 Subject: [PATCH 18/29] Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20221223.2 (#4223) Microsoft.Internal.CodeCoverage From Version 17.6.0-beta.22622.1 -> To Version 17.6.0-beta.22623.2 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 1391dd2a99..af12ba5299 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 - 042670738c324f6bd85553f6292f168f9160fba7 + a405954c8329750283108383289b3c6f0a7646ad https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index f1e35966b3..0107e620b1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -82,7 +82,7 @@ JS etc.) is risky. This can break setup authoring and cause runtime failures in workloads where Rolsyn is not installed. --> 3.8.0-3.20427.2 - 17.6.0-beta.22622.1 + 17.6.0-beta.22623.2 0.2.0-preview.22424.1 6.0.0-preview.22424.1 16.6.11 From f63c5c3fb7dd3ffd2c3d91d8d52fa369a96b6c23 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 27 Dec 2022 07:53:19 +0000 Subject: [PATCH 19/29] Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20221223.3 (#4225) Microsoft.Internal.CodeCoverage From Version 17.6.0-beta.22623.2 -> To Version 17.6.0-beta.22623.3 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 af12ba5299..890e293ac9 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 - a405954c8329750283108383289b3c6f0a7646ad + 303b70b1eea3161009103e3ae20814057f340d02 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index 0107e620b1..c8fd01c1ff 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -82,7 +82,7 @@ JS etc.) is risky. This can break setup authoring and cause runtime failures in workloads where Rolsyn is not installed. --> 3.8.0-3.20427.2 - 17.6.0-beta.22623.2 + 17.6.0-beta.22623.3 0.2.0-preview.22424.1 6.0.0-preview.22424.1 16.6.11 From 5487114c20b9820741d6fe777ae9ef9712c076a1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 27 Dec 2022 17:40:48 +0100 Subject: [PATCH 20/29] Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20221227.1 (#4229) Microsoft.Internal.CodeCoverage From Version 17.6.0-beta.22623.3 -> To Version 17.6.0-beta.22627.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 890e293ac9..9c73b689b2 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 - 303b70b1eea3161009103e3ae20814057f340d02 + 281c707720c48039734a4b85142c72a63ccec155 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index c8fd01c1ff..d37635f3cd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -82,7 +82,7 @@ JS etc.) is risky. This can break setup authoring and cause runtime failures in workloads where Rolsyn is not installed. --> 3.8.0-3.20427.2 - 17.6.0-beta.22623.3 + 17.6.0-beta.22627.1 0.2.0-preview.22424.1 6.0.0-preview.22424.1 16.6.11 From 1eddaffbd617c206970dd18c5dd86dff0b61d4ff Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 28 Dec 2022 08:34:38 +0000 Subject: [PATCH 21/29] Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20221227.4 (#4230) Microsoft.Internal.CodeCoverage From Version 17.6.0-beta.22627.1 -> To Version 17.6.0-beta.22627.4 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 9c73b689b2..6104522414 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 - 281c707720c48039734a4b85142c72a63ccec155 + 16ac1f049e82179dbee523ecfe0276840669ade4 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index d37635f3cd..4038d723e4 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -82,7 +82,7 @@ JS etc.) is risky. This can break setup authoring and cause runtime failures in workloads where Rolsyn is not installed. --> 3.8.0-3.20427.2 - 17.6.0-beta.22627.1 + 17.6.0-beta.22627.4 0.2.0-preview.22424.1 6.0.0-preview.22424.1 16.6.11 From ee396f7ce75080fc7b38943678206d83a8ce685c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 28 Dec 2022 16:22:44 +0100 Subject: [PATCH 22/29] [main] Update dependencies from devdiv/DevDiv/vs-code-coverage (#4234) 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 6104522414..ec0bfa8dbc 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 - 16ac1f049e82179dbee523ecfe0276840669ade4 + 4b193a413b16da6caba33f7831c41dd69de5b6be https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index 4038d723e4..80bf028c84 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -82,7 +82,7 @@ JS etc.) is risky. This can break setup authoring and cause runtime failures in workloads where Rolsyn is not installed. --> 3.8.0-3.20427.2 - 17.6.0-beta.22627.4 + 17.6.0-beta.22628.2 0.2.0-preview.22424.1 6.0.0-preview.22424.1 16.6.11 From 020a23d8b7dbed709c7be0b41051a2885acfc2ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Wed, 28 Dec 2022 16:58:55 +0100 Subject: [PATCH 23/29] Update fabricbot config to handle issue triaging (#4233) --- .github/fabricbot.json | 407 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 407 insertions(+) diff --git a/.github/fabricbot.json b/.github/fabricbot.json index 1983ffb87d..996f01d760 100644 --- a/.github/fabricbot.json +++ b/.github/fabricbot.json @@ -1,6 +1,413 @@ { "version": "1.0", "tasks": [ + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "taskName": "Add needs triage label to new issues", + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isAction", + "parameters": { + "action": "opened" + } + }, + { + "operator": "not", + "operands": [ + { + "name": "isPartOfProject", + "parameters": {} + } + ] + }, + { + "operator": "not", + "operands": [ + { + "name": "isAssignedToSomeone", + "parameters": {} + } + ] + } + ] + }, + "actions": [ + { + "name": "addLabel", + "parameters": { + "label": "needs-triage" + } + } + ], + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssueCommentResponder", + "version": "1.0", + "config": { + "taskName": "Replace needs author feedback label with needs attention label when the author comments on an issue", + "conditions": { + "operator": "and", + "operands": [ + { + "name": "isAction", + "parameters": { + "action": "created" + } + }, + { + "name": "isActivitySender", + "parameters": { + "user": { + "type": "author" + } + } + }, + { + "name": "hasLabel", + "parameters": { + "label": "needs-author-feedback" + } + }, + { + "name": "isOpen", + "parameters": {} + } + ] + }, + "actions": [ + { + "name": "addLabel", + "parameters": { + "label": "needs-attention" + } + }, + { + "name": "removeLabel", + "parameters": { + "label": "needs-author-feedback" + } + } + ], + "eventType": "issue", + "eventNames": [ + "issue_comment" + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssuesOnlyResponder", + "version": "1.0", + "config": { + "taskName": "Remove no recent activity label from issues", + "conditions": { + "operator": "and", + "operands": [ + { + "operator": "not", + "operands": [ + { + "name": "isAction", + "parameters": { + "action": "closed" + } + } + ] + }, + { + "name": "hasLabel", + "parameters": { + "label": "status-no-recent-activity" + } + } + ] + }, + "actions": [ + { + "name": "removeLabel", + "parameters": { + "label": "status-no-recent-activity" + } + } + ], + "eventType": "issue", + "eventNames": [ + "issues", + "project_card" + ] + } + }, + { + "taskType": "trigger", + "capabilityId": "IssueResponder", + "subCapability": "IssueCommentResponder", + "version": "1.0", + "config": { + "taskName": "Remove no recent activity label when an issue is commented on", + "conditions": { + "operator": "and", + "operands": [ + { + "name": "hasLabel", + "parameters": { + "label": "status-no-recent-activity" + } + } + ] + }, + "actions": [ + { + "name": "removeLabel", + "parameters": { + "label": "status-no-recent-activity" + } + } + ], + "eventType": "issue", + "eventNames": [ + "issue_comment" + ] + } + }, + { + "taskType": "scheduled", + "capabilityId": "ScheduledSearch", + "subCapability": "ScheduledSearch", + "version": "1.1", + "config": { + "taskName": "Add no recent activity label to issues", + "frequency": [ + { + "weekDay": 0, + "hours": [ + 2, + 8, + 14, + 20 + ] + }, + { + "weekDay": 1, + "hours": [ + 2, + 8, + 14, + 20 + ] + }, + { + "weekDay": 2, + "hours": [ + 2, + 8, + 14, + 20 + ] + }, + { + "weekDay": 3, + "hours": [ + 2, + 8, + 14, + 20 + ] + }, + { + "weekDay": 4, + "hours": [ + 2, + 8, + 14, + 20 + ] + }, + { + "weekDay": 5, + "hours": [ + 2, + 8, + 14, + 20 + ] + }, + { + "weekDay": 6, + "hours": [ + 2, + 8, + 14, + 20 + ] + } + ], + "searchTerms": [ + { + "name": "isIssue", + "parameters": {} + }, + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "hasLabel", + "parameters": { + "label": "needs-author-feedback" + } + }, + { + "name": "noActivitySince", + "parameters": { + "days": 10 + } + }, + { + "name": "noLabel", + "parameters": { + "label": "status-no-recent-activity" + } + } + ], + "actions": [ + { + "name": "addLabel", + "parameters": { + "label": "status-no-recent-activity" + } + }, + { + "name": "addReply", + "parameters": { + "comment": "This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **10 days**." + } + } + ] + } + }, + { + "taskType": "scheduled", + "capabilityId": "ScheduledSearch", + "subCapability": "ScheduledSearch", + "version": "1.1", + "config": { + "taskName": "Close duplicate issues", + "frequency": [ + { + "weekDay": 0, + "hours": [ + 3, + 9, + 15, + 21 + ] + }, + { + "weekDay": 1, + "hours": [ + 3, + 9, + 15, + 21 + ] + }, + { + "weekDay": 2, + "hours": [ + 3, + 9, + 15, + 21 + ] + }, + { + "weekDay": 3, + "hours": [ + 3, + 9, + 15, + 21 + ] + }, + { + "weekDay": 4, + "hours": [ + 3, + 9, + 15, + 21 + ] + }, + { + "weekDay": 5, + "hours": [ + 3, + 9, + 15, + 21 + ] + }, + { + "weekDay": 6, + "hours": [ + 3, + 9, + 15, + 21 + ] + } + ], + "searchTerms": [ + { + "name": "isIssue", + "parameters": {} + }, + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "hasLabel", + "parameters": { + "label": "duplicate" + } + }, + { + "name": "noActivitySince", + "parameters": { + "days": 1 + } + } + ], + "actions": [ + { + "name": "addReply", + "parameters": { + "comment": "This issue has been marked as duplicate and has not had any activity for **1 day**. It will be closed for housekeeping purposes." + } + }, + { + "name": "closeIssue", + "parameters": {} + } + ] + } + }, { "taskType": "trigger", "capabilityId": "AutoMerge", From 4fbee6a910c8d454eed58c180fc2a7a132ce8e06 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 29 Dec 2022 14:58:27 +0000 Subject: [PATCH 24/29] [main] Update dependencies from devdiv/DevDiv/vs-code-coverage (#4235) 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 ec0bfa8dbc..d1e3c2af18 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 - 4b193a413b16da6caba33f7831c41dd69de5b6be + 06043a649671ad00fda051bbb4381b23dfe3c776 https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index 80bf028c84..eec9fe5ee2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -82,7 +82,7 @@ JS etc.) is risky. This can break setup authoring and cause runtime failures in workloads where Rolsyn is not installed. --> 3.8.0-3.20427.2 - 17.6.0-beta.22628.2 + 17.6.0-beta.22629.1 0.2.0-preview.22424.1 6.0.0-preview.22424.1 16.6.11 From 92cadb9a7a3937960f9b45548964430d7c9c38f2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 2 Jan 2023 08:01:18 +0100 Subject: [PATCH 25/29] [main] Update dependencies from devdiv/DevDiv/vs-code-coverage (#4237) * Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20221230.2 Microsoft.Internal.CodeCoverage From Version 17.6.0-beta.22629.1 -> To Version 17.6.0-beta.22630.2 * Update dependencies from https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage build 20221231.1 Microsoft.Internal.CodeCoverage From Version 17.6.0-beta.22629.1 -> To Version 17.6.0-beta.22631.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 d1e3c2af18..ea44f9d981 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 - 06043a649671ad00fda051bbb4381b23dfe3c776 + 264ac87847cfdc519cc256e48e1e3fb04c0c90cb https://github.com/dotnet/diagnostics diff --git a/eng/Versions.props b/eng/Versions.props index eec9fe5ee2..25f716a654 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -82,7 +82,7 @@ JS etc.) is risky. This can break setup authoring and cause runtime failures in workloads where Rolsyn is not installed. --> 3.8.0-3.20427.2 - 17.6.0-beta.22629.1 + 17.6.0-beta.22631.1 0.2.0-preview.22424.1 6.0.0-preview.22424.1 16.6.11 From 1f68c6150c8605f7e1049e3c8283d29518ee8233 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 2 Jan 2023 09:42:43 +0100 Subject: [PATCH 26/29] [main] Update dependencies from dotnet/arcade (#4228) Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 20 +++--- eng/Versions.props | 6 +- eng/common/native/init-compiler.sh | 81 +++++++++++------------- eng/common/templates/job/onelocbuild.yml | 14 ++-- eng/common/tools.ps1 | 3 +- eng/common/tools.sh | 4 +- global.json | 4 +- 7 files changed, 65 insertions(+), 67 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ea44f9d981..c77ed6aa96 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -16,26 +16,26 @@ - + https://github.com/dotnet/arcade - 57ba56de330e50f9012493b8ba24818e24ec7817 + 27f876d352ee2a1105c0bf1869cad048141acb3a - + https://github.com/dotnet/arcade - 57ba56de330e50f9012493b8ba24818e24ec7817 + 27f876d352ee2a1105c0bf1869cad048141acb3a - + https://github.com/dotnet/arcade - 57ba56de330e50f9012493b8ba24818e24ec7817 + 27f876d352ee2a1105c0bf1869cad048141acb3a - + https://github.com/dotnet/arcade - 57ba56de330e50f9012493b8ba24818e24ec7817 + 27f876d352ee2a1105c0bf1869cad048141acb3a - + https://github.com/dotnet/arcade - 57ba56de330e50f9012493b8ba24818e24ec7817 + 27f876d352ee2a1105c0bf1869cad048141acb3a https://github.com/dotnet/arcade-services diff --git a/eng/Versions.props b/eng/Versions.props index 25f716a654..0d669d595c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -62,8 +62,8 @@ 2.4.1 2.0.3 2.4.1 - 8.0.0-beta.22616.1 - 8.0.0-beta.22616.1 + 8.0.0-beta.22623.1 + 8.0.0-beta.22623.1 1.22.0 1.1.2 2.0.0 @@ -75,7 +75,7 @@ 1.7.0 1.1.0-beta.20074.1 1.0.0-beta2-19554-01 - 8.0.0-beta.22616.1 + 8.0.0-beta.22623.1 1.0.0-beta.21272.1 3.8.0-3.20427.2 - 17.6.0-beta.22631.1 + 17.6.0-beta.23052.6 0.2.0-preview.22424.1 6.0.0-preview.22424.1 16.6.11 From 3df8944ab0f4581c8077c867e8c76c35db81acd2 Mon Sep 17 00:00:00 2001 From: Marco Rossignoli Date: Tue, 3 Jan 2023 10:37:17 +0100 Subject: [PATCH 29/29] Fix potential trx logger NRE (#4240) Fix potential trx logger NRE --- .../TrxLogger.cs | 34 +++++++++---------- .../TrxLoggerTests.cs | 11 ++++++ 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs index 2170b6accd..436f965a2d 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs @@ -477,28 +477,29 @@ private void ReserveTrxFilePath() private string AcquireTrxFileNamePath(out bool shouldOverwrite) { TPDebug.Assert(IsInitialized, "Logger is not initialized"); - TPDebug.Assert(_parametersDictionary is not null, "_parametersDictionary is null"); shouldOverwrite = false; - var isLogFileNameParameterExists = _parametersDictionary.TryGetValue(TrxLoggerConstants.LogFileNameKey, out string? logFileNameValue) && !logFileNameValue.IsNullOrWhiteSpace(); - var isLogFilePrefixParameterExists = _parametersDictionary.TryGetValue(TrxLoggerConstants.LogFilePrefixKey, out string? logFilePrefixValue) && !logFilePrefixValue.IsNullOrWhiteSpace(); - string? filePath = null; - if (isLogFilePrefixParameterExists) + if (_parametersDictionary is not null) { - if (_parametersDictionary.TryGetValue(DefaultLoggerParameterNames.TargetFramework, out var framework) && framework != null) + var isLogFileNameParameterExists = _parametersDictionary.TryGetValue(TrxLoggerConstants.LogFileNameKey, out string? logFileNameValue) && !logFileNameValue.IsNullOrWhiteSpace(); + var isLogFilePrefixParameterExists = _parametersDictionary.TryGetValue(TrxLoggerConstants.LogFilePrefixKey, out string? logFilePrefixValue) && !logFilePrefixValue.IsNullOrWhiteSpace(); + if (isLogFilePrefixParameterExists) { - framework = NuGetFramework.Parse(framework).GetShortFolderName(); - logFilePrefixValue = logFilePrefixValue + "_" + framework; - } + if (_parametersDictionary.TryGetValue(DefaultLoggerParameterNames.TargetFramework, out var framework) && framework != null) + { + framework = NuGetFramework.Parse(framework).GetShortFolderName(); + logFilePrefixValue = logFilePrefixValue + "_" + framework; + } - filePath = _trxFileHelper.GetNextTimestampFileName(_testResultsDirPath, logFilePrefixValue + _trxFileExtension, "_yyyyMMddHHmmss"); - } - else if (isLogFileNameParameterExists) - { - filePath = Path.Combine(_testResultsDirPath, logFileNameValue!); - shouldOverwrite = true; + filePath = _trxFileHelper.GetNextTimestampFileName(_testResultsDirPath, logFilePrefixValue + _trxFileExtension, "_yyyyMMddHHmmss"); + } + else if (isLogFileNameParameterExists) + { + filePath = Path.Combine(_testResultsDirPath, logFileNameValue!); + shouldOverwrite = true; + } } filePath ??= SetDefaultTrxFilePath(); @@ -746,12 +747,11 @@ private void UpdateTestEntries(Guid executionId, Guid parentExecutionId, ITestEl private TrxLoggerObjectModel.TestOutcome ChangeTestOutcomeIfNecessary(TrxLoggerObjectModel.TestOutcome outcome) { TPDebug.Assert(IsInitialized, "Logger is not initialized"); - TPDebug.Assert(_parametersDictionary is not null, "_parametersDictionary is null"); // If no tests discovered/executed and TreatNoTestsAsError was set to True // We will return ResultSummary as Failed // Note : we only send the value of TreatNoTestsAsError if it is "True" - if (TotalTestCount == 0 && _parametersDictionary.ContainsKey(ObjectModelConstants.TreatNoTestsAsError)) + if (TotalTestCount == 0 && _parametersDictionary?.ContainsKey(ObjectModelConstants.TreatNoTestsAsError) == true) { outcome = TrxLoggerObjectModel.TestOutcome.Failed; } diff --git a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs index f9cf3f8e1f..6f8319c5ed 100644 --- a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/TrxLoggerTests.cs @@ -857,6 +857,17 @@ public void IntializeShouldThrowExceptionIfBothPrefixAndNameProvided() Assert.ThrowsException(() => _testableTrxLogger.Initialize(_events.Object, _parameters)); } + [TestMethod] + public void SkipInitializeDictionaryShouldNotFail() + { + var logger = new TestableTrxLogger(); + logger.Initialize(_events.Object, Path.GetTempPath()); + var testRunCompleteEventArgs = CreateTestRunCompleteEventArgs(); + logger.TestRunCompleteHandler(new object(), testRunCompleteEventArgs); + Assert.IsTrue(File.Exists(logger.TrxFile)); + File.Delete(logger.TrxFile); + } + private void ValidateTestIdAndNameInTrx() { TestCase testCase = CreateTestCase("TestCase");