From 28e9a84d1440e2768546bbe9c1fe1bbc4525d8b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Fri, 15 Jul 2022 16:15:04 +0200 Subject: [PATCH 01/34] Fix TraitCollection label --- src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs b/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs index b4cb4e641e..a08f195822 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs @@ -23,10 +23,11 @@ public class TraitCollection : IEnumerable // TODO: Fix this with proper resourcing for UWP and Win 8.1 Apps // Trying to access resources will throw "MissingManifestResourceException" percolated as "TypeInitialization" exception "Traits", + #else Resources.Resources.TestCasePropertyTraitsLabel, #endif - typeof(KeyValuePair[]), + typeof(KeyValuePair[]), #pragma warning disable 618 TestPropertyAttributes.Hidden | TestPropertyAttributes.Trait, #pragma warning restore 618 From 2312f29211e91614b80f37f5a07bc722e07776a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Fri, 15 Jul 2022 16:52:32 +0200 Subject: [PATCH 02/34] Add build var TargetNetFxVersion --- scripts/build/TestPlatform.Settings.targets | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/build/TestPlatform.Settings.targets b/scripts/build/TestPlatform.Settings.targets index 4365688875..c9543b7d78 100644 --- a/scripts/build/TestPlatform.Settings.targets +++ b/scripts/build/TestPlatform.Settings.targets @@ -11,6 +11,7 @@ preview true enable + net462 + + diff --git a/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj b/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj index 51304bd236..08ca15093b 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj +++ b/src/Microsoft.TestPlatform.ObjectModel/Microsoft.TestPlatform.ObjectModel.csproj @@ -6,7 +6,7 @@ Microsoft.VisualStudio.TestPlatform.ObjectModel - $(TargetNetFxVersion);netcoreapp2.1;netcoreapp1.0;netstandard2.0;netstandard1.3 + $(TargetNetFxVersion);$(TargetNetCoreVersion);netstandard2.0;netstandard1.3 $(TargetFrameworks);uap10.0;netstandard1.0 net6.0 Microsoft.TestPlatform.ObjectModel @@ -43,7 +43,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs b/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs index 6f339b0be7..80f0426ce6 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs @@ -71,9 +71,9 @@ public static bool ContainsDataCollector(IXPathNavigable runSettingDocument, str var navigator = runSettingDocument.CreateNavigator(); var nodes = navigator!.Select("/RunSettings/DataCollectionRunSettings/DataCollectors/DataCollector"); - foreach (XPathNavigator dataCollectorNavigator in nodes) + foreach (XPathNavigator? dataCollectorNavigator in nodes) { - var uri = dataCollectorNavigator.GetAttribute("uri", string.Empty); + var uri = dataCollectorNavigator?.GetAttribute("uri", string.Empty); if (string.Equals(dataCollectorUri, uri, StringComparison.OrdinalIgnoreCase)) { return true; @@ -101,9 +101,9 @@ public static IList GetDataCollectorsFriendlyName(string? runsettingsXml var runSettingsNavigator = document.CreateNavigator(); var nodes = runSettingsNavigator!.Select("/RunSettings/DataCollectionRunSettings/DataCollectors/DataCollector"); - foreach (XPathNavigator dataCollectorNavigator in nodes) + foreach (XPathNavigator? dataCollectorNavigator in nodes) { - var friendlyName = dataCollectorNavigator.GetAttribute("friendlyName", string.Empty); + var friendlyName = dataCollectorNavigator?.GetAttribute("friendlyName", string.Empty); friendlyNameList.Add(friendlyName); } } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Microsoft.TestPlatform.PlatformAbstractions.csproj b/src/Microsoft.TestPlatform.PlatformAbstractions/Microsoft.TestPlatform.PlatformAbstractions.csproj index 7de06f6ae0..4b15232298 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/Microsoft.TestPlatform.PlatformAbstractions.csproj +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Microsoft.TestPlatform.PlatformAbstractions.csproj @@ -7,12 +7,11 @@ Microsoft.TestPlatform.PlatformAbstractions Microsoft.TestPlatform.PlatformAbstractions - $(TargetNetFxVersion);netcoreapp1.0;netcoreapp2.1;netstandard1.3;netstandard2.0;net6.0 + $(TargetNetFxVersion);$(TargetNetCoreVersion);netstandard1.3;netstandard2.0;net6.0 $(TargetFrameworks);uap10.0;netstandard1.0 net6.0 false - - $(NoWarn);NU1605 + $(NoWarn);NU1605 @@ -26,7 +25,7 @@ $(DefineConstants);WINDOWS_UWP - + diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/PlatformThread.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/PlatformThread.cs index f1c6c8be68..78afab12b2 100644 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/PlatformThread.cs +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/netcore/System/PlatformThread.cs @@ -39,7 +39,6 @@ public void Run(Action? action, PlatformApartmentState apartmentState, bool wait } }); - // ApartmentState is not supported in netcoreapp1.0. thread.IsBackground = true; thread.Start(); if (waitForCompletion) diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index d1e3665b2b..aa2359df1c 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -287,8 +287,8 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( testHostPath = GetTestHostPath(runtimeConfigDevPath, depsFilePath, sourceDirectory); if (!testHostPath.IsNullOrWhiteSpace() && testHostPath.IndexOf("microsoft.testplatform.testhost", StringComparison.OrdinalIgnoreCase) >= 0) { - // testhost.dll is present in path {testHostNugetRoot}\lib\netcoreapp2.1\testhost.dll - // testhost.(x86).exe is present in location {testHostNugetRoot}\build\netcoreapp2.1\{x86/x64}\{testhost.x86.exe/testhost.exe} + // testhost.dll is present in path {testHostNugetRoot}\lib\netcoreapp3.1\testhost.dll + // testhost.(x86).exe is present in location {testHostNugetRoot}\build\netcoreapp3.1\{x86/x64}\{testhost.x86.exe/testhost.exe} var folderName = _architecture is Architecture.X64 or Architecture.Default or Architecture.AnyCPU ? Architecture.X64.ToString().ToLowerInvariant() : _architecture.ToString().ToLowerInvariant(); @@ -298,7 +298,7 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( #if DOTNET_BUILD_FROM_SOURCE var testHostExeNugetPath = Path.Combine(testHostNugetRoot.FullName, "build", "net6.0", folderName, exeName); #else - var testHostExeNugetPath = Path.Combine(testHostNugetRoot.FullName, "build", "netcoreapp2.1", folderName, exeName); + var testHostExeNugetPath = Path.Combine(testHostNugetRoot.FullName, "build", "netcoreapp3.1", folderName, exeName); #endif if (_fileHelper.Exists(testHostExeNugetPath)) diff --git a/src/datacollector/datacollector.csproj b/src/datacollector/datacollector.csproj index 7905489dc3..7a6bf8e0f8 100644 --- a/src/datacollector/datacollector.csproj +++ b/src/datacollector/datacollector.csproj @@ -11,7 +11,7 @@ datacollector datacollector.arm64 - netcoreapp2.1 + $(TargetNetCoreVersion) $(TargetFrameworks);net472 $(TargetFrameworks);$(TargetNetFxVersion) net6.0 diff --git a/src/package/nuspec/Microsoft.CodeCoverage.nuspec b/src/package/nuspec/Microsoft.CodeCoverage.nuspec index 121c92dcb5..6b9741cb6a 100644 --- a/src/package/nuspec/Microsoft.CodeCoverage.nuspec +++ b/src/package/nuspec/Microsoft.CodeCoverage.nuspec @@ -21,7 +21,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -73,7 +73,7 @@ - + diff --git a/src/package/nuspec/Microsoft.NET.Test.Sdk.nuspec b/src/package/nuspec/Microsoft.NET.Test.Sdk.nuspec index 5daf102394..7653b82084 100644 --- a/src/package/nuspec/Microsoft.NET.Test.Sdk.nuspec +++ b/src/package/nuspec/Microsoft.NET.Test.Sdk.nuspec @@ -27,11 +27,7 @@ - - - - - + @@ -44,18 +40,15 @@ - - + - - + - - + diff --git a/src/package/nuspec/Microsoft.TestPlatform.CLI.csproj b/src/package/nuspec/Microsoft.TestPlatform.CLI.csproj index b74d7ba0a6..db9fbdba03 100644 --- a/src/package/nuspec/Microsoft.TestPlatform.CLI.csproj +++ b/src/package/nuspec/Microsoft.TestPlatform.CLI.csproj @@ -1,7 +1,7 @@ Exe - netcoreapp2.1 + $(TargetNetCoreVersion) net6.0 false TestPlatform.CLI.nuspec diff --git a/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec b/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec index c0ec204bcd..9c7efb1590 100644 --- a/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec +++ b/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec @@ -294,341 +294,341 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/package/nuspec/TestPlatform.ObjectModel.nuspec b/src/package/nuspec/TestPlatform.ObjectModel.nuspec index 7b5d08c1a0..1d0c405c3e 100644 --- a/src/package/nuspec/TestPlatform.ObjectModel.nuspec +++ b/src/package/nuspec/TestPlatform.ObjectModel.nuspec @@ -25,12 +25,7 @@ - - - - - - + @@ -124,25 +119,15 @@ - - - - - - - - - - - - - - + + + + - - - + + + diff --git a/src/package/nuspec/TestPlatform.TestHost.nuspec b/src/package/nuspec/TestPlatform.TestHost.nuspec index 1300db90af..0fff8c139a 100644 --- a/src/package/nuspec/TestPlatform.TestHost.nuspec +++ b/src/package/nuspec/TestPlatform.TestHost.nuspec @@ -20,20 +20,7 @@ commit="$CommitId$" /> - - - - - - - - - - - - - - + @@ -57,32 +44,17 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - + + + + - + @@ -194,90 +166,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/package/package/package.csproj b/src/package/package/package.csproj index 2d4d044286..9ec1f8e390 100644 --- a/src/package/package/package.csproj +++ b/src/package/package/package.csproj @@ -5,7 +5,7 @@ - $(TargetNetFxVersion);netcoreapp2.1 + $(TargetNetFxVersion);$(TargetNetCoreVersion) net6.0 package false diff --git a/src/package/sign/sign.proj b/src/package/sign/sign.proj index 67ee596712..f73b398801 100644 --- a/src/package/sign/sign.proj +++ b/src/package/sign/sign.proj @@ -21,11 +21,8 @@ $(ArtifactsBaseDirectory)$(TargetFramework)\$(TargetRuntime)\ - - $(ArtifactsBaseDirectory)netcoreapp2.1\ - - - $(ArtifactsBaseDirectory)netcoreapp1.0\ + + $(ArtifactsBaseDirectory)netcoreapp3.1\ $(ArtifactsBaseDirectory)netstandard1.0\ @@ -152,55 +149,51 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -226,28 +219,28 @@ - - - - - - - - + + + + + + + + - + - - + + - - + + @@ -258,40 +251,23 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -329,14 +305,12 @@ - - + - - + @@ -372,15 +346,10 @@ StrongName - - Microsoft400 - StrongName - - - + Microsoft400 StrongName - + Microsoft400 @@ -449,9 +418,9 @@ IntermediatesDirectory="$(IntermediatesDirectory)" Type="$(SignType)" /> - - + diff --git a/src/testhost.arm64/testhost.arm64.csproj b/src/testhost.arm64/testhost.arm64.csproj index 65aa9de61f..b23e53ecbb 100644 --- a/src/testhost.arm64/testhost.arm64.csproj +++ b/src/testhost.arm64/testhost.arm64.csproj @@ -11,13 +11,13 @@ testhost.arm64 - netcoreapp2.1;netcoreapp1.0;$(TargetNetFxVersion);net47;net471;net472;net48 + $(TargetNetCoreVersion);$(TargetNetFxVersion);net47;net471;net472;net48 net6.0 Exe false app.manifest - + win10-arm64 false $(AssemblyName.Replace('.arm64', '')).$(TargetFramework).arm64 @@ -28,11 +28,6 @@ - - - - - @@ -46,7 +41,7 @@ - + diff --git a/src/testhost.x86/testhost.x86.csproj b/src/testhost.x86/testhost.x86.csproj index ef34d2b62c..b14f562d5b 100644 --- a/src/testhost.x86/testhost.x86.csproj +++ b/src/testhost.x86/testhost.x86.csproj @@ -11,7 +11,7 @@ testhost.x86 - netcoreapp2.1;netcoreapp1.0;$(TargetNetFxVersion);net47;net471;net472;net48 + $(TargetNetCoreVersion);$(TargetNetFxVersion);net47;net471;net472;net48 net6.0 AnyCPU true @@ -19,7 +19,7 @@ false app.manifest - + win7-x86 false $(AssemblyName.Replace('.x86', '')).$(TargetFramework).x86 @@ -27,11 +27,6 @@ - - - - - @@ -45,7 +40,7 @@ - + diff --git a/src/testhost/testhost.csproj b/src/testhost/testhost.csproj index 9dcf7be417..ce52d0ac90 100644 --- a/src/testhost/testhost.csproj +++ b/src/testhost/testhost.csproj @@ -11,13 +11,13 @@ testhost - netcoreapp2.1;netcoreapp1.0;$(TargetNetFxVersion);net47;net471;net472;net48 + $(TargetNetCoreVersion);$(TargetNetFxVersion);net47;net471;net472;net48 net6.0 Exe false app.manifest - + win7-x64 false $(AssemblyName).$(TargetFramework) @@ -28,11 +28,6 @@ - - - - - @@ -46,7 +41,7 @@ - + diff --git a/src/vstest.console/CommandLine/TestRunResultAggregator.cs b/src/vstest.console/CommandLine/TestRunResultAggregator.cs index 7a75bfae43..77f55fe667 100644 --- a/src/vstest.console/CommandLine/TestRunResultAggregator.cs +++ b/src/vstest.console/CommandLine/TestRunResultAggregator.cs @@ -79,7 +79,7 @@ public void Reset() /// /// Called when a test run is complete. /// - private void TestRunCompletionHandler(object sender, TestRunCompleteEventArgs e) + private void TestRunCompletionHandler(object? sender, TestRunCompleteEventArgs e) { if (e.TestRunStatistics == null || e.IsCanceled || e.IsAborted) { @@ -94,7 +94,7 @@ private void TestRunCompletionHandler(object sender, TestRunCompleteEventArgs e) /// /// Called when a test run message is sent. /// - private void TestRunMessageHandler(object sender, TestRunMessageEventArgs e) + private void TestRunMessageHandler(object? sender, TestRunMessageEventArgs e) { if (e.Level == TestMessageLevel.Error) { diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index 686c5a5081..b3fce12fa6 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -413,7 +413,7 @@ private static Guid GetExecutionId(TestResult testResult) /// /// Called when a test run start is received /// - private void TestRunStartHandler(object sender, TestRunStartEventArgs e) + private void TestRunStartHandler(object? sender, TestRunStartEventArgs e) { ValidateArg.NotNull(sender, nameof(sender)); ValidateArg.NotNull(e, nameof(e)); @@ -433,7 +433,7 @@ private void TestRunStartHandler(object sender, TestRunStartEventArgs e) /// /// Called when a test message is received. /// - private void TestMessageHandler(object sender, TestRunMessageEventArgs e) + private void TestMessageHandler(object? sender, TestRunMessageEventArgs e) { ValidateArg.NotNull(sender, nameof(sender)); ValidateArg.NotNull(e, nameof(e)); @@ -499,7 +499,7 @@ private void TestMessageHandler(object sender, TestRunMessageEventArgs e) /// /// Called when a test result is received. /// - private void TestResultHandler(object sender, TestResultEventArgs e) + private void TestResultHandler(object? sender, TestResultEventArgs e) { ValidateArg.NotNull(sender, nameof(sender)); ValidateArg.NotNull(e, nameof(e)); @@ -668,7 +668,7 @@ private void TestResultHandler(object sender, TestResultEventArgs e) /// /// Called when a test run is completed. /// - private void TestRunCompleteHandler(object sender, TestRunCompleteEventArgs e) + private void TestRunCompleteHandler(object? sender, TestRunCompleteEventArgs e) { TPDebug.Assert(Output != null, "Initialize should have been called"); diff --git a/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs b/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs index 4259cd5b45..b054c3c832 100644 --- a/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs @@ -213,7 +213,7 @@ public void UnregisterDiscoveryEvents(IDiscoveryRequest discoveryRequest) discoveryRequest.OnDiscoveredTests -= DiscoveryRequest_OnDiscoveredTests; } - private void DiscoveryRequest_OnDiscoveredTests(object sender, DiscoveredTestsEventArgs args) + private void DiscoveryRequest_OnDiscoveredTests(object? sender, DiscoveredTestsEventArgs args) { if (args == null) { @@ -350,7 +350,7 @@ private static Dictionary> GetTestPropertiesInTraitDictiona //always return value as a list of string if (testPropertyValue != null) { - var multiValue = new List { testPropertyValue.ToString() }; + var multiValue = new List { testPropertyValue.ToString()! }; traitDictionary.Add(testPropertyKey, multiValue); } } @@ -366,7 +366,7 @@ private static Dictionary> GetTraitsInTraitDictionary(Dicti foreach (var trait in traits) { var newTraitValueList = new List { trait.Value }; - if (!traitDictionary.TryGetValue(trait.Name, out List currentTraitValue)) + if (!traitDictionary.TryGetValue(trait.Name, out List? currentTraitValue)) { // if the current trait's key is not already present, add the current trait key-value pair traitDictionary.Add(trait.Name, newTraitValueList); @@ -402,7 +402,7 @@ private static Dictionary> GetTraitsInTraitDictionary(Dicti /// private static string[]? PropertyValueProvider(string propertyName, Dictionary> traitDictionary) { - traitDictionary.TryGetValue(propertyName, out List propertyValueList); + traitDictionary.TryGetValue(propertyName, out List? propertyValueList); if (propertyValueList != null) { var propertyValueArray = propertyValueList.ToArray(); diff --git a/src/vstest.console/Processors/ListTestsArgumentProcessor.cs b/src/vstest.console/Processors/ListTestsArgumentProcessor.cs index 794df8928a..a8e3a84d7c 100644 --- a/src/vstest.console/Processors/ListTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/ListTestsArgumentProcessor.cs @@ -210,7 +210,7 @@ public void UnregisterDiscoveryEvents(IDiscoveryRequest discoveryRequest) discoveryRequest.OnDiscoveredTests -= DiscoveryRequest_OnDiscoveredTests; } - private void DiscoveryRequest_OnDiscoveredTests(object sender, DiscoveredTestsEventArgs args) + private void DiscoveryRequest_OnDiscoveredTests(object? sender, DiscoveredTestsEventArgs args) { // List out each of the tests. foreach (var test in args.DiscoveredTestCases!) diff --git a/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs b/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs index be2fffb2cf..c143cc48e5 100644 --- a/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs @@ -269,7 +269,7 @@ private void ExecuteSelectedTests() /// /// /// - private void DiscoveryRequest_OnDiscoveredTests(object sender, DiscoveredTestsEventArgs args) + private void DiscoveryRequest_OnDiscoveredTests(object? sender, DiscoveredTestsEventArgs args) { TPDebug.Assert(_selectedTestNames != null, "Initialize should have been called"); @@ -348,7 +348,7 @@ public void UnregisterTestRunEvents(ITestRunRequest testRunRequest) /// /// /// RunCompletion args - private void TestRunRequest_OnRunCompletion(object sender, TestRunCompleteEventArgs e) + private void TestRunRequest_OnRunCompletion(object? sender, TestRunCompleteEventArgs e) { // If run is not aborted/canceled then check the count of executed tests. // we need to check if there are any tests executed - to try show some help info to user to check for installed vsix extensions diff --git a/src/vstest.console/Processors/RunTestsArgumentProcessor.cs b/src/vstest.console/Processors/RunTestsArgumentProcessor.cs index b09ee265bb..010d0588b8 100644 --- a/src/vstest.console/Processors/RunTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/RunTestsArgumentProcessor.cs @@ -208,7 +208,7 @@ public void UnregisterTestRunEvents(ITestRunRequest testRunRequest) /// /// /// RunCompletion args - private void TestRunRequest_OnRunCompletion(object sender, TestRunCompleteEventArgs e) + private void TestRunRequest_OnRunCompletion(object? sender, TestRunCompleteEventArgs e) { // If run is not aborted/canceled then check the count of executed tests. // we need to check if there are any tests executed - to try show some help info to user to check for installed vsix extensions diff --git a/src/vstest.console/vstest.console.csproj b/src/vstest.console/vstest.console.csproj index 2d106c009c..d7a3d0567b 100644 --- a/src/vstest.console/vstest.console.csproj +++ b/src/vstest.console/vstest.console.csproj @@ -8,7 +8,7 @@ vstest.console vstest.console.arm64 - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) net6.0 Exe Major diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs b/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs index 75fe0f5b0a..f7be49c4d5 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs @@ -17,7 +17,6 @@ public class AcceptanceTestBase : IntegrationTestBase public const string Net471TargetFramework = "net471"; public const string Net472TargetFramework = "net472"; public const string Net48TargetFramework = "net48"; - public const string Core21TargetFramework = "netcoreapp2.1"; public const string Core31TargetFramework = "netcoreapp3.1"; public const string Core50TargetFramework = "net5.0"; public const string Core60TargetFramework = "net6.0"; @@ -29,7 +28,6 @@ public class AcceptanceTestBase : IntegrationTestBase public const string Net472FrameworkArgValue = ".NETFramework,Version=v4.7.2"; public const string Net48FrameworkArgValue = ".NETFramework,Version=v4.8"; - public const string Core21FrameworkArgValue = ".NETCoreApp,Version=v2.1"; public const string Core31FrameworkArgValue = ".NETCoreApp,Version=v3.1"; public const string Core50FrameworkArgValue = ".NETCoreApp,Version=v5.0"; public const string Core60FrameworkArgValue = ".NETCoreApp,Version=v6.0"; @@ -39,15 +37,16 @@ public class AcceptanceTestBase : IntegrationTestBase public const string InIsolation = "/InIsolation"; public const string NETFX462_48 = "net462;net472;net48"; - public const string NETCORE21_50 = "netcoreapp2.1;netcoreapp3.1;net5.0"; - public const string NETFX462_NET50 = "net462;net472;net48;netcoreapp2.1;netcoreapp3.1;net5.0"; - public const string NETFX462_NET31 = "net462;net472;net48;netcoreapp2.1;netcoreapp3.1"; + public const string NETCORE21_50 = "netcoreapp3.1;net5.0"; + public const string NETFX462_NET50 = "net462;net472;net48;netcoreapp3.1;net5.0"; + public const string NETFX462_NET31 = "net462;net472;net48;netcoreapp3.1"; public const string DEFAULT_RUNNER_NETFX = Net462TargetFramework; + public const string DEFAULT_RUNNER_NETCORE = Core31TargetFramework; /// /// Our current defaults for .NET and .NET Framework. /// - public const string DEFAULT_RUNNER_NETFX_AND_NET = $"{DEFAULT_RUNNER_NETFX};netcoreapp2.1"; - public const string DEFAULT_HOST_NETFX_AND_NET = "net462;netcoreapp2.1"; + public const string DEFAULT_RUNNER_NETFX_AND_NET = $"{DEFAULT_RUNNER_NETFX};{DEFAULT_RUNNER_NETCORE}"; + public const string DEFAULT_HOST_NETFX_AND_NET = "net462;netcoreapp3.1"; public const string LATEST_TO_LEGACY = "Latest;LatestPreview;LatestStable;RecentStable;MostDownloaded;PreviousStable;LegacyStable"; public const string LATESTPREVIEW_TO_LEGACY = "LatestPreview;LatestStable;RecentStable;MostDownloaded;PreviousStable;LegacyStable"; public const string LATEST = "Latest"; @@ -76,7 +75,6 @@ protected static void SetTestEnvironment(IntegrationTestEnvironment testEnvironm protected static string DeriveFrameworkArgValue(IntegrationTestEnvironment testEnvironment) => testEnvironment.TargetFramework switch { - Core21TargetFramework => Core21FrameworkArgValue, Core31TargetFramework => Core31FrameworkArgValue, Core50TargetFramework => Core50FrameworkArgValue, Core60TargetFramework => Core60FrameworkArgValue, diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/DifferentTestFrameworkSimpleTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/DifferentTestFrameworkSimpleTests.cs index 826c0442c2..950cb1a629 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/DifferentTestFrameworkSimpleTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/DifferentTestFrameworkSimpleTests.cs @@ -54,7 +54,7 @@ public void CPPRunAllTestExecutionPlatformx64NetFramework(RunnerInfo runnerInfo) // C++ tests cannot run in .NET Framework host under .NET Core, because we only ship .NET Standard CPP adapter in .NET Core // We also don't test x86 for .NET Core, because the resolver there does not switch between x86 and x64 correctly, it just uses the parent process bitness. // We run this on netcore31 and not the default netcore21 because netcore31 is the minimum tfm that has the runtime features we need, such as additionaldeps. - [NetCoreTargetFrameworkDataSource(useDesktopRunner: false, useCoreRunner: true, useNetCore21Target: false, useNetCore31Target: true)] + [NetCoreTargetFrameworkDataSource(useDesktopRunner: false, useCoreRunner: true, useNetCore31Target: true)] public void CPPRunAllTestExecutionPlatformx64Net(RunnerInfo runnerInfo) { SetTestEnvironment(_testEnvironment, runnerInfo); diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs index 0c330e6c30..55cfa933e5 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs @@ -23,7 +23,6 @@ public class NetCoreTargetFrameworkDataSourceAttribute : Attribute, ITestDataSou { private readonly bool _useDesktopRunner; private readonly bool _useCoreRunner; - private readonly bool _useNetCore21Target; private readonly bool _useNetCore31Target; /// @@ -36,14 +35,10 @@ public NetCoreTargetFrameworkDataSourceAttribute( // adding another runner is not necessary until we need to start building against another // sdk, because the netcoreapp2.1 executable is forward compatible bool useCoreRunner = true, - bool useNetCore21Target = true, - // laying the ground work here for tests to be able to run against 3.1 but not enabling it for - // all tests to avoid changing all acceptance tests right now - bool useNetCore31Target = false) + bool useNetCore31Target = true) { _useDesktopRunner = useDesktopRunner; _useCoreRunner = useCoreRunner; - _useNetCore21Target = useNetCore21Target; _useNetCore31Target = useNetCore31Target; } @@ -77,10 +72,6 @@ public IEnumerable GetData(MethodInfo methodInfo) if (_useDesktopRunner && isWindows) { var runnerFramework = IntegrationTestBase.DesktopRunnerFramework; - if (_useNetCore21Target) - { - AddRunnerDataRow(dataRows, runnerFramework, AcceptanceTestBase.Core21TargetFramework); - } if (_useNetCore31Target) { @@ -91,10 +82,6 @@ public IEnumerable GetData(MethodInfo methodInfo) if (_useCoreRunner) { var runnerFramework = IntegrationTestBase.CoreRunnerFramework; - if (_useNetCore21Target) - { - AddRunnerDataRow(dataRows, runnerFramework, AcceptanceTestBase.Core21TargetFramework); - } if (_useNetCore31Target) { diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/ProcessesInteractionTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/ProcessesInteractionTests.cs index 1e0c1174bf..7ed44c56a4 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/ProcessesInteractionTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/ProcessesInteractionTests.cs @@ -22,7 +22,7 @@ public void WhenTestHostProcessExitsBecauseTheTargetedRuntimeIsNoFoundThenTheMes // Arrange SetTestEnvironment(_testEnvironment, runnerInfo); const string testAssetProjectName = "SimpleTestProjectMessedUpTargetFramework"; - var assemblyPath = GetTestDllForFramework(testAssetProjectName + ".dll", Core21TargetFramework); + var assemblyPath = GetTestDllForFramework(testAssetProjectName + ".dll", Core31TargetFramework); UpdateRuntimeConfigJsonWithInvalidFramework(assemblyPath, testAssetProjectName); // Act diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/SelfContainedAppTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/SelfContainedAppTests.cs index 3e72203f31..4c30a7c8ed 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/SelfContainedAppTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/SelfContainedAppTests.cs @@ -13,9 +13,7 @@ public class SelfContainedAppTests : AcceptanceTestBase { [TestMethod] [TestCategory("Windows-Review")] - // this is core 3.1 only, full framework and netcoreapp2.1 don't "publish" automatically during build - // but if you run it on 2.1 it will pass because we execute the test normally - [NetCoreTargetFrameworkDataSourceAttribute(useDesktopRunner: false, useNetCore21Target: false, useNetCore31Target: true)] + [NetCoreTargetFrameworkDataSourceAttribute(useDesktopRunner: false, useNetCore31Target: true)] public void RunningApplicationThatIsBuiltAsSelfContainedWillNotFailToFindHostpolicyDll(RunnerInfo runnerInfo) { // when the application is self-contained which is dictated by the RuntimeIdentifier and OutputType project diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTests.cs index 5802c288de..f12979d2d4 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTests.cs @@ -72,7 +72,7 @@ public void RunAllTestsWithMixedTFMsWillFailToRunTestsFromTheIncompatibleTFMDll( var vstestConsoleWrapper = GetVsTestConsoleWrapper(); var runEventHandler = new RunEventHandler(); var compatibleDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_RUNNER_NETFX); - var incompatibleDll = GetTestDllForFramework("MSTestProject1.dll", "netcoreapp2.1"); + var incompatibleDll = GetTestDllForFramework("MSTestProject1.dll", "netcoreapp3.1"); // Act // We have no preference around what TFM is used. It will be autodetected. @@ -95,7 +95,7 @@ public void RunAllTestsWithMixedTFMsWillRunTestsFromAllProvidedDllEvenWhenTheyMi var vstestConsoleWrapper = GetVsTestConsoleWrapper(); var runEventHandler = new RunEventHandler(); var netFrameworkDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_RUNNER_NETFX); - var netDll = GetTestDllForFramework("MSTestProject1.dll", "netcoreapp2.1"); + var netDll = GetTestDllForFramework("MSTestProject1.dll", "netcoreapp3.1"); // Act // We have no preference around what TFM is used. It will be autodetected. diff --git a/test/Microsoft.TestPlatform.Common.PlatformTests/AssemblyPropertiesTests.cs b/test/Microsoft.TestPlatform.Common.PlatformTests/AssemblyPropertiesTests.cs index 4c470a4959..b8ef96b9ec 100644 --- a/test/Microsoft.TestPlatform.Common.PlatformTests/AssemblyPropertiesTests.cs +++ b/test/Microsoft.TestPlatform.Common.PlatformTests/AssemblyPropertiesTests.cs @@ -20,7 +20,7 @@ public AssemblyPropertiesTests() [TestMethod] [DataRow("net462")] - [DataRow("netcoreapp2.1")] + [DataRow("netcoreapp3.1")] public void GetAssemblyTypeForManagedDll(string framework) { var assemblyPath = _testEnvironment.GetTestAsset("SimpleTestProject3.dll", framework); @@ -48,7 +48,7 @@ public void GetAssemblyTypeForManagedExe() } [TestMethod] - [DataRow("netcoreapp2.1")] + [DataRow("netcoreapp3.1")] public void GetAssemblyTypeForNetCoreManagedExe(string framework) { var assemblyPath = _testEnvironment.GetTestAsset("ConsoleManagedApp.dll", framework); diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketClientTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketClientTests.cs index 458e2bbc36..e0516e1a45 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketClientTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketClientTests.cs @@ -37,13 +37,8 @@ public SocketClientTests() public void Dispose() { _socketClient.Stop(); -#if NETFRAMEWORK // tcpClient.Close() calls tcpClient.Dispose(). _tcpClient?.Close(); -#else - // tcpClient.Close() not available for netcoreapp1.0 - _tcpClient?.Dispose(); -#endif GC.SuppressFinalize(this); } diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketCommunicationManagerTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketCommunicationManagerTests.cs index ee29abb159..f10aa1ccfe 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketCommunicationManagerTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketCommunicationManagerTests.cs @@ -42,13 +42,8 @@ public SocketCommunicationManagerTests() public void Dispose() { _tcpListener.Stop(); -#if NETFRAMEWORK // tcpClient.Close() calls tcpClient.Dispose(). _tcpClient?.Close(); -#else - // tcpClient.Close() not available for netcoreapp1.0 - _tcpClient?.Dispose(); -#endif _communicationManager.StopServer(); _communicationManager.StopClient(); GC.SuppressFinalize(this); diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketServerTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketServerTests.cs index 3fb22e37ac..249ebbfa1f 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketServerTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketServerTests.cs @@ -35,13 +35,8 @@ public SocketServerTests() public void Dispose() { _socketServer.Stop(); -#if NETFRAMEWORK // tcpClient.Close() calls tcpClient.Dispose(). _tcpClient?.Close(); -#else - // tcpClient.Close() not available for netcoreapp1.0 - _tcpClient?.Dispose(); -#endif GC.SuppressFinalize(this); } diff --git a/test/Microsoft.TestPlatform.SmokeTests/DotnetHostArchitectureVerifierTests.cs b/test/Microsoft.TestPlatform.SmokeTests/DotnetHostArchitectureVerifierTests.cs index ef73a36798..4f14531588 100644 --- a/test/Microsoft.TestPlatform.SmokeTests/DotnetHostArchitectureVerifierTests.cs +++ b/test/Microsoft.TestPlatform.SmokeTests/DotnetHostArchitectureVerifierTests.cs @@ -22,7 +22,7 @@ public class DotnetHostArchitectureVerifierTests : IntegrationTestBase [DataRow("X86")] public void VerifyHostArchitecture(string architecture) { - _testEnvironment.RunnerFramework = "netcoreapp2.1"; + _testEnvironment.RunnerFramework = "netcoreapp3.1"; string dotnetPath = GetDownloadedDotnetMuxerFromTools(architecture); var vstestConsolePath = GetDotnetRunnerPath(); var dotnetRunnerPath = TempDirectory.CreateDirectory("dotnetrunner"); diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs index c3cf1a5d7a..4249b83ff4 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs @@ -628,7 +628,7 @@ public void GetTestHostProcessStartInfoShouldIncludeTestHostPathFromSourceDirect StringAssert.Contains(startInfo.Arguments, expectedTestHostPath); } - // TODO: This assembly was previously compiled as net472 and so it was skipped and only ran as netcoreapp2.1. This fails in test, but works in code that is not isolated in appdomain. Might be worth fixing because we get one null here, and another in DotnetTestHostManager. + // TODO: This assembly was previously compiled as net472 and so it was skipped and only ran as netcoreapp3.1. This fails in test, but works in code that is not isolated in appdomain. Might be worth fixing because we get one null here, and another in DotnetTestHostManager. // Assembly.GetEntryAssembly().Location is null because of running in app domain. #if NET [TestMethod] @@ -656,7 +656,7 @@ public void GetTestHostProcessStartInfoShouldIncludeTestHostPathNextToTestRunner #endif - // TODO: This assembly was previously compiled as net472 and so it was skipped and only ran as netcoreapp2.1. This fails in test, but works in code that is not isolated in appdomain. Might be worth fixing because we get one null here, and another in DotnetTestHostManager. + // TODO: This assembly was previously compiled as net472 and so it was skipped and only ran as netcoreapp3.1. This fails in test, but works in code that is not isolated in appdomain. Might be worth fixing because we get one null here, and another in DotnetTestHostManager. // Assembly.GetEntryAssembly().Location is null because of running in app domain. #if NET @@ -665,8 +665,6 @@ 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("netcoreapp1.0", "latest")] - [DataRow("netcoreapp2.1", "2.1")] [DataRow("netcoreapp3.1", "3.1")] [DataRow("net5.0", "5.0")] diff --git a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs index e0f352f562..3574584a11 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs @@ -30,7 +30,7 @@ namespace Microsoft.TestPlatform.TestUtilities; public class IntegrationTestBase { public const string DesktopRunnerFramework = "net462"; - public const string CoreRunnerFramework = "netcoreapp2.1"; + public const string CoreRunnerFramework = "netcoreapp3.1"; private const string TotalTestsMessage = "Total tests: {0}"; private const string PassedTestsMessage = " Passed: {0}"; diff --git a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestEnvironment.cs b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestEnvironment.cs index 5a03b44d55..602b719621 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestEnvironment.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/IntegrationTestEnvironment.cs @@ -107,7 +107,7 @@ public string PublishDirectory /// /// Gets the target framework. - /// Supported values = net462, netcoreapp1.0. + /// Supported values = net462, netcoreapp3.1. /// [NotNull] public string? TargetFramework { get; set; } @@ -163,7 +163,7 @@ public string? TargetRuntime /// /// Gets the application type. - /// Supported values = net462, netcoreapp1.0. + /// Supported values = net462, netcoreapp3.1. /// public string RunnerFramework { get; set; } diff --git a/test/TestAssets/AppDomainGetAssembliesTestProject/AppDomainGetAssembliesTestProject.csproj b/test/TestAssets/AppDomainGetAssembliesTestProject/AppDomainGetAssembliesTestProject.csproj index 58801b621a..17753315d1 100644 --- a/test/TestAssets/AppDomainGetAssembliesTestProject/AppDomainGetAssembliesTestProject.csproj +++ b/test/TestAssets/AppDomainGetAssembliesTestProject/AppDomainGetAssembliesTestProject.csproj @@ -1,7 +1,7 @@ - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false diff --git a/test/TestAssets/BlameUnitTestProject/BlameUnitTestProject.csproj b/test/TestAssets/BlameUnitTestProject/BlameUnitTestProject.csproj index 370e14865b..daa24cbc97 100644 --- a/test/TestAssets/BlameUnitTestProject/BlameUnitTestProject.csproj +++ b/test/TestAssets/BlameUnitTestProject/BlameUnitTestProject.csproj @@ -11,7 +11,7 @@ BlameUnitTestProject - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) Exe diff --git a/test/TestAssets/CodeCoverageTest/CodeCoverageTest.csproj b/test/TestAssets/CodeCoverageTest/CodeCoverageTest.csproj index 48516eb884..a5bcc5564b 100644 --- a/test/TestAssets/CodeCoverageTest/CodeCoverageTest.csproj +++ b/test/TestAssets/CodeCoverageTest/CodeCoverageTest.csproj @@ -5,7 +5,7 @@ CodeCoverageTest - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false diff --git a/test/TestAssets/ConsoleManagedApp/ConsoleManagedApp.csproj b/test/TestAssets/ConsoleManagedApp/ConsoleManagedApp.csproj index 946e9ff58c..e943d1497b 100644 --- a/test/TestAssets/ConsoleManagedApp/ConsoleManagedApp.csproj +++ b/test/TestAssets/ConsoleManagedApp/ConsoleManagedApp.csproj @@ -4,7 +4,7 @@ ConsoleManagedApp - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) Exe netcoreapp3.1 false diff --git a/test/TestAssets/ConsoleRunners/ConsoleRunners.csproj b/test/TestAssets/ConsoleRunners/ConsoleRunners.csproj index 3b9c7b8702..a499b4f98c 100644 --- a/test/TestAssets/ConsoleRunners/ConsoleRunners.csproj +++ b/test/TestAssets/ConsoleRunners/ConsoleRunners.csproj @@ -3,7 +3,7 @@ - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false diff --git a/test/TestAssets/CoverletCoverageTestProject/CoverletCoverageTestProject.csproj b/test/TestAssets/CoverletCoverageTestProject/CoverletCoverageTestProject.csproj index 6aaaa6026c..3a474a1188 100644 --- a/test/TestAssets/CoverletCoverageTestProject/CoverletCoverageTestProject.csproj +++ b/test/TestAssets/CoverletCoverageTestProject/CoverletCoverageTestProject.csproj @@ -3,8 +3,7 @@ - netcoreapp2.1 - netcoreapp3.1 + $(TargetNetCoreVersion) false @@ -15,4 +14,4 @@ - \ No newline at end of file + diff --git a/test/TestAssets/CrashingOnDebugAssertTestProject/CrashingOnDebugAssertTestProject.csproj b/test/TestAssets/CrashingOnDebugAssertTestProject/CrashingOnDebugAssertTestProject.csproj index 17e396c656..9a8099af59 100644 --- a/test/TestAssets/CrashingOnDebugAssertTestProject/CrashingOnDebugAssertTestProject.csproj +++ b/test/TestAssets/CrashingOnDebugAssertTestProject/CrashingOnDebugAssertTestProject.csproj @@ -4,16 +4,16 @@ - netcoreapp2.1 + $(TargetNetCoreVersion) netcoreapp3.1 false - + DEBUG;TRACE - + DEBUG;TRACE false diff --git a/test/TestAssets/DiscoveryTestProject/DiscoveryTestProject.csproj b/test/TestAssets/DiscoveryTestProject/DiscoveryTestProject.csproj index 39844ed9c7..cbcf572b5e 100644 --- a/test/TestAssets/DiscoveryTestProject/DiscoveryTestProject.csproj +++ b/test/TestAssets/DiscoveryTestProject/DiscoveryTestProject.csproj @@ -5,8 +5,8 @@ DiscoveryTestProject - netcoreapp1.0;netcoreapp1.1;netcoreapp2.0;$(TargetNetFxVersion) - netcoreapp3.1 + $(TargetNetFxVersion);$(TargetNetCoreVersion) + $(TargetNetCoreVersion) x64 diff --git a/test/TestAssets/EnvironmentVariablesTestProject/EnvironmentVariablesTestProject.csproj b/test/TestAssets/EnvironmentVariablesTestProject/EnvironmentVariablesTestProject.csproj index 969cd0d890..9f8022f438 100644 --- a/test/TestAssets/EnvironmentVariablesTestProject/EnvironmentVariablesTestProject.csproj +++ b/test/TestAssets/EnvironmentVariablesTestProject/EnvironmentVariablesTestProject.csproj @@ -1,7 +1,7 @@ - $(TargetNetFxVersion);netcoreapp2.1 + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false diff --git a/test/TestAssets/MSTestProject1/MSTestProject1.csproj b/test/TestAssets/MSTestProject1/MSTestProject1.csproj index 1181d1b10f..8de654950a 100644 --- a/test/TestAssets/MSTestProject1/MSTestProject1.csproj +++ b/test/TestAssets/MSTestProject1/MSTestProject1.csproj @@ -3,7 +3,7 @@ - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false Preview diff --git a/test/TestAssets/MSTestProject2/MSTestProject2.csproj b/test/TestAssets/MSTestProject2/MSTestProject2.csproj index 1181d1b10f..8de654950a 100644 --- a/test/TestAssets/MSTestProject2/MSTestProject2.csproj +++ b/test/TestAssets/MSTestProject2/MSTestProject2.csproj @@ -3,7 +3,7 @@ - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false Preview diff --git a/test/TestAssets/NUTestProject/NUTestProject.csproj b/test/TestAssets/NUTestProject/NUTestProject.csproj index 0c8fce7d49..a45aa6bb32 100644 --- a/test/TestAssets/NUTestProject/NUTestProject.csproj +++ b/test/TestAssets/NUTestProject/NUTestProject.csproj @@ -4,7 +4,7 @@ - $(TargetNetFxVersion);netcoreapp2.1 + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false NUTestProject diff --git a/test/TestAssets/OutOfProcDataCollector/OutOfProcDataCollector.csproj b/test/TestAssets/OutOfProcDataCollector/OutOfProcDataCollector.csproj index 838cbaf576..03f0f11dfc 100644 --- a/test/TestAssets/OutOfProcDataCollector/OutOfProcDataCollector.csproj +++ b/test/TestAssets/OutOfProcDataCollector/OutOfProcDataCollector.csproj @@ -1,6 +1,6 @@ - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false 15.0.0.0 diff --git a/test/TestAssets/ParametrizedTestProject/ParametrizedTestProject.csproj b/test/TestAssets/ParametrizedTestProject/ParametrizedTestProject.csproj index 8ee167749a..684f5d8c5f 100644 --- a/test/TestAssets/ParametrizedTestProject/ParametrizedTestProject.csproj +++ b/test/TestAssets/ParametrizedTestProject/ParametrizedTestProject.csproj @@ -5,7 +5,7 @@ ParametrizedTestProject - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false diff --git a/test/TestAssets/PerfTestProject/PerfTestProject.csproj b/test/TestAssets/PerfTestProject/PerfTestProject.csproj index 2e4d3dbe9e..b38b2ab663 100644 --- a/test/TestAssets/PerfTestProject/PerfTestProject.csproj +++ b/test/TestAssets/PerfTestProject/PerfTestProject.csproj @@ -7,13 +7,13 @@ - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 Exe false PerfTestProject - + portable diff --git a/test/TestAssets/ProjectFileRunSettingsTestProject/ProjectFileRunSettingsTestProject.csproj b/test/TestAssets/ProjectFileRunSettingsTestProject/ProjectFileRunSettingsTestProject.csproj index ca5c112b8d..1753dec764 100644 --- a/test/TestAssets/ProjectFileRunSettingsTestProject/ProjectFileRunSettingsTestProject.csproj +++ b/test/TestAssets/ProjectFileRunSettingsTestProject/ProjectFileRunSettingsTestProject.csproj @@ -4,7 +4,7 @@ - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false x64 diff --git a/test/TestAssets/SampleProjectWithOldTestHost/SampleProjectWithOldTestHost.csproj b/test/TestAssets/SampleProjectWithOldTestHost/SampleProjectWithOldTestHost.csproj index 87ba029b3c..da7ef9caac 100644 --- a/test/TestAssets/SampleProjectWithOldTestHost/SampleProjectWithOldTestHost.csproj +++ b/test/TestAssets/SampleProjectWithOldTestHost/SampleProjectWithOldTestHost.csproj @@ -3,8 +3,7 @@ - netcoreapp1.0;netcoreapp1.1;netcoreapp2.1 - netcoreapp3.1 + $(TargetNetCoreVersion) true false diff --git a/test/TestAssets/SimpleClassLibrary/SimpleClassLibrary.csproj b/test/TestAssets/SimpleClassLibrary/SimpleClassLibrary.csproj index 76638c35d0..dd0f34f660 100644 --- a/test/TestAssets/SimpleClassLibrary/SimpleClassLibrary.csproj +++ b/test/TestAssets/SimpleClassLibrary/SimpleClassLibrary.csproj @@ -3,8 +3,8 @@ - netcoreapp1.0;netcoreapp1.1;netcoreapp2.1;$(TargetNetFxVersion) - netcoreapp3.1 + $(TargetNetFxVersion);$(TargetNetCoreVersion) + $(TargetNetCoreVersion) false diff --git a/test/TestAssets/SimpleDataCollector/SimpleDataCollector.csproj b/test/TestAssets/SimpleDataCollector/SimpleDataCollector.csproj index 0864efcc09..b7b3853460 100644 --- a/test/TestAssets/SimpleDataCollector/SimpleDataCollector.csproj +++ b/test/TestAssets/SimpleDataCollector/SimpleDataCollector.csproj @@ -10,7 +10,7 @@ 15.0.0.0 15.0.0.0 15.0.0.0 - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false true diff --git a/test/TestAssets/SimpleTestProject/SimpleTestProject.csproj b/test/TestAssets/SimpleTestProject/SimpleTestProject.csproj index 1eabc63320..61734ec351 100644 --- a/test/TestAssets/SimpleTestProject/SimpleTestProject.csproj +++ b/test/TestAssets/SimpleTestProject/SimpleTestProject.csproj @@ -5,7 +5,7 @@ SimpleTestProject - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false diff --git a/test/TestAssets/SimpleTestProject2/SimpleTestProject2.csproj b/test/TestAssets/SimpleTestProject2/SimpleTestProject2.csproj index 2581ffed06..1e7c285f67 100644 --- a/test/TestAssets/SimpleTestProject2/SimpleTestProject2.csproj +++ b/test/TestAssets/SimpleTestProject2/SimpleTestProject2.csproj @@ -12,7 +12,7 @@ SimpleTestProject2 - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false Exe diff --git a/test/TestAssets/SimpleTestProject3/SimpleTestProject3.csproj b/test/TestAssets/SimpleTestProject3/SimpleTestProject3.csproj index 142a070261..43edbdd780 100644 --- a/test/TestAssets/SimpleTestProject3/SimpleTestProject3.csproj +++ b/test/TestAssets/SimpleTestProject3/SimpleTestProject3.csproj @@ -4,7 +4,7 @@ - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false Exe diff --git a/test/TestAssets/SimpleTestProjectARM/SimpleTestProjectARM.csproj b/test/TestAssets/SimpleTestProjectARM/SimpleTestProjectARM.csproj index b0ebf4b9be..f77b04d899 100644 --- a/test/TestAssets/SimpleTestProjectARM/SimpleTestProjectARM.csproj +++ b/test/TestAssets/SimpleTestProjectARM/SimpleTestProjectARM.csproj @@ -13,7 +13,7 @@ SimpleTestProjectARM - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false Exe diff --git a/test/TestAssets/SimpleTestProjectMessedUpTargetFramework/SimpleTestProjectMessedUpTargetFramework.csproj b/test/TestAssets/SimpleTestProjectMessedUpTargetFramework/SimpleTestProjectMessedUpTargetFramework.csproj index f430b307e0..7bfa841924 100644 --- a/test/TestAssets/SimpleTestProjectMessedUpTargetFramework/SimpleTestProjectMessedUpTargetFramework.csproj +++ b/test/TestAssets/SimpleTestProjectMessedUpTargetFramework/SimpleTestProjectMessedUpTargetFramework.csproj @@ -4,8 +4,7 @@ - netcoreapp2.1 - netcoreapp3.1 + $(TargetNetCoreVersion) true true diff --git a/test/TestAssets/SimpleTestProjectx86/SimpleTestProjectx86.csproj b/test/TestAssets/SimpleTestProjectx86/SimpleTestProjectx86.csproj index 2a9893e677..115c0b7d7c 100644 --- a/test/TestAssets/SimpleTestProjectx86/SimpleTestProjectx86.csproj +++ b/test/TestAssets/SimpleTestProjectx86/SimpleTestProjectx86.csproj @@ -13,7 +13,7 @@ SimpleTestProjectx86 - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false Exe diff --git a/test/TestAssets/XUPerfTestProject/XUPerfTestProject.csproj b/test/TestAssets/XUPerfTestProject/XUPerfTestProject.csproj index b74766c104..9a9b385b4e 100644 --- a/test/TestAssets/XUPerfTestProject/XUPerfTestProject.csproj +++ b/test/TestAssets/XUPerfTestProject/XUPerfTestProject.csproj @@ -4,7 +4,7 @@ - + ..\..\..\ true @@ -12,18 +12,18 @@ - netcoreapp1.0;net452 + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 - Exe + Exe XUPerfTestProject false false false - + portable - + full diff --git a/test/TestAssets/XUTestProject/XUTestProject.csproj b/test/TestAssets/XUTestProject/XUTestProject.csproj index bb0f0f800e..8c54e75c2c 100644 --- a/test/TestAssets/XUTestProject/XUTestProject.csproj +++ b/test/TestAssets/XUTestProject/XUTestProject.csproj @@ -4,7 +4,7 @@ XUTestProject - netcoreapp2.1;$(TargetNetFxVersion) + $(TargetNetFxVersion);$(TargetNetCoreVersion) netcoreapp3.1 false diff --git a/test/TestAssets/child-hang/child-hang.csproj b/test/TestAssets/child-hang/child-hang.csproj index 98fbfc175d..ccb65b2dbf 100644 --- a/test/TestAssets/child-hang/child-hang.csproj +++ b/test/TestAssets/child-hang/child-hang.csproj @@ -8,7 +8,7 @@ - $(TargetNetFxVersion);net472;net48;netcoreapp2.1;netcoreapp3.1;net5.0 + $(TargetNetFxVersion);net472;net48;$(TargetNetCoreVersion);net5.0 netcoreapp3.1 child_hang false diff --git a/test/TestAssets/crash/crash.csproj b/test/TestAssets/crash/crash.csproj index 663716024f..40e2ee46c6 100644 --- a/test/TestAssets/crash/crash.csproj +++ b/test/TestAssets/crash/crash.csproj @@ -8,7 +8,7 @@ - $(TargetNetFxVersion);net472;net48;netcoreapp2.1;netcoreapp3.1;net5.0 + $(TargetNetFxVersion);net472;net48;$(TargetNetCoreVersion);net5.0 netcoreapp3.1 false diff --git a/test/TestAssets/timeout/timeout.csproj b/test/TestAssets/timeout/timeout.csproj index 06e9ad2a2b..20818da131 100644 --- a/test/TestAssets/timeout/timeout.csproj +++ b/test/TestAssets/timeout/timeout.csproj @@ -9,7 +9,7 @@ - $(TargetNetFxVersion);net472;net48;netcoreapp2.1;netcoreapp3.1;net5.0 + $(TargetNetFxVersion);net472;net48;$(TargetNetCoreVersion);net5.0 netcoreapp3.1 false diff --git a/test/vstest.console.PlatformTests/AssemblyMetadataProviderTests.cs b/test/vstest.console.PlatformTests/AssemblyMetadataProviderTests.cs index 1e670e4000..795d380645 100644 --- a/test/vstest.console.PlatformTests/AssemblyMetadataProviderTests.cs +++ b/test/vstest.console.PlatformTests/AssemblyMetadataProviderTests.cs @@ -56,7 +56,7 @@ public void Cleanup() [TestMethod] [DataRow("net462")] - [DataRow("netcoreapp2.1")] + [DataRow("netcoreapp3.1")] public void GetArchitectureShouldReturnCorrentArchForx64Assembly(string framework) { TestDotnetAssemblyArch("SimpleTestProject3", framework, Architecture.X64, expectedElapsedTime: ExpectedTimeForFindingArchForDotNetAssembly); @@ -64,7 +64,7 @@ public void GetArchitectureShouldReturnCorrentArchForx64Assembly(string framewor [TestMethod] [DataRow("net462")] - [DataRow("netcoreapp2.1")] + [DataRow("netcoreapp3.1")] public void GetArchitectureShouldReturnCorrentArchForx86Assembly(string framework) { TestDotnetAssemblyArch("SimpleTestProjectx86", framework, Architecture.X86, expectedElapsedTime: ExpectedTimeForFindingArchForDotNetAssembly); @@ -72,7 +72,7 @@ public void GetArchitectureShouldReturnCorrentArchForx86Assembly(string framewor [TestMethod] [DataRow("net462")] - [DataRow("netcoreapp2.1")] + [DataRow("netcoreapp3.1")] public void GetArchitectureShouldReturnCorrentArchForAnyCpuAssembly(string framework) { TestDotnetAssemblyArch("SimpleTestProject", framework, Architecture.AnyCPU, expectedElapsedTime: ExpectedTimeForFindingArchForDotNetAssembly); @@ -80,7 +80,7 @@ public void GetArchitectureShouldReturnCorrentArchForAnyCpuAssembly(string frame [TestMethod] [DataRow("net462")] - [DataRow("netcoreapp2.1")] + [DataRow("netcoreapp3.1")] public void GetArchitectureShouldReturnCorrentArchForArmAssembly(string framework) { TestDotnetAssemblyArch("SimpleTestProjectARM", framework, Architecture.ARM, expectedElapsedTime: ExpectedTimeForFindingArchForDotNetAssembly); @@ -109,7 +109,7 @@ public void GetArchitectureForNativeDll(string platform) [TestMethod] [DataRow("net462")] - [DataRow("netcoreapp2.1")] + [DataRow("netcoreapp3.1")] public void GetFrameWorkForDotNetAssembly(string framework) { var expectedElapsedTime = 5; From ddc77484c7989ca583c5fedfd5f0dc391d06e096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 18 Jul 2022 13:27:51 +0200 Subject: [PATCH 05/34] More changes --- scripts/build.ps1 | 1 + shared/NullableAttributes.cs | 4 ++++ .../netcoreapp3.1/PublicAPI.Shipped.txt | 13 ++++++++++ .../netcoreapp3.1}/PublicAPI.Unshipped.txt | 0 .../DebuggerBreakpoint.cs | 2 +- .../Navigation/DiaSession.cs | 6 +++-- .../netcoreapp1.0/PublicAPI.Shipped.txt | 4 ---- .../PublicAPI.Shipped.txt | 0 .../PublicAPI.Unshipped.txt | 0 .../Utilities/XmlRunSettingsUtilities.cs | 2 +- .../netcoreapp2.1/PublicAPI.Shipped.txt | 17 ------------- .../netcoreapp2.1/PublicAPI.Unshipped.txt | 1 - .../PublicAPI.Shipped.txt | 0 .../PublicAPI.Unshipped.txt | 0 src/datacollector/DataCollectorMain.cs | 2 +- .../PublicAPI.Shipped.txt | 0 .../PublicAPI.Unshipped.txt | 0 .../nuspec/Microsoft.CodeCoverage.nuspec | 4 ++-- .../PublicAPI.Shipped.txt | 0 .../PublicAPI.Unshipped.txt | 0 src/testhost.x86/TestHostTraceListener.cs | 24 ++----------------- src/vstest.console/CommandLine/Executor.cs | 2 +- .../Processors/CollectArgumentProcessor.cs | 3 ++- .../EnableCodeCoverageArgumentProcessor.cs | 6 ++--- .../Processors/HelpArgumentProcessor.cs | 3 ++- .../ListExtensionsArgumentProcessor.cs | 2 +- ...istFullyQualifiedTestsArgumentProcessor.cs | 2 +- .../RunSpecificTestsArgumentProcessor.cs | 2 +- .../Utilities/ArgumentProcessorFactory.cs | 4 ++-- .../PublicAPI.Shipped.txt | 0 .../PublicAPI.Unshipped.txt | 0 .../TestPlatformHelpers/TestRequestManager.cs | 3 +-- 32 files changed, 43 insertions(+), 64 deletions(-) create mode 100644 src/Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt rename src/{Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0 => Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1}/PublicAPI.Unshipped.txt (100%) delete mode 100644 src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Shipped.txt rename src/Microsoft.TestPlatform.ObjectModel/PublicAPI/{netcoreapp2.1 => netcoreapp3.1}/PublicAPI.Shipped.txt (100%) rename src/Microsoft.TestPlatform.ObjectModel/PublicAPI/{netcoreapp2.1 => netcoreapp3.1}/PublicAPI.Unshipped.txt (100%) delete mode 100644 src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt delete mode 100644 src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt rename src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/{netcoreapp1.0 => netcoreapp3.1}/PublicAPI.Shipped.txt (100%) rename src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/{netcoreapp1.0 => netcoreapp3.1}/PublicAPI.Unshipped.txt (100%) rename src/datacollector/PublicAPI/{netcoreapp2.1 => netcoreapp3.1}/PublicAPI.Shipped.txt (100%) rename src/datacollector/PublicAPI/{netcoreapp2.1 => netcoreapp3.1}/PublicAPI.Unshipped.txt (100%) rename src/package/package/PublicAPI/{netcoreapp2.1 => netcoreapp3.1}/PublicAPI.Shipped.txt (100%) rename src/package/package/PublicAPI/{netcoreapp2.1 => netcoreapp3.1}/PublicAPI.Unshipped.txt (100%) rename src/vstest.console/PublicAPI/{netcoreapp2.1 => netcoreapp3.1}/PublicAPI.Shipped.txt (100%) rename src/vstest.console/PublicAPI/{netcoreapp2.1 => netcoreapp3.1}/PublicAPI.Unshipped.txt (100%) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 26c3c6505b..70c909eccc 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -1270,6 +1270,7 @@ function Build-SpecificProjects { ("net462", "net462\win7-x64"), ("netstandard1.0", "netstandard1.0"), ("netstandard1.3", "netstandard1.3"), + # REVIEW ME: Why do we copy netstandard2.0 into netcorecorapp2.1? ("netstandard2.0", "netcoreapp2.1"), ("netcoreapp3.1", "netcoreapp3.1") ) diff --git a/shared/NullableAttributes.cs b/shared/NullableAttributes.cs index ec8978cab4..0879edb7f6 100644 --- a/shared/NullableAttributes.cs +++ b/shared/NullableAttributes.cs @@ -87,6 +87,10 @@ internal sealed class DoesNotReturnIfAttribute : Attribute public bool ParameterValue { get; } } +#endif + +#if NETFRAMEWORK || WINDOWS_UWP || NETSTANDARD && !NETSTANDARD2_1 || NETCOREAPP && !NET5_0_OR_GREATER + /// Specifies that the method or property will ensure that the listed field and property members have not-null values. [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] internal sealed class MemberNotNullAttribute : Attribute diff --git a/src/Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt new file mode 100644 index 0000000000..dc4f1b293a --- /dev/null +++ b/src/Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt @@ -0,0 +1,13 @@ +#nullable enable +Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput +Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput.Write(string? message, Microsoft.VisualStudio.TestPlatform.Utilities.OutputLevel level) -> void +Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput.WriteLine(string? message, Microsoft.VisualStudio.TestPlatform.Utilities.OutputLevel level) -> void +Microsoft.VisualStudio.TestPlatform.Utilities.OutputExtensions +static Microsoft.VisualStudio.TestPlatform.ObjectModel.EqtTrace.TraceLevel.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel +static Microsoft.VisualStudio.TestPlatform.ObjectModel.EqtTrace.TraceLevel.set -> void +static Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput.Instance.get -> Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput! +static Microsoft.VisualStudio.TestPlatform.Utilities.OutputExtensions.Error(this Microsoft.VisualStudio.TestPlatform.Utilities.IOutput! output, bool appendPrefix, string! format, params object?[]? args) -> void +static Microsoft.VisualStudio.TestPlatform.Utilities.OutputExtensions.Information(this Microsoft.VisualStudio.TestPlatform.Utilities.IOutput! output, bool appendPrefix, string! format, params object?[]? args) -> void +static Microsoft.VisualStudio.TestPlatform.Utilities.OutputExtensions.Information(this Microsoft.VisualStudio.TestPlatform.Utilities.IOutput! output, bool appendPrefix, System.ConsoleColor foregroundColor, string! format, params object?[]? args) -> void +static Microsoft.VisualStudio.TestPlatform.Utilities.OutputExtensions.Warning(this Microsoft.VisualStudio.TestPlatform.Utilities.IOutput! output, bool appendPrefix, string! format, params object?[]? args) -> void +static Microsoft.VisualStudio.TestPlatform.Utilities.OutputExtensions.Write(this Microsoft.VisualStudio.TestPlatform.Utilities.IOutput! output, string! message, Microsoft.VisualStudio.TestPlatform.Utilities.OutputLevel level, System.ConsoleColor foregroundColor) -> void diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt similarity index 100% rename from src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt rename to src/Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt diff --git a/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs b/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs index afbb439cb1..e9c25bb94e 100644 --- a/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs +++ b/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs @@ -125,7 +125,7 @@ private static bool AttachVs(Process process, int? vsPid) private static string? FindOnPath(string exeName) { - var paths = Environment.GetEnvironmentVariable("PATH").Split(';'); + var paths = Environment.GetEnvironmentVariable("PATH")!.Split(';'); foreach (var p in paths) { var path = Path.Combine(p, exeName); diff --git a/src/Microsoft.TestPlatform.ObjectModel/Navigation/DiaSession.cs b/src/Microsoft.TestPlatform.ObjectModel/Navigation/DiaSession.cs index cb02697e7b..d247c22514 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Navigation/DiaSession.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Navigation/DiaSession.cs @@ -115,11 +115,13 @@ private static ISymbolReader GetSymbolReader(string? binaryPath) // For remote scenario, also look for pdb in current directory, (esp for UWP) // The alternate search path should be an input from Adapters, but since it is not so currently adding a HACK - pdbFilePath = !File.Exists(pdbFilePath) ? Path.Combine(Directory.GetCurrentDirectory(), Path.GetFileName(pdbFilePath)!) : pdbFilePath; + pdbFilePath = !File.Exists(pdbFilePath) + ? Path.Combine(Directory.GetCurrentDirectory(), Path.GetFileName(pdbFilePath)!) + : pdbFilePath; if (File.Exists(pdbFilePath)) { - using var stream = new FileHelper().GetStream(pdbFilePath, FileMode.Open, FileAccess.Read); + using var stream = new FileHelper().GetStream(pdbFilePath!, FileMode.Open, FileAccess.Read); return PortablePdbReader.IsPortable(stream) ? new PortableSymbolReader() : new FullSymbolReader(); } else diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Shipped.txt deleted file mode 100644 index 845987ee16..0000000000 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp1.0/PublicAPI.Shipped.txt +++ /dev/null @@ -1,4 +0,0 @@ -#nullable enable -static Microsoft.VisualStudio.TestPlatform.ObjectModel.EqtTrace.TraceLevel.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel (forwarded, contained in Microsoft.TestPlatform.CoreUtilities) -static Microsoft.VisualStudio.TestPlatform.ObjectModel.EqtTrace.TraceLevel.set -> void (forwarded, contained in Microsoft.TestPlatform.CoreUtilities) -static Microsoft.VisualStudio.TestPlatform.ObjectModel.Framework.DefaultFramework.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Framework! diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt similarity index 100% rename from src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt rename to src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt similarity index 100% rename from src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt rename to src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt diff --git a/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs b/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs index 80f0426ce6..eb13451793 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Utilities/XmlRunSettingsUtilities.cs @@ -104,7 +104,7 @@ public static IList GetDataCollectorsFriendlyName(string? runsettingsXml foreach (XPathNavigator? dataCollectorNavigator in nodes) { var friendlyName = dataCollectorNavigator?.GetAttribute("friendlyName", string.Empty); - friendlyNameList.Add(friendlyName); + friendlyNameList.Add(friendlyName!); } } diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt deleted file mode 100644 index d17adb2a82..0000000000 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt +++ /dev/null @@ -1,17 +0,0 @@ -#nullable enable -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.InitializeTrace(string? customLogFile, Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel platformTraceLevel) -> bool -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.MapPlatformTraceToTrace(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel traceLevel) -> System.Diagnostics.TraceLevel -Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.WriteLine(Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel level, string? message) -> void -Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener -Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.RollingFileTraceListener(string! fileName, string! name, int rollSizeKB) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformAssemblyResolver.~PlatformAssemblyResolver() -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(System.Action? action, Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformApartmentState apartmentState, bool waitForCompletion) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.LaunchProcess(string! processPath, string? arguments, string? workingDirectory, System.Collections.Generic.IDictionary? envVariables, System.Action? errorCallback, System.Action? exitCallBack, System.Action? outputCallBack) -> object! -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessHelper.SetExitCallback(int processId, System.Action? callbackAction) -> void -Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions -override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.Dispose(bool disposing) -> void -override Microsoft.VisualStudio.TestPlatform.ObjectModel.RollingFileTraceListener.WriteLine(string? message) -> void -static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.LogFile.get -> string? -static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.TraceLevel.get -> System.Diagnostics.TraceLevel -static Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformEqtTrace.TraceLevel.set -> void -static Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.ProcessStartInfoExtensions.AddEnvironmentVariable(this System.Diagnostics.ProcessStartInfo! startInfo, string! name, string? value) -> void diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt deleted file mode 100644 index ab058de62d..0000000000 --- a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt +++ /dev/null @@ -1 +0,0 @@ -#nullable enable diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp1.0/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt similarity index 100% rename from src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp1.0/PublicAPI.Shipped.txt rename to src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt b/src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt similarity index 100% rename from src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp1.0/PublicAPI.Unshipped.txt rename to src/Microsoft.TestPlatform.PlatformAbstractions/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt diff --git a/src/datacollector/DataCollectorMain.cs b/src/datacollector/DataCollectorMain.cs index 5653fd4565..4fc0c28747 100644 --- a/src/datacollector/DataCollectorMain.cs +++ b/src/datacollector/DataCollectorMain.cs @@ -128,7 +128,7 @@ public void Run(string[]? args) }); // Get server port and initialize communication. - int port = argsDictionary.TryGetValue(PortArgument, out var portValue) ? int.Parse(portValue, CultureInfo.CurrentCulture) : 0; + int port = argsDictionary.TryGetValue(PortArgument, out var portValue) ? int.Parse(portValue!, CultureInfo.CurrentCulture) : 0; if (port <= 0) { diff --git a/src/datacollector/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt b/src/datacollector/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt similarity index 100% rename from src/datacollector/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt rename to src/datacollector/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt diff --git a/src/datacollector/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/datacollector/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt similarity index 100% rename from src/datacollector/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt rename to src/datacollector/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt diff --git a/src/package/nuspec/Microsoft.CodeCoverage.nuspec b/src/package/nuspec/Microsoft.CodeCoverage.nuspec index 6b9741cb6a..29359c5377 100644 --- a/src/package/nuspec/Microsoft.CodeCoverage.nuspec +++ b/src/package/nuspec/Microsoft.CodeCoverage.nuspec @@ -46,7 +46,7 @@ - + @@ -73,7 +73,7 @@ - + diff --git a/src/package/package/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt b/src/package/package/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt similarity index 100% rename from src/package/package/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt rename to src/package/package/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt diff --git a/src/package/package/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/package/package/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt similarity index 100% rename from src/package/package/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt rename to src/package/package/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt diff --git a/src/testhost.x86/TestHostTraceListener.cs b/src/testhost.x86/TestHostTraceListener.cs index 6591a35964..2902d40f7e 100644 --- a/src/testhost.x86/TestHostTraceListener.cs +++ b/src/testhost.x86/TestHostTraceListener.cs @@ -79,29 +79,13 @@ public static void ShowDialog(string stackTrace, string message, string detailMe private static DebugAssertException GetException(string? message) { - var debugTypes = new Type[] { typeof(Debug), typeof(Trace) }; -#if NETCOREAPP1_0 - Exception exceptionForStack; - try - { - throw new Exception(); - } - catch (Exception e) - { - exceptionForStack = e; - } - - var stack = new StackTrace(exceptionForStack, true); -#else var stack = new StackTrace(true); -#endif - var debugMethodFound = false; var frameCount = 0; MethodBase? method = null; foreach (var f in stack.GetFrames()) { - var m = f.GetMethod(); + var m = f?.GetMethod(); var declaringType = m?.DeclaringType; if (!debugMethodFound && (declaringType == typeof(Debug) || declaringType == typeof(Trace))) { @@ -115,12 +99,8 @@ private static DebugAssertException GetException(string? message) } } -#if NETCOREAPP1_0 - var stackTrace = string.Join(Environment.NewLine, stack.ToString().Replace(Environment.NewLine, "\n").Split('\n').Reverse().Take(frameCount).Reverse()); -#else var stackTrace = string.Join(Environment.NewLine, stack.ToString().Split(Environment.NewLine).TakeLast(frameCount)); -#endif - var methodName = method != null ? $"{method.DeclaringType.Name}.{method.Name}" : ""; + var methodName = method != null ? $"{method.DeclaringType?.Name}.{method.Name}" : ""; var wholeMessage = $"Method {methodName} failed with '{message}', and was translated to {typeof(DebugAssertException).FullName} to avoid terminating the process hosting the test."; return new DebugAssertException(wholeMessage, stackTrace); diff --git a/src/vstest.console/CommandLine/Executor.cs b/src/vstest.console/CommandLine/Executor.cs index 8b807a7423..a898554a7d 100644 --- a/src/vstest.console/CommandLine/Executor.cs +++ b/src/vstest.console/CommandLine/Executor.cs @@ -488,7 +488,7 @@ private int FlattenArguments(IEnumerable arguments, out string[] flatten else { Output.WriteLine($"vstest.console.exe {responseFileArgs}", OutputLevel.Information); - outputArguments.AddRange(nestedArgs); + outputArguments.AddRange(nestedArgs!); } } else diff --git a/src/vstest.console/Processors/CollectArgumentProcessor.cs b/src/vstest.console/Processors/CollectArgumentProcessor.cs index 4f501c2aab..2a6ea0761f 100644 --- a/src/vstest.console/Processors/CollectArgumentProcessor.cs +++ b/src/vstest.console/Processors/CollectArgumentProcessor.cs @@ -190,8 +190,9 @@ private static void AddOrUpdateConfiguration(XmlElement configuration, string co return; } - foreach (XmlNode existingConfiguration in existingConfigurations) + foreach (XmlNode? existingConfiguration in existingConfigurations) { + TPDebug.Assert(existingConfiguration is not null, "existingConfiguration is null"); existingConfiguration.InnerText = configurationValue; } } diff --git a/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs b/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs index c64405365d..5b297ed38a 100644 --- a/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs +++ b/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs @@ -199,7 +199,7 @@ private void UpdateWithCodeCoverageSettingsIfNotConfigured() if (runsettingsXml == null) { _runSettingsManager.AddDefaultRunSettings(); - runsettingsXml = _runSettingsManager.ActiveRunSettings?.SettingsXml; + runsettingsXml = _runSettingsManager.ActiveRunSettings!.SettingsXml!; } IXPathNavigable runSettingsDocument; @@ -286,9 +286,9 @@ private static bool ContainsDataCollectorWithFriendlyName(IXPathNavigable runSet var navigator = runSettingDocument.CreateNavigator(); var nodes = navigator.Select("/RunSettings/DataCollectionRunSettings/DataCollectors/DataCollector"); - foreach (XPathNavigator dataCollectorNavigator in nodes) + foreach (XPathNavigator? dataCollectorNavigator in nodes) { - var fn = dataCollectorNavigator.GetAttribute("friendlyName", string.Empty); + var fn = dataCollectorNavigator?.GetAttribute("friendlyName", string.Empty); if (string.Equals(dataCollectorFriendlyName, fn, StringComparison.OrdinalIgnoreCase)) { return true; diff --git a/src/vstest.console/Processors/HelpArgumentProcessor.cs b/src/vstest.console/Processors/HelpArgumentProcessor.cs index 9ea6b1c95e..31a611c3e9 100644 --- a/src/vstest.console/Processors/HelpArgumentProcessor.cs +++ b/src/vstest.console/Processors/HelpArgumentProcessor.cs @@ -101,7 +101,8 @@ public ArgumentProcessorResult Execute() processors.Sort((p1, p2) => Comparer.Default.Compare(p1.Metadata.Value.HelpPriority, p2.Metadata.Value.HelpPriority)); // Output the help description for RunTestsArgumentProcessor - IArgumentProcessor runTestsArgumentProcessor = processors.Find(p1 => p1.GetType() == typeof(RunTestsArgumentProcessor)); + IArgumentProcessor? runTestsArgumentProcessor = processors.Find(p1 => p1.GetType() == typeof(RunTestsArgumentProcessor)); + TPDebug.Assert(runTestsArgumentProcessor is not null, "runTestsArgumentProcessor is null"); processors.Remove(runTestsArgumentProcessor); var helpDescription = LookupHelpDescription(runTestsArgumentProcessor); if (helpDescription != null) diff --git a/src/vstest.console/Processors/ListExtensionsArgumentProcessor.cs b/src/vstest.console/Processors/ListExtensionsArgumentProcessor.cs index abf63ce530..7ba694b34f 100644 --- a/src/vstest.console/Processors/ListExtensionsArgumentProcessor.cs +++ b/src/vstest.console/Processors/ListExtensionsArgumentProcessor.cs @@ -89,7 +89,7 @@ public ArgumentProcessorResult Execute() { ConsoleOutput.Instance.WriteLine(extension.Value.GetType().FullName, OutputLevel.Information); ConsoleOutput.Instance.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.UriOfDefaultExecutor, extension.Metadata.DefaultExecutorUri), OutputLevel.Information); - ConsoleOutput.Instance.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.SupportedFileTypesIndicator + " " + string.Join(", ", extension.Metadata.FileExtension)), OutputLevel.Information); + ConsoleOutput.Instance.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.SupportedFileTypesIndicator + " " + string.Join(", ", extension.Metadata.FileExtension!)), OutputLevel.Information); } return ArgumentProcessorResult.Success; diff --git a/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs b/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs index b054c3c832..dfed7542a0 100644 --- a/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs @@ -391,7 +391,7 @@ private static Dictionary> GetTraitsInTraitDictionary(Dicti if (!traitDictionary.ContainsKey(TestCategory) && traitDictionary.ContainsKey(Category)) { traitDictionary.TryGetValue(Category, out var categoryValue); - traitDictionary.Add(TestCategory, categoryValue); + traitDictionary.Add(TestCategory, categoryValue!); } return traitDictionary; diff --git a/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs b/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs index c143cc48e5..fb39297d34 100644 --- a/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs @@ -246,7 +246,7 @@ private void ExecuteSelectedTests() if (_discoveredTestCount > 0) { // No tests that matched any of the given strings. - warningMessage = string.Format(CultureInfo.CurrentCulture, CommandLineResources.NoTestsAvailableAfterFiltering, _discoveredTestCount, string.Join(", ", _selectedTestNames)); + warningMessage = string.Format(CultureInfo.CurrentCulture, CommandLineResources.NoTestsAvailableAfterFiltering, _discoveredTestCount, string.Join(", ", _selectedTestNames!)); } else { diff --git a/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs b/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs index 9466f383ec..3b5d5085a6 100644 --- a/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs +++ b/src/vstest.console/Processors/Utilities/ArgumentProcessorFactory.cs @@ -125,7 +125,7 @@ internal Dictionary SpecialCommandToProcessorMap var pair = new CommandArgumentPair(argument); // Find the associated argument processor. - CommandToProcessorMap.TryGetValue(pair.Command, out IArgumentProcessor argumentProcessor); + CommandToProcessorMap.TryGetValue(pair.Command, out IArgumentProcessor? argumentProcessor); // If an argument processor was not found for the command, then consider it as a test source argument. if (argumentProcessor == null) @@ -161,7 +161,7 @@ internal Dictionary SpecialCommandToProcessorMap Contract.EndContractBlock(); // Find the associated argument processor. - CommandToProcessorMap.TryGetValue(command, out IArgumentProcessor argumentProcessor); + CommandToProcessorMap.TryGetValue(command, out IArgumentProcessor? argumentProcessor); if (argumentProcessor != null) { diff --git a/src/vstest.console/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt b/src/vstest.console/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt similarity index 100% rename from src/vstest.console/PublicAPI/netcoreapp2.1/PublicAPI.Shipped.txt rename to src/vstest.console/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt diff --git a/src/vstest.console/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt b/src/vstest.console/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt similarity index 100% rename from src/vstest.console/PublicAPI/netcoreapp2.1/PublicAPI.Unshipped.txt rename to src/vstest.console/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index fafba132d1..bac85e6772 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -1198,8 +1198,7 @@ private bool IsPlatformSetByRunSettings( navigator, out var platformXml); - bool runSettingsHaveValidPlatform = isValidPlatformXml && !platformXml.IsNullOrWhiteSpace(); - if (runSettingsHaveValidPlatform) + if (isValidPlatformXml && !platformXml.IsNullOrWhiteSpace()) { // TODO: this should be checking if the enum has the value specified, or ideally just ask the runsettings to give that value // so we parse the same way always From 1525c341dde39f50d1ca369e2331417dd5fc9abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 18 Jul 2022 13:41:49 +0200 Subject: [PATCH 06/34] More updates --- .../Hosting/DotnetTestHostManager.cs | 13 ++++++++----- src/testhost.x86/TestHostTraceListener.cs | 1 + .../BlameDataCollectorTests.cs | 4 ++++ .../DataCollectionTests.cs | 2 +- .../DotnetArchitectureSwitchTests.Windows.cs | 2 +- .../DotnetArchitectureSwitchTests.cs | 2 +- .../Extension/NetCoreRunnerAttribute.cs | 4 ++-- .../NetCoreTargetFrameworkDataSourceAttribute.cs | 1 + .../Extension/NetFrameworkRunnerAttribute.cs | 2 +- .../TestPlatformCompatibilityDataSource.cs | 2 +- .../TranslationLayerTests/CustomTestHostTests.cs | 6 +++--- .../DiaSessionTests.cs | 2 +- .../DataCollectorTests.Coverlet.cs | 3 ++- 13 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index aa2359df1c..c08e5f6494 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -257,14 +257,17 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( EqtTrace.Verbose("DotnetTestHostmanager: User specified custom path to dotnet host: '{0}'.", _dotnetHostPath); } - // Try find testhost.exe (or the architecture specific version). We ship those ngened executables for Windows because they have faster startup time. We ship them only for some platforms. - // When user specified path to dotnet.exe don't try to find the exexutable, because we will always use the testhost.dll together with their dotnet.exe. + // Try find testhost.exe (or the architecture specific version). We ship those ngened executables for Windows + // because they have faster startup time. We ship them only for some platforms. + // When user specified path to dotnet.exe don't try to find the exexutable, because we will always use the + // testhost.dll together with their dotnet.exe. bool testHostExeFound = false; if (!useCustomDotnetHostpath && _platformEnvironment.OperatingSystem.Equals(PlatformOperatingSystem.Windows) - - // testhost*.exe are build for netcoreapp2.1 and are not able to search for the correct runtime in case of x64/x86 on arm because the new logic(registry lookup) - // was added in since netcoreapp3.0. On arm we cannot rely on apphost and we'll use dotnet.exe muxer + // REVIEW ME: @Marco Do we need to update the logic? + // testhost*.exe are build for netcoreapp2.1 and are not able to search for the correct runtime in case of + // x64/x86 on arm because the new logic (registry lookup) was added in since netcoreapp3.0. + // On arm we cannot rely on apphost and we'll use dotnet.exe muxer. && !IsWinOnArm()) { // testhost.exe is 64-bit and has no suffix other versions have architecture suffix. diff --git a/src/testhost.x86/TestHostTraceListener.cs b/src/testhost.x86/TestHostTraceListener.cs index 2902d40f7e..6406eac182 100644 --- a/src/testhost.x86/TestHostTraceListener.cs +++ b/src/testhost.x86/TestHostTraceListener.cs @@ -32,6 +32,7 @@ public static void Setup() EqtTrace.Verbose("TestPlatformTraceListener.Setup: Added test platform trace listener."); + // REVIEW ME: Shall we remove this fix? // this is a netcoreapp2.1 only fix, but because we always compile against netcoreapp2.1 // and upgrade the executable as necessary this needs to be a runtime check and not a compile time // check. This call returns ".NET Core 4.6.xxx" on netcore 2.1 and older, and ".NET Core 3.1.xxx" diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs index 91554eef45..e92f6aada1 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs @@ -40,6 +40,7 @@ public BlameDataCollectorTests() } [TestMethod] + // REVIEW ME: Shall we make the test supporting Linux? // netcoreapp2.1 dump is not supported on Linux [TestCategory("Windows-Review")] [NetFullTargetFrameworkDataSource] @@ -57,6 +58,7 @@ public void BlameDataCollectorShouldGiveCorrectTestCaseName(RunnerInfo runnerInf } [TestMethod] + // REVIEW ME: Shall we make the test supporting Linux? // netcoreapp2.1 dump is not supported on Linux [TestCategory("Windows-Review")] [NetFullTargetFrameworkDataSource] @@ -82,6 +84,7 @@ public void BlameDataCollectorShouldOutputDumpFile(RunnerInfo runnerInfo) } [TestMethod] + // REVIEW ME: Shall we make the test supporting Linux? // netcoreapp2.1 dump is not supported on Linux [TestCategory("Windows-Review")] [NetFullTargetFrameworkDataSource] @@ -107,6 +110,7 @@ public void BlameDataCollectorShouldNotOutputDumpFileWhenNoCrashOccurs(RunnerInf } [TestMethod] + // REVIEW ME: Shall we make the test supporting Linux? // netcoreapp2.1 dump is not supported on Linux [TestCategory("Windows-Review")] [NetFullTargetFrameworkDataSource] diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/DataCollectionTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/DataCollectionTests.cs index e97602ccb2..c4ef948000 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/DataCollectionTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/DataCollectionTests.cs @@ -85,7 +85,7 @@ public void DataCollectorAssemblyLoadingShouldNotThrowErrorForNetCore(RunnerInfo { SetTestEnvironment(_testEnvironment, runnerInfo); - var arguments = PrepareArguments(GetTestDllForFramework("AppDomainGetAssembliesTestProject.dll", "netcoreapp2.1"), string.Empty, string.Empty, FrameworkArgValue, resultsDirectory: TempDirectory.Path); + var arguments = PrepareArguments(GetTestDllForFramework("AppDomainGetAssembliesTestProject.dll", DEFAULT_RUNNER_NETCORE), string.Empty, string.Empty, FrameworkArgValue, resultsDirectory: TempDirectory.Path); InvokeVsTest(arguments); ValidateSummaryStatus(1, 0, 0); diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/DotnetArchitectureSwitchTests.Windows.cs b/test/Microsoft.TestPlatform.AcceptanceTests/DotnetArchitectureSwitchTests.Windows.cs index f3a6b07a6e..5211d3db7c 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/DotnetArchitectureSwitchTests.Windows.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/DotnetArchitectureSwitchTests.Windows.cs @@ -23,7 +23,7 @@ public class DotnetArchitectureSwitchTestsWindowsOnly : AcceptanceTestBase [DataRow("X86", "X64")] public void Use_EnvironmentVariables(string architectureFrom, string architectureTo) { - SetTestEnvironment(_testEnvironment, new RunnerInfo { RunnerFramework = "netcoreapp2.1" }); + SetTestEnvironment(_testEnvironment, new RunnerInfo { RunnerFramework = DEFAULT_RUNNER_NETCORE }); string dotnetPath = GetDownloadedDotnetMuxerFromTools(architectureFrom); string dotnetPathTo = GetDownloadedDotnetMuxerFromTools(architectureTo); var vstestConsolePath = GetDotnetRunnerPath(); diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/DotnetArchitectureSwitchTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/DotnetArchitectureSwitchTests.cs index a27ac574ba..a03c0c9776 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/DotnetArchitectureSwitchTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/DotnetArchitectureSwitchTests.cs @@ -18,7 +18,7 @@ namespace Microsoft.TestPlatform.AcceptanceTests; // >= x64 6.0.2xx // x64 5.0.4xx for Mac // x64 3.1.4XX for Win -// Manual test './tools/.../dotnet test ./test/Microsoft.TestPlatform.AcceptanceTests/bin/Debug/netcoreapp2.1/Microsoft.TestPlatform.AcceptanceTests.dll --testcasefilter:"DotnetArchitectureSwitchTests"' +// Manual test './tools/.../dotnet test ./test/Microsoft.TestPlatform.AcceptanceTests/bin/Debug/netcoreapp3.1/Microsoft.TestPlatform.AcceptanceTests.dll --testcasefilter:"DotnetArchitectureSwitchTests"' [TestClass] [Ignore("Manual tests(for now). Tests in this class need some .NET SDK global installations")] public class DotnetArchitectureSwitchTests : AcceptanceTestBase diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreRunnerAttribute.cs b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreRunnerAttribute.cs index 9873892dc4..977ae98fbc 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreRunnerAttribute.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreRunnerAttribute.cs @@ -14,9 +14,9 @@ namespace Microsoft.TestPlatform.AcceptanceTests; /// -/// Runs tests using the dotnet vstest.console.dll built against .NET Core 2.1. +/// Runs tests using the dotnet vstest.console.dll built against .NET Core 3.1. /// Provide a list of target frameworks to run the tests from given as a ';' separated list, or using a constant containing that range such as -/// AcceptanceTestBase.NETFX462_NET50 = "net462;net472;net48;netcoreapp2.1;netcoreapp3.1;net5.0" to determine which target framework of the project +/// AcceptanceTestBase.NETFX462_NET50 = "net462;net472;net48;netcoreapp3.1;net5.0" to determine which target framework of the project /// to test. The target project must list those TFMs in the TargetFrameworks property in csproj. /// [AttributeUsage(AttributeTargets.Method)] diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs index 55cfa933e5..5a5061bb79 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs @@ -34,6 +34,7 @@ public NetCoreTargetFrameworkDataSourceAttribute( bool useDesktopRunner = true, // adding another runner is not necessary until we need to start building against another // sdk, because the netcoreapp2.1 executable is forward compatible + // REVIEW ME: Does this comment needs to be updated? bool useCoreRunner = true, bool useNetCore31Target = true) { diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetFrameworkRunnerAttribute.cs b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetFrameworkRunnerAttribute.cs index daa154f13b..4d8b56c92e 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetFrameworkRunnerAttribute.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetFrameworkRunnerAttribute.cs @@ -15,7 +15,7 @@ namespace Microsoft.TestPlatform.AcceptanceTests; /// /// Runs tests using the dotnet vstest.console.dll built against .NET Core 2.1. /// Provide a list of target frameworks to run the tests from given as a ';' separated list, or using a constant containing that range such as -/// AcceptanceTestBase.NETFX462_NET50 = "net462;net472;net48;netcoreapp2.1;netcoreapp3.1;net5.0" to determine which target framework of the project +/// AcceptanceTestBase.NETFX462_NET50 = "net462;net472;net48;netcoreapp3.1;net5.0" to determine which target framework of the project /// to test. The target project must list those TFMs in the TargetFrameworks property in csproj. /// [AttributeUsage(AttributeTargets.Method)] diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/TestPlatformCompatibilityDataSource.cs b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/TestPlatformCompatibilityDataSource.cs index 6f48a5304d..be3724c6e0 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/TestPlatformCompatibilityDataSource.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/TestPlatformCompatibilityDataSource.cs @@ -11,7 +11,7 @@ namespace Microsoft.TestPlatform.AcceptanceTests; /// used only to test the most common scenarios, or special configurations that are candidates for their own /// specialized source. /// -/// By default net462 and netcoreapp2.1 are used for both runner and host. (4 combinations) +/// By default net462 and netcoreapp3.1 are used for both runner and host. (4 combinations) /// Then run with every version of runner is added. /// Then run with every version of test.sdk is added. /// Then run with every combination of testhost and adapter is added. diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CustomTestHostTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CustomTestHostTests.cs index 70222afd54..a36bcced07 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CustomTestHostTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CustomTestHostTests.cs @@ -61,7 +61,7 @@ public void RunTestsWithCustomTestHostLauncherLaunchesTheProcessUsingTheProvided [TestMethod] [TestCategory("Windows-Review")] // [RunnerCompatibilityDataSource(BeforeFeature = Features.ATTACH_DEBUGGER_FLOW)] - [TestHostCompatibilityDataSource("net462", "netcoreapp2.1", "LegacyStable", BeforeFeature = Features.ATTACH_DEBUGGER_FLOW, DebugVSTestConsole = true)] + [TestHostCompatibilityDataSource(DEFAULT_RUNNER_NETFX, DEFAULT_RUNNER_NETCORE, "LegacyStable", BeforeFeature = Features.ATTACH_DEBUGGER_FLOW, DebugVSTestConsole = true)] [Ignore("This is not working for any testhost prior 16.7.0 where the change was introduced. The launch testhost flow was replaced with AttachDebugger in runner, and the new callback to AttachDebugger happens in testhost." + "But any testhost prior 16.7.0 where the change was introduced does not know to call back AttachDebugger, and the call never happens.")] // You can confirm that the functionality broke between runner and testhost, past this point by using newer runners, against older testhosts. @@ -149,7 +149,7 @@ public void RunAllTestsWithMixedTFMsWillProvideAdditionalInformationToTheDebugge var vstestConsoleWrapper = GetVsTestConsoleWrapper(); var runEventHandler = new RunEventHandler(); var netFrameworkDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_RUNNER_NETFX); - var netDll = GetTestDllForFramework("MSTestProject1.dll", "netcoreapp2.1"); + var netDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_RUNNER_NETCORE); var testHostLauncher = new TestHostLauncherV3(); // Act @@ -180,7 +180,7 @@ public void RunAllTestsCallsBackToTestHostLauncherV3EvenWhenRunnerDoesNotSupport var vstestConsoleWrapper = GetVsTestConsoleWrapper(); var runEventHandler = new RunEventHandler(); var netFrameworkDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_RUNNER_NETFX); - var netDll = GetTestDllForFramework("MSTestProject1.dll", "netcoreapp2.1"); + var netDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_RUNNER_NETCORE); var testHostLauncher = new TestHostLauncherV3(); // Act diff --git a/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/DiaSessionTests.cs b/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/DiaSessionTests.cs index 0ab253cfa6..52e46e4930 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/DiaSessionTests.cs +++ b/test/Microsoft.TestPlatform.ObjectModel.PlatformTests/DiaSessionTests.cs @@ -20,7 +20,7 @@ public class DiaSessionTests : IntegrationTestBase #if NETFRAMEWORK "net462"; #else - "netcoreapp2.1"; + "netcoreapp3.1"; #endif return currentTargetFrameWork; } diff --git a/test/Microsoft.TestPlatform.SmokeTests/DataCollectorTests.Coverlet.cs b/test/Microsoft.TestPlatform.SmokeTests/DataCollectorTests.Coverlet.cs index 02d412fa68..18e1a7ceed 100644 --- a/test/Microsoft.TestPlatform.SmokeTests/DataCollectorTests.Coverlet.cs +++ b/test/Microsoft.TestPlatform.SmokeTests/DataCollectorTests.Coverlet.cs @@ -17,6 +17,7 @@ public class DataCollectorTestsCoverlets : IntegrationTestBase [TestMethod] public void RunCoverletCoverage() { + // REVIEW ME: @Marco do we need to update this test? // Collector is supported only for netcoreapp2.1, is compiled for netcoreapp2.1 and packaged as netstandard if (_testEnvironment.TargetFramework != CoreRunnerFramework) { @@ -24,7 +25,7 @@ public void RunCoverletCoverage() } // We use netcoreapp runner - // "...\vstest\tools\dotnet\dotnet.exe "...\vstest\artifacts\Debug\netcoreapp2.1\vstest.console.dll" --collect:"XPlat Code Coverage" ... + // "...\vstest\tools\dotnet\dotnet.exe "...\vstest\artifacts\Debug\netcoreapp3.1\vstest.console.dll" --collect:"XPlat Code Coverage" ... _testEnvironment.RunnerFramework = CoreRunnerFramework; var resultsDir = new TempDirectory(); From 8d6d5d45477adf2c4f34c5ae3747385b173b49d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 18 Jul 2022 14:06:29 +0200 Subject: [PATCH 07/34] Update packages --- scripts/verify-nupkgs.ps1 | 10 +++++----- .../nuspec/Microsoft.TestPlatform.Portable.nuspec | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/verify-nupkgs.ps1 b/scripts/verify-nupkgs.ps1 index fea60c54c5..31f9b0b675 100644 --- a/scripts/verify-nupkgs.ps1 +++ b/scripts/verify-nupkgs.ps1 @@ -13,15 +13,15 @@ function Verify-Nuget-Packages($packageDirectory, $version) Write-Log "Starting Verify-Nuget-Packages." $expectedNumOfFiles = @{ "Microsoft.CodeCoverage" = 57; - "Microsoft.NET.Test.Sdk" = 24; + "Microsoft.NET.Test.Sdk" = 18; "Microsoft.TestPlatform" = 599; "Microsoft.TestPlatform.Build" = 21; - "Microsoft.TestPlatform.CLI" = 498; + "Microsoft.TestPlatform.CLI" = 499; "Microsoft.TestPlatform.Extensions.TrxLogger" = 35; - "Microsoft.TestPlatform.ObjectModel" = 209; + "Microsoft.TestPlatform.ObjectModel" = 180; "Microsoft.TestPlatform.AdapterUtilities" = 62; - "Microsoft.TestPlatform.Portable" = 598; - "Microsoft.TestPlatform.TestHost" = 208; + "Microsoft.TestPlatform.Portable" = 597; + "Microsoft.TestPlatform.TestHost" = 153; "Microsoft.TestPlatform.TranslationLayer" = 123; "Microsoft.TestPlatform.Internal.Uwp" = 86; } diff --git a/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec b/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec index 9c7efb1590..f3024f17e0 100644 --- a/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec +++ b/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec @@ -300,7 +300,6 @@ - From 432625ce850ebab2683f33b102e8a01cf419af1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 18 Jul 2022 15:55:32 +0200 Subject: [PATCH 08/34] Update test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jakub Jareš --- .../Extension/NetCoreTargetFrameworkDataSourceAttribute.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs index 5a5061bb79..f8264530ad 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs @@ -32,9 +32,6 @@ public class NetCoreTargetFrameworkDataSourceAttribute : Attribute, ITestDataSou /// To run tests with core runner(dotnet vstest.console.dll) public NetCoreTargetFrameworkDataSourceAttribute( bool useDesktopRunner = true, - // adding another runner is not necessary until we need to start building against another - // sdk, because the netcoreapp2.1 executable is forward compatible - // REVIEW ME: Does this comment needs to be updated? bool useCoreRunner = true, bool useNetCore31Target = true) { From 4af9e4305598d83be2dee2d18d332c8974fc510d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 18 Jul 2022 15:55:39 +0200 Subject: [PATCH 09/34] Update src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jakub Jareš --- .../DebuggerBreakpoint.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs b/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs index e9c25bb94e..13bf3e90d9 100644 --- a/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs +++ b/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs @@ -125,6 +125,7 @@ private static bool AttachVs(Process process, int? vsPid) private static string? FindOnPath(string exeName) { + // TODO: Skip when PATH is not defined. var paths = Environment.GetEnvironmentVariable("PATH")!.Split(';'); foreach (var p in paths) { From ae0e88be90bc03d5d39142b72892d90790dfc54e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 18 Jul 2022 16:56:57 +0200 Subject: [PATCH 10/34] Avoid potential ArgumentNullException --- src/datacollector/DataCollectorMain.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/datacollector/DataCollectorMain.cs b/src/datacollector/DataCollectorMain.cs index 4fc0c28747..89b77bd4b5 100644 --- a/src/datacollector/DataCollectorMain.cs +++ b/src/datacollector/DataCollectorMain.cs @@ -128,7 +128,10 @@ public void Run(string[]? args) }); // Get server port and initialize communication. - int port = argsDictionary.TryGetValue(PortArgument, out var portValue) ? int.Parse(portValue!, CultureInfo.CurrentCulture) : 0; + int port = argsDictionary.TryGetValue(PortArgument, out var portValue) + && int.TryParse(portValue, NumberStyles.Integer, CultureInfo.CurrentCulture, out var p) + ? p + : 0; if (port <= 0) { From e6864bf72b1aaba38f5a4b7adddf62b6467d4f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 18 Jul 2022 17:16:01 +0200 Subject: [PATCH 11/34] Fix some warnings --- .../Microsoft.TestPlatform.CoreUtilities.csproj | 2 -- src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Microsoft.TestPlatform.CoreUtilities.csproj b/src/Microsoft.TestPlatform.CoreUtilities/Microsoft.TestPlatform.CoreUtilities.csproj index fa43d9df8f..ab410d21d1 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Microsoft.TestPlatform.CoreUtilities.csproj +++ b/src/Microsoft.TestPlatform.CoreUtilities/Microsoft.TestPlatform.CoreUtilities.csproj @@ -74,8 +74,6 @@ - - diff --git a/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs b/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs index a08f195822..6f2fd565df 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs @@ -27,7 +27,7 @@ public class TraitCollection : IEnumerable #else Resources.Resources.TestCasePropertyTraitsLabel, #endif - typeof(KeyValuePair[]), + typeof(KeyValuePair[]), #pragma warning disable 618 TestPropertyAttributes.Hidden | TestPropertyAttributes.Trait, #pragma warning restore 618 From ba7705e83b9730aa5ce3cf7db582c3382b544ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 18 Jul 2022 18:48:17 +0200 Subject: [PATCH 12/34] API is not available in netcoreapp --- .../PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt index dc4f1b293a..87a7776e0d 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt @@ -3,8 +3,6 @@ Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput.Write(string? message, Microsoft.VisualStudio.TestPlatform.Utilities.OutputLevel level) -> void Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput.WriteLine(string? message, Microsoft.VisualStudio.TestPlatform.Utilities.OutputLevel level) -> void Microsoft.VisualStudio.TestPlatform.Utilities.OutputExtensions -static Microsoft.VisualStudio.TestPlatform.ObjectModel.EqtTrace.TraceLevel.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel -static Microsoft.VisualStudio.TestPlatform.ObjectModel.EqtTrace.TraceLevel.set -> void static Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput.Instance.get -> Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput! static Microsoft.VisualStudio.TestPlatform.Utilities.OutputExtensions.Error(this Microsoft.VisualStudio.TestPlatform.Utilities.IOutput! output, bool appendPrefix, string! format, params object?[]? args) -> void static Microsoft.VisualStudio.TestPlatform.Utilities.OutputExtensions.Information(this Microsoft.VisualStudio.TestPlatform.Utilities.IOutput! output, bool appendPrefix, string! format, params object?[]? args) -> void From e421f603116fee26b81d8498b2941102cd24b654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 18 Jul 2022 18:57:56 +0200 Subject: [PATCH 13/34] More removal --- .../PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt index 2ceb9ba877..6562cba370 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt @@ -1,4 +1,2 @@ #nullable enable -static Microsoft.VisualStudio.TestPlatform.ObjectModel.EqtTrace.TraceLevel.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel (forwarded, contained in Microsoft.TestPlatform.CoreUtilities) -static Microsoft.VisualStudio.TestPlatform.ObjectModel.EqtTrace.TraceLevel.set -> void (forwarded, contained in Microsoft.TestPlatform.CoreUtilities) static Microsoft.VisualStudio.TestPlatform.ObjectModel.Framework.DefaultFramework.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Framework! From 3801bfeb06551eb7435a8aeb0b2c92a03b680fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 18 Jul 2022 19:17:21 +0200 Subject: [PATCH 14/34] Test --- .../PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt | 2 ++ src/Microsoft.TestPlatform.CoreUtilities/Tracing/EqtTrace.cs | 2 +- .../PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt index 87a7776e0d..dc4f1b293a 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.CoreUtilities/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt @@ -3,6 +3,8 @@ Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput.Write(string? message, Microsoft.VisualStudio.TestPlatform.Utilities.OutputLevel level) -> void Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput.WriteLine(string? message, Microsoft.VisualStudio.TestPlatform.Utilities.OutputLevel level) -> void Microsoft.VisualStudio.TestPlatform.Utilities.OutputExtensions +static Microsoft.VisualStudio.TestPlatform.ObjectModel.EqtTrace.TraceLevel.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel +static Microsoft.VisualStudio.TestPlatform.ObjectModel.EqtTrace.TraceLevel.set -> void static Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput.Instance.get -> Microsoft.VisualStudio.TestPlatform.Utilities.ConsoleOutput! static Microsoft.VisualStudio.TestPlatform.Utilities.OutputExtensions.Error(this Microsoft.VisualStudio.TestPlatform.Utilities.IOutput! output, bool appendPrefix, string! format, params object?[]? args) -> void static Microsoft.VisualStudio.TestPlatform.Utilities.OutputExtensions.Information(this Microsoft.VisualStudio.TestPlatform.Utilities.IOutput! output, bool appendPrefix, string! format, params object?[]? args) -> void diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Tracing/EqtTrace.cs b/src/Microsoft.TestPlatform.CoreUtilities/Tracing/EqtTrace.cs index 35c3a355e3..c7684f9d4a 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Tracing/EqtTrace.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Tracing/EqtTrace.cs @@ -52,7 +52,7 @@ public static TraceLevel TraceLevel #endif -#if NETSTANDARD || NET +#if NETSTANDARD || NET || NETCOREAPP3_1 public static PlatformTraceLevel TraceLevel { get diff --git a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt index 6562cba370..2ceb9ba877 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt +++ b/src/Microsoft.TestPlatform.ObjectModel/PublicAPI/netcoreapp3.1/PublicAPI.Shipped.txt @@ -1,2 +1,4 @@ #nullable enable +static Microsoft.VisualStudio.TestPlatform.ObjectModel.EqtTrace.TraceLevel.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.PlatformTraceLevel (forwarded, contained in Microsoft.TestPlatform.CoreUtilities) +static Microsoft.VisualStudio.TestPlatform.ObjectModel.EqtTrace.TraceLevel.set -> void (forwarded, contained in Microsoft.TestPlatform.CoreUtilities) static Microsoft.VisualStudio.TestPlatform.ObjectModel.Framework.DefaultFramework.get -> Microsoft.VisualStudio.TestPlatform.ObjectModel.Framework! From 5dd92e041e3dd8b8e7b39634fcb14d59e9825719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Tue, 19 Jul 2022 10:15:10 +0200 Subject: [PATCH 15/34] Fix unit tests --- .../Hosting/DotnetTestHostManagerTests.cs | 8 ++++---- .../AssemblyMetadataProviderTests.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs index 4249b83ff4..e2aa53b802 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs @@ -302,7 +302,7 @@ public void GetTestHostProcessStartInfoShouldUseTestHostExeFromNugetIfNotFoundIn var testhostExePath = "testhost.exe"; _dotnetHostManager.Initialize(_mockMessageLogger.Object, "x64"); _mockFileHelper.Setup(ph => ph.Exists(testhostExePath)).Returns(false); - _mockFileHelper.Setup(ph => ph.Exists("C:\\packages\\microsoft.testplatform.testhost\\15.0.0-Dev\\build\\netcoreapp2.1\\x64\\testhost.exe")).Returns(true); + _mockFileHelper.Setup(ph => ph.Exists("C:\\packages\\microsoft.testplatform.testhost\\15.0.0-Dev\\build\\netcoreapp3.1\\x64\\testhost.exe")).Returns(true); _mockEnvironment.Setup(ev => ev.OperatingSystem).Returns(PlatformOperatingSystem.Windows); var sourcePath = Path.Combine(_temp, "test.dll"); @@ -362,7 +362,7 @@ public void GetTestHostProcessStartInfoShouldUseTestHostExeFromNugetIfNotFoundIn var startInfo = _dotnetHostManager.GetTestHostProcessStartInfo(new[] { sourcePath }, null, _defaultConnectionInfo); - StringAssert.Contains(startInfo.FileName, "C:\\packages\\microsoft.testplatform.testhost\\15.0.0-Dev\\build\\netcoreapp2.1\\x64\\testhost.exe"); + StringAssert.Contains(startInfo.FileName, "C:\\packages\\microsoft.testplatform.testhost\\15.0.0-Dev\\build\\netcoreapp3.1\\x64\\testhost.exe"); } [TestMethod] @@ -372,7 +372,7 @@ public void GetTestHostProcessStartInfoShouldUseTestHostX86ExeFromNugetIfNotFoun var testhostExePath = "testhost.x86.exe"; _dotnetHostManager.Initialize(_mockMessageLogger.Object, "x86"); _mockFileHelper.Setup(ph => ph.Exists(testhostExePath)).Returns(false); - _mockFileHelper.Setup(ph => ph.Exists($"C:\\packages{Path.DirectorySeparatorChar}microsoft.testplatform.testhost\\15.0.0-Dev{Path.DirectorySeparatorChar}build\\netcoreapp2.1\\x86\\testhost.x86.exe")).Returns(true); + _mockFileHelper.Setup(ph => ph.Exists($"C:\\packages{Path.DirectorySeparatorChar}microsoft.testplatform.testhost\\15.0.0-Dev{Path.DirectorySeparatorChar}build\\netcoreapp3.1\\x86\\testhost.x86.exe")).Returns(true); _mockEnvironment.Setup(ev => ev.OperatingSystem).Returns(PlatformOperatingSystem.Windows); var sourcePath = Path.Combine(_temp, "test.dll"); @@ -432,7 +432,7 @@ public void GetTestHostProcessStartInfoShouldUseTestHostX86ExeFromNugetIfNotFoun var startInfo = _dotnetHostManager.GetTestHostProcessStartInfo(new[] { sourcePath }, null, _defaultConnectionInfo); - StringAssert.Contains(startInfo.FileName, "C:\\packages\\microsoft.testplatform.testhost\\15.0.0-Dev\\build\\netcoreapp2.1\\x86\\testhost.x86.exe"); + StringAssert.Contains(startInfo.FileName, "C:\\packages\\microsoft.testplatform.testhost\\15.0.0-Dev\\build\\netcoreapp3.1\\x86\\testhost.x86.exe"); } [TestMethod] diff --git a/test/vstest.console.PlatformTests/AssemblyMetadataProviderTests.cs b/test/vstest.console.PlatformTests/AssemblyMetadataProviderTests.cs index 795d380645..a3f7a5614f 100644 --- a/test/vstest.console.PlatformTests/AssemblyMetadataProviderTests.cs +++ b/test/vstest.console.PlatformTests/AssemblyMetadataProviderTests.cs @@ -127,7 +127,7 @@ public void GetFrameWorkForDotNetAssembly(string framework) } else { - Assert.AreEqual(".NETCoreApp,Version=v2.1", actualFx.FullName); + Assert.AreEqual(".NETCoreApp,Version=v3.1", actualFx.FullName); } Console.WriteLine("Framework:{0}, {1}", framework, string.Format(CultureInfo.CurrentCulture, PerfAssertMessageFormat, expectedElapsedTime, stopWatch.ElapsedMilliseconds)); From 54fb44bcb17973a765b3db77829d6778b2ae1a0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Tue, 19 Jul 2022 11:55:08 +0200 Subject: [PATCH 16/34] Fix failing acceptance tests --- .../ExecutionTests.cs | 7 +++++-- .../ProcessesInteractionTests.cs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/ExecutionTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/ExecutionTests.cs index 20b87a7eb2..69a8e8f227 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/ExecutionTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/ExecutionTests.cs @@ -214,7 +214,7 @@ public void StackOverflowExceptionShouldBeLoggedToConsoleAndDiagLogFile(RunnerIn InvokeVsTest(arguments); var errorMessage = "Process is terminated due to StackOverflowException."; - if (runnerInfo.TargetFramework.StartsWith("netcoreapp2.")) + if (runnerInfo.TargetFramework.StartsWith("netcoreapp")) { errorMessage = "Process is terminating due to StackOverflowException."; } @@ -243,7 +243,10 @@ public void UnhandleExceptionExceptionShouldBeLoggedToDiagLogFile(RunnerInfo run InvokeVsTest(arguments); - var errorFirstLine = "Test host standard error line: Unhandled Exception: System.InvalidOperationException: Operation is not valid due to the current state of the object."; + var errorFirstLine = + runnerInfo.TargetFramework.StartsWith("netcoreapp") + ? "Test host standard error line: Unhandled exception. System.InvalidOperationException: Operation is not valid due to the current state of the object." + : "Test host standard error line: Unhandled Exception: System.InvalidOperationException: Operation is not valid due to the current state of the object."; FileAssert.Contains(diagLogFilePath, errorFirstLine); File.Delete(diagLogFilePath); } diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/ProcessesInteractionTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/ProcessesInteractionTests.cs index 7ed44c56a4..13208c4d69 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/ProcessesInteractionTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/ProcessesInteractionTests.cs @@ -39,7 +39,7 @@ static void UpdateRuntimeConfigJsonWithInvalidFramework(string assemblyPath, str // that's only meant to be used by this project. var runtimeConfigJson = Path.Combine(Path.GetDirectoryName(assemblyPath)!, testAssetProjectName + ".runtimeconfig.json"); var fileContent = File.ReadAllText(runtimeConfigJson); - var updatedContent = fileContent.Replace("\"version\": \"2.1.0\"", "\"version\": \"0.0.0\""); + var updatedContent = fileContent.Replace("\"version\": \"3.1.0\"", "\"version\": \"0.0.0\""); File.WriteAllText(runtimeConfigJson, updatedContent); } } From 34279b5b84705ec9185ac9e1d6b8983960406bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Tue, 19 Jul 2022 16:30:49 +0200 Subject: [PATCH 17/34] More simplification --- .../SocketClientTests.cs | 5 ----- .../SocketServerTests.cs | 6 +----- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketClientTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketClientTests.cs index e0516e1a45..2461db6029 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketClientTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketClientTests.cs @@ -98,13 +98,8 @@ public void SocketClientShouldRaiseClientDisconnectedEventIfConnectionIsBroken() // Close the communication from server side _tcpClient?.GetStream().Dispose(); -#if NETFRAMEWORK // tcpClient.Close() calls tcpClient.Dispose(). _tcpClient?.Close(); -#else - // tcpClient.Close() not available for netcoreapp1.0 - _tcpClient?.Dispose(); -#endif Assert.IsTrue(waitEvent.WaitOne(Timeout)); } diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketServerTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketServerTests.cs index 249ebbfa1f..ac1b866a77 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketServerTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.PlatformTests/SocketServerTests.cs @@ -130,13 +130,9 @@ public void SocketServerShouldRaiseClientDisconnectedEventIfConnectionIsBroken() }; // Close the client channel. Message loop should stop. -#if NETFRAMEWORK // tcpClient.Close() calls tcpClient.Dispose(). _tcpClient?.Close(); -#else - // tcpClient.Close() not available for netcoreapp1.0 - _tcpClient?.Dispose(); -#endif + Assert.IsTrue(waitEvent.WaitOne(1000)); Assert.IsTrue(clientDisconnected!.Error is IOException); } From e0b5f90fcf081ae26841a4e1d62daec5d815f7e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Wed, 20 Jul 2022 13:06:30 +0200 Subject: [PATCH 18/34] Fix acceptance tests? --- .../Extension/CompatibilityRowsBuilder.cs | 4 +++- .../TranslationLayerTests/RunTestsWithFilterTests.cs | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/CompatibilityRowsBuilder.cs b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/CompatibilityRowsBuilder.cs index dfa0b5d58c..33bf7b88e6 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/CompatibilityRowsBuilder.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/CompatibilityRowsBuilder.cs @@ -360,7 +360,9 @@ true when NuGetVersion.TryParse(version, out var v) && new NuGetVersion(v.Major, v.Minor, v.Patch) < new NuGetVersion("17.3.0") => GetToolsPath("net451"), true => GetToolsPath("net462"), false when version.StartsWith("15.") => GetContentFilesPath("netcoreapp2.0"), - false => GetContentFilesPath("netcoreapp2.1"), + false when NuGetVersion.TryParse(version, out var v) + && new NuGetVersion(v.Major, v.Minor, v.Patch) < new NuGetVersion("17.4.0") => GetContentFilesPath("netcoreapp2.1"), + false => GetContentFilesPath("netcoreapp3.1"), }; return new VSTestConsoleInfo diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTestsWithFilterTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTestsWithFilterTests.cs index 152419a681..77627b3e3d 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTestsWithFilterTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTestsWithFilterTests.cs @@ -40,7 +40,6 @@ public void Cleanup() public void RunTestsWithTestCaseFilter(RunnerInfo runnerInfo) { SetTestEnvironment(_testEnvironment, runnerInfo); - // Setup(); _runEventHandler = new RunEventHandler(); From db8621782601a63de5b72a326c1e6c61ac1be6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Wed, 20 Jul 2022 19:26:11 +0200 Subject: [PATCH 19/34] Ensure properties are defined for isolated acceptance tests --- scripts/build/TestAssets.props | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/build/TestAssets.props b/scripts/build/TestAssets.props index c442c962d6..a5a7ecd8b1 100644 --- a/scripts/build/TestAssets.props +++ b/scripts/build/TestAssets.props @@ -4,6 +4,8 @@ true false + net462 + netcoreapp3.1 From 26fb2c1ee8e10fc31c89cb5ab907189606837497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Thu, 21 Jul 2022 16:05:58 +0200 Subject: [PATCH 20/34] More updates --- .../TestPlatform.cs | 1 - .../DebuggerBreakpoint.cs | 19 +------------------ .../Hosting/DotnetTestHostManager.cs | 3 --- .../BlameDataCollectorTests.cs | 8 -------- 4 files changed, 1 insertion(+), 30 deletions(-) diff --git a/src/Microsoft.TestPlatform.Client/TestPlatform.cs b/src/Microsoft.TestPlatform.Client/TestPlatform.cs index 6e36e73956..39100ed5ad 100644 --- a/src/Microsoft.TestPlatform.Client/TestPlatform.cs +++ b/src/Microsoft.TestPlatform.Client/TestPlatform.cs @@ -7,7 +7,6 @@ using System.IO; using System.Linq; using System.Reflection; -using System.Reflection.Metadata; using Microsoft.VisualStudio.TestPlatform.Client.Discovery; using Microsoft.VisualStudio.TestPlatform.Client.Execution; diff --git a/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs b/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs index 13bf3e90d9..3d859427df 100644 --- a/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs +++ b/src/Microsoft.TestPlatform.Execution.Shared/DebuggerBreakpoint.cs @@ -18,9 +18,6 @@ internal static class DebuggerBreakpoint { internal static void AttachVisualStudioDebugger(string environmentVariable) { -#if NETCOREAPP1_0 - return; -#else if (string.IsNullOrWhiteSpace(environmentVariable)) { throw new ArgumentException($"'{nameof(environmentVariable)}' cannot be null or whitespace.", nameof(environmentVariable)); @@ -53,14 +50,10 @@ internal static void AttachVisualStudioDebugger(string environmentVariable) Break(); } -#endif } private static bool AttachVs(Process process, int? vsPid) { -#if NETCOREAPP1_0 - return false; -#else // The way we attach VS is not compatible with .NET Core 2.1 and .NET Core 3.1, but works in .NET Framework and .NET. // We could call the library code directly here for .NET, and .NET Framework, but then we would also need to package it // together with testhost. So instead we always run the executable, and pass path to it using env variable. @@ -84,15 +77,10 @@ private static bool AttachVs(Process process, int? vsPid) attachVsProcess.WaitForExit(); return attachVsProcess.ExitCode == 0; -#endif } private static string? FindAttachVs() { -#if NETCOREAPP1_0 - return null; -#else - var fromPath = FindOnPath("AttachVS.exe"); if (fromPath != null) { @@ -100,13 +88,9 @@ private static bool AttachVs(Process process, int? vsPid) } -# if NETCOREAPP - var parent = AppContext.BaseDirectory; -#else // Don't use current process MainModule here, it resolves to dotnet if you invoke // dotnet vstest.console.dll, or dotnet testhost.dll. Use the entry assembly instead. - var parent = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); -#endif + var parent = Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location); while (parent != null) { var path = Path.Combine(parent, @"src\AttachVS\bin\Debug\net472\AttachVS.exe"); @@ -120,7 +104,6 @@ private static bool AttachVs(Process process, int? vsPid) } return parent; -#endif } private static string? FindOnPath(string exeName) diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index c08e5f6494..9bcf3ef160 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -264,9 +264,6 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( bool testHostExeFound = false; if (!useCustomDotnetHostpath && _platformEnvironment.OperatingSystem.Equals(PlatformOperatingSystem.Windows) - // REVIEW ME: @Marco Do we need to update the logic? - // testhost*.exe are build for netcoreapp2.1 and are not able to search for the correct runtime in case of - // x64/x86 on arm because the new logic (registry lookup) was added in since netcoreapp3.0. // On arm we cannot rely on apphost and we'll use dotnet.exe muxer. && !IsWinOnArm()) { diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs index e92f6aada1..60b31fe970 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/BlameDataCollectorTests.cs @@ -40,8 +40,6 @@ public BlameDataCollectorTests() } [TestMethod] - // REVIEW ME: Shall we make the test supporting Linux? - // netcoreapp2.1 dump is not supported on Linux [TestCategory("Windows-Review")] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] @@ -58,8 +56,6 @@ public void BlameDataCollectorShouldGiveCorrectTestCaseName(RunnerInfo runnerInf } [TestMethod] - // REVIEW ME: Shall we make the test supporting Linux? - // netcoreapp2.1 dump is not supported on Linux [TestCategory("Windows-Review")] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] @@ -84,8 +80,6 @@ public void BlameDataCollectorShouldOutputDumpFile(RunnerInfo runnerInfo) } [TestMethod] - // REVIEW ME: Shall we make the test supporting Linux? - // netcoreapp2.1 dump is not supported on Linux [TestCategory("Windows-Review")] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] @@ -110,8 +104,6 @@ public void BlameDataCollectorShouldNotOutputDumpFileWhenNoCrashOccurs(RunnerInf } [TestMethod] - // REVIEW ME: Shall we make the test supporting Linux? - // netcoreapp2.1 dump is not supported on Linux [TestCategory("Windows-Review")] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] From 9cfc71a227a752fd5d7653bd5167591ebb006d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Fri, 22 Jul 2022 15:11:10 +0200 Subject: [PATCH 21/34] More fixes --- .../Hosting/DefaultTestHostManager.cs | 2 +- .../DifferentTestFrameworkSimpleTests.cs | 2 +- .../NetCoreTargetFrameworkDataSourceAttribute.cs | 15 +++------------ .../SelfContainedAppTests.cs | 2 +- .../Hosting/DefaultTestHostManagerTests.cs | 12 ++++++++++++ 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs index a201803923..ce76668cca 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs @@ -173,7 +173,7 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( var testhostProcessPath = Path.Combine(currentWorkingDirectory, testHostProcessName); var originalTestHostProcessName = testHostProcessName; - if (!File.Exists(testhostProcessPath)) + if (!_fileHelper.Exists(testhostProcessPath)) { // "TestHost" is the name of the folder which contain Full CLR built testhost package assemblies, in dotnet SDK. testHostProcessName = Path.Combine("TestHost", originalTestHostProcessName); diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/DifferentTestFrameworkSimpleTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/DifferentTestFrameworkSimpleTests.cs index 950cb1a629..2116787346 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/DifferentTestFrameworkSimpleTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/DifferentTestFrameworkSimpleTests.cs @@ -54,7 +54,7 @@ public void CPPRunAllTestExecutionPlatformx64NetFramework(RunnerInfo runnerInfo) // C++ tests cannot run in .NET Framework host under .NET Core, because we only ship .NET Standard CPP adapter in .NET Core // We also don't test x86 for .NET Core, because the resolver there does not switch between x86 and x64 correctly, it just uses the parent process bitness. // We run this on netcore31 and not the default netcore21 because netcore31 is the minimum tfm that has the runtime features we need, such as additionaldeps. - [NetCoreTargetFrameworkDataSource(useDesktopRunner: false, useCoreRunner: true, useNetCore31Target: true)] + [NetCoreTargetFrameworkDataSource(useDesktopRunner: false, useCoreRunner: true)] public void CPPRunAllTestExecutionPlatformx64Net(RunnerInfo runnerInfo) { SetTestEnvironment(_testEnvironment, runnerInfo); diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs index f8264530ad..eec13fe74c 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/Extension/NetCoreTargetFrameworkDataSourceAttribute.cs @@ -23,7 +23,6 @@ public class NetCoreTargetFrameworkDataSourceAttribute : Attribute, ITestDataSou { private readonly bool _useDesktopRunner; private readonly bool _useCoreRunner; - private readonly bool _useNetCore31Target; /// /// Initializes a new instance of the class. @@ -32,12 +31,10 @@ public class NetCoreTargetFrameworkDataSourceAttribute : Attribute, ITestDataSou /// To run tests with core runner(dotnet vstest.console.dll) public NetCoreTargetFrameworkDataSourceAttribute( bool useDesktopRunner = true, - bool useCoreRunner = true, - bool useNetCore31Target = true) + bool useCoreRunner = true) { _useDesktopRunner = useDesktopRunner; _useCoreRunner = useCoreRunner; - _useNetCore31Target = useNetCore31Target; } public bool DebugVSTestConsole { get; set; } @@ -71,20 +68,14 @@ public IEnumerable GetData(MethodInfo methodInfo) { var runnerFramework = IntegrationTestBase.DesktopRunnerFramework; - if (_useNetCore31Target) - { - AddRunnerDataRow(dataRows, runnerFramework, AcceptanceTestBase.Core31TargetFramework); - } + AddRunnerDataRow(dataRows, runnerFramework, AcceptanceTestBase.Core31TargetFramework); } if (_useCoreRunner) { var runnerFramework = IntegrationTestBase.CoreRunnerFramework; - if (_useNetCore31Target) - { - AddRunnerDataRow(dataRows, runnerFramework, AcceptanceTestBase.Core31TargetFramework); - } + AddRunnerDataRow(dataRows, runnerFramework, AcceptanceTestBase.Core31TargetFramework); } return dataRows; diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/SelfContainedAppTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/SelfContainedAppTests.cs index 4c30a7c8ed..0f55c5147a 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/SelfContainedAppTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/SelfContainedAppTests.cs @@ -13,7 +13,7 @@ public class SelfContainedAppTests : AcceptanceTestBase { [TestMethod] [TestCategory("Windows-Review")] - [NetCoreTargetFrameworkDataSourceAttribute(useDesktopRunner: false, useNetCore31Target: true)] + [NetCoreTargetFrameworkDataSourceAttribute(useDesktopRunner: false)] public void RunningApplicationThatIsBuiltAsSelfContainedWillNotFailToFindHostpolicyDll(RunnerInfo runnerInfo) { // when the application is self-contained which is dictated by the RuntimeIdentifier and OutputType project diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs index 1264c0cad2..323a93f27e 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs @@ -84,11 +84,23 @@ public void ConstructorShouldSetX64ProcessForX64Architecture() public void GetTestHostProcessStartInfoShouldIncludeFileNameFromSubFolderTestHostWhenCurrentProcessIsDotnet() { _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); Assert.IsTrue(startInfo.FileName!.EndsWith(Path.Combine("TestHost", "testhost.exe"))); } + [TestMethod] + public void GetTestHostProcessStartInfoShouldNotIncludeFileNameFromSubFolderTestHostWhenCurrentProcessIsDotnet() + { + _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); + + Assert.IsFalse(startInfo.FileName!.EndsWith(Path.Combine("TestHost", "testhost.exe"))); + Assert.IsTrue(startInfo.FileName!.EndsWith("testhost.exe")); + } + [TestMethod] public void GetTestHostProcessStartInfoShouldNotIncludeFileNameFromSubFolderTestHostWhenCurrentProcessIsIde() { From d3d64cb8a6fe51b5832d1f4b9583e42302e4cd27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Fri, 22 Jul 2022 16:39:29 +0200 Subject: [PATCH 22/34] Remove no longer needed code --- src/testhost.x86/TestHostTraceListener.cs | 35 ----------------------- 1 file changed, 35 deletions(-) diff --git a/src/testhost.x86/TestHostTraceListener.cs b/src/testhost.x86/TestHostTraceListener.cs index 6406eac182..3be97db76a 100644 --- a/src/testhost.x86/TestHostTraceListener.cs +++ b/src/testhost.x86/TestHostTraceListener.cs @@ -31,31 +31,6 @@ public static void Setup() } EqtTrace.Verbose("TestPlatformTraceListener.Setup: Added test platform trace listener."); - - // REVIEW ME: Shall we remove this fix? - // this is a netcoreapp2.1 only fix, but because we always compile against netcoreapp2.1 - // and upgrade the executable as necessary this needs to be a runtime check and not a compile time - // check. This call returns ".NET Core 4.6.xxx" on netcore 2.1 and older, and ".NET Core 3.1.xxx" - // or the respective version on the newer runtimes - if (System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription.StartsWith(".NET Core 4.6")) - { - try - { - // workaround for netcoreapp2.1 where the trace listener api is not called when - // TPDebug.Assert fails. This method is internal, but the class is on purpose keeping the - // callback settable so tests can set the callback - var field = typeof(Debug).GetField("s_ShowDialog", BindingFlags.Static | BindingFlags.NonPublic); - if (field != null) - { - var value = field.GetValue(null); - field.SetValue(null, (Action)ShowDialog); - } - } - catch (Exception ex) - { - EqtTrace.Error("TestPlatformTraceListener.Setup: Failed to replace inner callback to ShowDialog in TPDebug.Assert. Calls to TPDebug.Assert with crash the test host process. {0}", ex); - } - } } public override void Fail(string message) @@ -68,16 +43,6 @@ public override void Fail(string message, string detailMessage) throw GetException((message + Environment.NewLine + detailMessage)); } - public static void ShowDialog(string stackTrace, string message, string detailMessage, string _) - { - var text = !string.IsNullOrEmpty(message) - ? !string.IsNullOrEmpty(detailMessage) - ? (message + Environment.NewLine + detailMessage) - : message - : null; - throw GetException(text); - } - private static DebugAssertException GetException(string? message) { var stack = new StackTrace(true); From 41b81d9b39139ac68177b96f5c4e1c81b32b014e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Fri, 22 Jul 2022 16:39:54 +0200 Subject: [PATCH 23/34] Add trick to bump netcoreapp version --- .../Hosting/DotnetTestHostManager.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index 9bcf3ef160..0e16bb0fa2 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -449,6 +449,13 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( EqtTrace.Verbose("DotnetTestHostmanager: Full path of host exe is {0}", startInfo.FileName); + if (_targetFramework.Name.StartsWith(".NETCoreApp,", StringComparison.OrdinalIgnoreCase) + && Version.TryParse(_targetFramework.Version, out var version) + && version < new Version(3, 0)) + { + args += " --roll-forward Major"; + } + args += " " + connectionInfo.ToCommandLineOptions(); // Create a additional probing path args with Nuget.Client From 3d87612117743f272f7b0d45a144951916660816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Fri, 22 Jul 2022 17:29:37 +0200 Subject: [PATCH 24/34] Fix unit test --- .../Hosting/DotnetTestHostManagerTests.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs index e2aa53b802..52eb7d5270 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DotnetTestHostManagerTests.cs @@ -587,7 +587,11 @@ public void GetTestPlatformExtensionsShouldNotAddNonCoverletDataCollectorsExtens [TestMethod] public async Task LaunchTestHostShouldLaunchProcessWithConnectionInfo() { - var expectedArgs = "exec \"" + _defaultTestHostPath + "\" --port 123 --endpoint 127.0.0.1:123 --role client --parentprocessid 0"; + var expectedArgs = "exec \"" + _defaultTestHostPath + "\"" +#if NET + + " --roll-forward Major" +#endif + + " --port 123 --endpoint 127.0.0.1:123 --role client --parentprocessid 0"; _dotnetHostManager.SetCustomLauncher(_mockTestHostLauncher.Object); await _dotnetHostManager.LaunchTestHostAsync(_defaultTestProcessStartInfo, CancellationToken.None); From 382fde39d06ab08b42f7c2b04ee90fd2164fc990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 25 Jul 2022 15:53:17 +0200 Subject: [PATCH 25/34] Fixeeesss --- scripts/build.ps1 | 36 ++- .../DefaultDataCollectionLauncher.cs | 6 +- .../Hosting/DefaultTestHostManager.cs | 10 +- .../Hosting/DotnetTestHostManager.cs | 4 +- .../Microsoft.TestPlatform.Portable.nuspec | 250 +++++++++--------- .../nuspec/Microsoft.TestPlatform.nuspec | 242 ++++++++--------- .../nuspec/TestPlatform.ObjectModel.nuspec | 4 +- .../Hosting/DefaultTestHostManagerTests.cs | 9 +- 8 files changed, 281 insertions(+), 280 deletions(-) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 70c909eccc..66729792b4 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -266,7 +266,7 @@ function Invoke-CompatibilityTestAssetsBuild { } if ($rebuild) { - if (Test-Path $generated) { + if (Test-Path $generated) { Remove-Item $generated -Recurse -Force } @@ -279,7 +279,7 @@ function Invoke-CompatibilityTestAssetsBuild { Invoke-Exe $dotnetExe -Arguments "new sln --name CompatibilityTestAssets --output ""$generated""" - Write-Log ".. .. Build: Source: $generatedSln" + Write-Log ".. .. Build: Source: $generatedSln" try { $projectsToAdd = @() $nugetConfigSource = Join-Path $TPB_TestAssets "NuGet.config" @@ -326,7 +326,7 @@ function Invoke-CompatibilityTestAssetsBuild { $dirMSTestPropertyName = $propertyName -replace "Framework" -replace "Version" # Do not make this a folder structure, it will break the relative reference to scripts\build\TestAssets.props that we have in the project, - # because the relative path will be different. + # because the relative path will be different. # # It would be nice to use fully descriptive name but it is too long, hash the versions instead. # $compatibilityProjectDir = "$generated/$projectBaseName--$dirNetTestSdkPropertyName-$dirNetTestSdkVersion--$dirMSTestPropertyName-$dirMSTestVersion" @@ -336,7 +336,7 @@ function Invoke-CompatibilityTestAssetsBuild { $projectShortName = "$projectBaseName--" + $hash $compatibilityProjectDir = "$generated/$projectShortName" - if (Test-path $compatibilityProjectDir) { + if (Test-path $compatibilityProjectDir) { throw "Path '$compatibilityProjectDir' does not exist" } New-Item -ItemType Directory -Path $compatibilityProjectDir | Out-Null @@ -426,7 +426,7 @@ function Publish-Package { $netstandard13PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkNS13"); $netstandard20PackageDir = $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkNS20"); $coreCLR31PackageDir = Get-CoreCLR31PackageDirectory - $coreCLR31TestHostPackageDir = Get-CoreCLR31TestHostPackageDirectory + $coreClrNetFrameworkTestHostDir = Join-Path $coreCLR31PackageDir "TestHostNetFramework" $packageProject = Join-Path $env:TP_PACKAGE_PROJ_DIR "package\package.csproj" $testHostProject = Join-Path $env:TP_ROOT_DIR "src\testhost\testhost.csproj" $testHostx86Project = Join-Path $env:TP_ROOT_DIR "src\testhost.x86\testhost.x86.csproj" @@ -515,14 +515,12 @@ function Publish-Package { Copy-Item $testhostCore31PackageTempARM64Dir\Microsoft.TestPlatform.PlatformAbstractions.dll $testhostCore31PackageARM64Dir -Force # Copy over the Full CLR built testhost package assemblies to the Core CLR and Full CLR package folder. - $coreCLRFull_Dir = "TestHost" - $fullDestDir = Join-Path $coreCLR31PackageDir $coreCLRFull_Dir - New-Item -ItemType directory -Path $fullDestDir -Force | Out-Null - Copy-Item $testhostFullPackageDir\* $fullDestDir -Force -Recurse + New-Item -ItemType directory -Path $coreClrNetFrameworkTestHostDir -Force | Out-Null + Copy-Item $testhostFullPackageDir\* $coreClrNetFrameworkTestHostDir -Force -Recurse # Copy over the Full CLR built datacollector package assemblies to the Core CLR package folder along with testhost - Publish-PackageWithRuntimeInternal $dataCollectorProject $TPB_TargetFramework472 $TPB_ARM64_Runtime false $fullDestDir - Publish-PackageWithRuntimeInternal $dataCollectorProject $TPB_TargetFramework472 $TPB_X64_Runtime false $fullDestDir + Publish-PackageWithRuntimeInternal $dataCollectorProject $TPB_TargetFramework472 $TPB_ARM64_Runtime false $coreClrNetFrameworkTestHostDir + Publish-PackageWithRuntimeInternal $dataCollectorProject $TPB_TargetFramework472 $TPB_X64_Runtime false $coreClrNetFrameworkTestHostDir New-Item -ItemType directory -Path $net462PackageDir -Force | Out-Null Copy-Item $testhostFullPackageDir\* $net462PackageDir -Force -Recurse @@ -604,7 +602,7 @@ function Publish-Package { Copy-Item -Recurse $comComponentsDirectory\* $testhostCore31PackageDir -Force Copy-Item -Recurse $comComponentsDirectory\* $testhostFullPackageDir -Force Copy-Item -Recurse $comComponentsDirectory\* $testhostUapPackageDir -Force - Copy-Item -Recurse $comComponentsDirectory\* $coreCLR31TestHostPackageDir -Force + Copy-Item -Recurse $comComponentsDirectory\* $coreClrNetFrameworkTestHostDir -Force # Copy over the logger assemblies to the Extensions folder. $extensions_Dir = "Extensions" @@ -735,13 +733,13 @@ function Publish-Package { Copy-Item $newtonsoft $coreCLR31PackageDir -Force # Copy .NET Standard CPP Test adapter - New-Item "$net462PackageDir\TestHost" -ItemType Directory -Force | Out-Null - $fullCLRTestHostDir = "$net462PackageDir\TestHost" + $fullClrNetTestHostDir = "$net462PackageDir\TestHostNet" + New-Item $fullClrNetTestHostDir -ItemType Directory -Force | Out-Null $testPlatformRemoteExternalsVersion = ([xml](Get-Content "$env:TP_ROOT_DIR\scripts\build\TestPlatform.Dependencies.props")).Project.PropertyGroup.TestPlatformRemoteExternalsVersion $testPlatformRemoteExternalsSourceDirectory = Join-Path $env:TP_PACKAGES_DIR "Microsoft.Internal.TestPlatform.Remote\$testPlatformRemoteExternalsVersion\tools\netstandard\Extensions\*" Copy-Item $testPlatformRemoteExternalsSourceDirectory $coreCLR31PackageDir -Force -Recurse - Copy-Item $testPlatformRemoteExternalsSourceDirectory $fullCLRTestHostDir -Force -Recurse + Copy-Item $testPlatformRemoteExternalsSourceDirectory $fullClrNetTestHostDir -Force -Recurse # Copy standalone testhost $standaloneTesthost = Join-Path $env:TP_ROOT_DIR "temp\testhost\*" @@ -751,8 +749,8 @@ function Publish-Package { Get-Item "$testhostCore31PackageDir\*" | Where-Object { $_.Name -notin ("x64", "x86", "win7-x64", "win7-x86", "testhost.deps.json", "testhost.runtimeconfig.json") } | - Copy-Item -Recurse -Destination $fullCLRTestHostDir -Force - Copy-Item $standaloneTesthost $fullCLRTestHostDir -Force + Copy-Item -Recurse -Destination $fullClrNetTestHostDir -Force + Copy-Item $standaloneTesthost $fullClrNetTestHostDir -Force # For libraries that are externally published, copy the output into artifacts. These will be signed and packaged independently. Copy-PackageItems "Microsoft.TestPlatform.Build" @@ -1179,10 +1177,6 @@ function Get-CoreCLR31PackageDirectory { return $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkCore31") } -function Get-CoreCLR31TestHostPackageDirectory { - return $(Join-Path $env:TP_OUT_DIR "$TPB_Configuration\$TPB_TargetFrameworkCore31\TestHost") -} - function Locate-MSBuildPath { $vsInstallPath = Locate-VsInstallPath $msbuildPath = Get-ChildItem (Join-Path -path $vsInstallPath -childPath "MSBuild\*\Bin\MSBuild.exe") diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs index 685a80fc5e..866cdc612e 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/DataCollection/DefaultDataCollectionLauncher.cs @@ -60,10 +60,12 @@ public override int LaunchDataCollector(IDictionary? environmen TPDebug.Assert(currentProcessPath is not null, "currentProcessPath is not null"); // If current process is dotnet/dotnet.exe and you are here, datacollector.exe/datacollector.arm64.exe is present in TestHost folder. - string dataCollectorProcessName = _processHelper.GetCurrentProcessArchitecture() == PlatformArchitecture.ARM64 ? DataCollectorProcessNameArm64 : DataCollectorProcessName; + string dataCollectorProcessName = _processHelper.GetCurrentProcessArchitecture() == PlatformArchitecture.ARM64 + ? DataCollectorProcessNameArm64 + : DataCollectorProcessName; string dataCollectorProcessPath = currentProcessPath.EndsWith("dotnet", StringComparison.OrdinalIgnoreCase) || currentProcessPath.EndsWith("dotnet.exe", StringComparison.OrdinalIgnoreCase) - ? Path.Combine(dataCollectorDirectory, "TestHost", dataCollectorProcessName) + ? Path.Combine(dataCollectorDirectory, "TestHostNetFramework", dataCollectorProcessName) : Path.Combine(dataCollectorDirectory, dataCollectorProcessName); var argumentsString = string.Join(" ", commandLineArguments); diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs index ce76668cca..2eca302b43 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs @@ -173,10 +173,13 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( var testhostProcessPath = Path.Combine(currentWorkingDirectory, testHostProcessName); var originalTestHostProcessName = testHostProcessName; + if (!_fileHelper.Exists(testhostProcessPath)) { - // "TestHost" is the name of the folder which contain Full CLR built testhost package assemblies, in dotnet SDK. - testHostProcessName = Path.Combine("TestHost", originalTestHostProcessName); + // We assume that we could not find testhost.exe in the root folder so we are going to lookup in the + // TestHostNetFramework folder (assuming we are currently running under netcoreapp3.1) or in dotnet SDK + // context. + testHostProcessName = Path.Combine("TestHostNetFramework", originalTestHostProcessName); testhostProcessPath = Path.Combine(currentWorkingDirectory, "..", testHostProcessName); } @@ -187,7 +190,7 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( argumentsString += " --testsourcepath " + sources.FirstOrDefault()?.AddDoubleQuote(); } - EqtTrace.Verbose("DefaultTestHostmanager: Full path of {0} is {1}", testHostProcessName, testhostProcessPath); + EqtTrace.Verbose("DefaultTestHostmanager.GetTestHostProcessStartInfo: Trying to use {0} from {1}", originalTestHostProcessName, testhostProcessPath); var launcherPath = testhostProcessPath; var processName = _processHelper.GetCurrentProcessFileName(); @@ -208,6 +211,7 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( && !File.Exists(testhostProcessPath)) { testhostProcessPath = Path.Combine(currentWorkingDirectory, "..", originalTestHostProcessName); + EqtTrace.Verbose("DefaultTestHostmanager.GetTestHostProcessStartInfo: Could not find {0} in previous location, now using {1}", originalTestHostProcessName, testhostProcessPath); launcherPath = testhostProcessPath; } } diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index 0e16bb0fa2..d370d17d56 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -322,9 +322,9 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( if (testHostPath.IsNullOrEmpty()) { - // We still did not find testhost.dll. Try finding it next to vstest.console, (or in next to vstest.console ./TestHost for .NET Framework) + // We still did not find testhost.dll. Try finding it next to vstest.console, (or in next to vstest.console ./TestHostNet for .NET Framework) #if NETFRAMEWORK - var testHostNextToRunner = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location)!, "TestHost", "testhost.dll"); + var testHostNextToRunner = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location)!, "TestHostNet", "testhost.dll"); #else var testHostNextToRunner = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location)!, "testhost.dll"); #endif diff --git a/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec b/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec index f3024f17e0..3300a02e27 100644 --- a/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec +++ b/src/package/nuspec/Microsoft.TestPlatform.Portable.nuspec @@ -464,135 +464,135 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/package/nuspec/Microsoft.TestPlatform.nuspec b/src/package/nuspec/Microsoft.TestPlatform.nuspec index c60e443ab3..dc8ce5b6de 100644 --- a/src/package/nuspec/Microsoft.TestPlatform.nuspec +++ b/src/package/nuspec/Microsoft.TestPlatform.nuspec @@ -503,127 +503,127 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/package/nuspec/TestPlatform.ObjectModel.nuspec b/src/package/nuspec/TestPlatform.ObjectModel.nuspec index 1d0c405c3e..094f9dafd5 100644 --- a/src/package/nuspec/TestPlatform.ObjectModel.nuspec +++ b/src/package/nuspec/TestPlatform.ObjectModel.nuspec @@ -125,8 +125,8 @@ - - + + diff --git a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs index 323a93f27e..5168e8f28b 100644 --- a/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.TestHostProvider.UnitTests/Hosting/DefaultTestHostManagerTests.cs @@ -87,7 +87,7 @@ public void GetTestHostProcessStartInfoShouldIncludeFileNameFromSubFolderTestHos _mockFileHelper.Setup(x => x.Exists(It.IsAny())).Returns(false); var startInfo = _testHostManager.GetTestHostProcessStartInfo(Enumerable.Empty(), null, default); - Assert.IsTrue(startInfo.FileName!.EndsWith(Path.Combine("TestHost", "testhost.exe"))); + Assert.IsTrue(startInfo.FileName!.EndsWith(Path.Combine("TestHostNetFramework", "testhost.exe"))); } [TestMethod] @@ -189,7 +189,7 @@ public void GetTestHostProcessStartInfoShouldUseMonoAsHostOnNonWindowsIfNotStart default); Assert.AreEqual("/usr/bin/mono", info.FileName); - StringAssert.Contains(info.Arguments, "TestHost" + Path.DirectorySeparatorChar + "testhost.exe\""); + StringAssert.Contains(info.Arguments, Path.Combine("TestHostNetFramework", "testhost.exe")); } [TestMethod] @@ -205,8 +205,9 @@ public void GetTestHostProcessStartInfoShouldNotUseMonoAsHostOnNonWindowsIfStart null, default); - StringAssert.Contains(info.FileName, "TestHost" + Path.DirectorySeparatorChar + "testhost.exe"); - Assert.IsFalse(info.Arguments!.Contains("TestHost" + Path.DirectorySeparatorChar + "testhost.exe")); + var testHostPath = Path.Combine("TestHostNetFramework", "testhost.exe"); + StringAssert.EndsWith(info.FileName, testHostPath); + Assert.IsFalse(info.Arguments!.Contains(testHostPath)); } [TestMethod] From 5d17117cee28852ab9507f77fa64211c89882859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 25 Jul 2022 16:45:13 +0200 Subject: [PATCH 26/34] Address review comments --- scripts/common.lib.ps1 | 6 ++---- src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs | 1 - .../Hosting/DotnetTestHostManager.cs | 4 +++- .../AcceptanceTestBase.cs | 2 ++ .../DataCollectionTests.cs | 2 +- .../TranslationLayerTests/CustomTestHostTests.cs | 8 ++++---- .../TranslationLayerTests/RunTests.cs | 8 ++++---- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/scripts/common.lib.ps1 b/scripts/common.lib.ps1 index 526939e0f7..f5a407eff7 100644 --- a/scripts/common.lib.ps1 +++ b/scripts/common.lib.ps1 @@ -105,13 +105,11 @@ function Install-DotNetCli $dotnetInstallPath = Join-Path $env:TP_TOOLS_DIR "dotnet" New-Item -ItemType directory -Path $dotnetInstallPath -Force | Out-Null - & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '2.1' -Architecture x64 -NoPath -Version '2.1.30' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '3.1' -Architecture x64 -NoPath -Version '3.1.24' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '5.0' -Architecture x64 -NoPath -Version '5.0.16' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '6.0' -Architecture x64 -NoPath -Version '6.0.4' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Channel '7.0' -Architecture x64 -NoPath -Version $env:DOTNET_CLI_VERSION - & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '2.1' -Architecture x86 -NoPath -Version '2.1.30' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '3.1' -Architecture x86 -NoPath -Version '3.1.24' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '5.0' -Architecture x86 -NoPath -Version '5.0.16' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '6.0' -Architecture x86 -NoPath -Version '6.0.4' @@ -390,7 +388,7 @@ function Start-InlineProcess { } Add-Type -TypeDefinition @" - public static class Hash { + public static class Hash { public static string GetHash(string value) { unchecked @@ -414,6 +412,6 @@ function Get-Hash { [string]$Value ) - # PowerShell does not have unchecked keyword, so we can't do unchecked math easily. + # PowerShell does not have unchecked keyword, so we can't do unchecked math easily. [Hash]::GetHash($Value) } diff --git a/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs b/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs index 6f2fd565df..b4cb4e641e 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs @@ -23,7 +23,6 @@ public class TraitCollection : IEnumerable // TODO: Fix this with proper resourcing for UWP and Win 8.1 Apps // Trying to access resources will throw "MissingManifestResourceException" percolated as "TypeInitialization" exception "Traits", - #else Resources.Resources.TestCasePropertyTraitsLabel, #endif diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs index d370d17d56..46ed419b0b 100644 --- a/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs @@ -259,7 +259,7 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( // Try find testhost.exe (or the architecture specific version). We ship those ngened executables for Windows // because they have faster startup time. We ship them only for some platforms. - // When user specified path to dotnet.exe don't try to find the exexutable, because we will always use the + // When user specified path to dotnet.exe don't try to find the executable, because we will always use the // testhost.dll together with their dotnet.exe. bool testHostExeFound = false; if (!useCustomDotnetHostpath @@ -449,6 +449,8 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( EqtTrace.Verbose("DotnetTestHostmanager: Full path of host exe is {0}", startInfo.FileName); + // Attempt to upgrade netcoreapp2.1 and earlier versions of testhost to netcoreapp3.1 or a newer runtime, + // assuming that the user does not have that old runtime installed. if (_targetFramework.Name.StartsWith(".NETCoreApp,", StringComparison.OrdinalIgnoreCase) && Version.TryParse(_targetFramework.Version, out var version) && version < new Version(3, 0)) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs b/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs index f7be49c4d5..172570ad76 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/AcceptanceTestBase.cs @@ -41,7 +41,9 @@ public class AcceptanceTestBase : IntegrationTestBase public const string NETFX462_NET50 = "net462;net472;net48;netcoreapp3.1;net5.0"; public const string NETFX462_NET31 = "net462;net472;net48;netcoreapp3.1"; public const string DEFAULT_RUNNER_NETFX = Net462TargetFramework; + public const string DEFAULT_HOST_NETFX = Net462TargetFramework; public const string DEFAULT_RUNNER_NETCORE = Core31TargetFramework; + public const string DEFAULT_HOST_NETCORE = Core31TargetFramework; /// /// Our current defaults for .NET and .NET Framework. /// diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/DataCollectionTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/DataCollectionTests.cs index c4ef948000..e6d0619a7c 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/DataCollectionTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/DataCollectionTests.cs @@ -85,7 +85,7 @@ public void DataCollectorAssemblyLoadingShouldNotThrowErrorForNetCore(RunnerInfo { SetTestEnvironment(_testEnvironment, runnerInfo); - var arguments = PrepareArguments(GetTestDllForFramework("AppDomainGetAssembliesTestProject.dll", DEFAULT_RUNNER_NETCORE), string.Empty, string.Empty, FrameworkArgValue, resultsDirectory: TempDirectory.Path); + var arguments = PrepareArguments(GetTestDllForFramework("AppDomainGetAssembliesTestProject.dll", DEFAULT_HOST_NETCORE), string.Empty, string.Empty, FrameworkArgValue, resultsDirectory: TempDirectory.Path); InvokeVsTest(arguments); ValidateSummaryStatus(1, 0, 0); diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CustomTestHostTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CustomTestHostTests.cs index a36bcced07..9996f086e0 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CustomTestHostTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/CustomTestHostTests.cs @@ -148,8 +148,8 @@ public void RunAllTestsWithMixedTFMsWillProvideAdditionalInformationToTheDebugge var vstestConsoleWrapper = GetVsTestConsoleWrapper(); var runEventHandler = new RunEventHandler(); - var netFrameworkDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_RUNNER_NETFX); - var netDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_RUNNER_NETCORE); + var netFrameworkDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_HOST_NETFX); + var netDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_HOST_NETCORE); var testHostLauncher = new TestHostLauncherV3(); // Act @@ -179,8 +179,8 @@ public void RunAllTestsCallsBackToTestHostLauncherV3EvenWhenRunnerDoesNotSupport var vstestConsoleWrapper = GetVsTestConsoleWrapper(); var runEventHandler = new RunEventHandler(); - var netFrameworkDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_RUNNER_NETFX); - var netDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_RUNNER_NETCORE); + var netFrameworkDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_HOST_NETFX); + var netDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_HOST_NETCORE); var testHostLauncher = new TestHostLauncherV3(); // Act diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTests.cs index f12979d2d4..46acdde880 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/RunTests.cs @@ -71,8 +71,8 @@ public void RunAllTestsWithMixedTFMsWillFailToRunTestsFromTheIncompatibleTFMDll( var vstestConsoleWrapper = GetVsTestConsoleWrapper(); var runEventHandler = new RunEventHandler(); - var compatibleDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_RUNNER_NETFX); - var incompatibleDll = GetTestDllForFramework("MSTestProject1.dll", "netcoreapp3.1"); + var compatibleDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_HOST_NETFX); + var incompatibleDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_HOST_NETCORE); // Act // We have no preference around what TFM is used. It will be autodetected. @@ -94,8 +94,8 @@ public void RunAllTestsWithMixedTFMsWillRunTestsFromAllProvidedDllEvenWhenTheyMi var vstestConsoleWrapper = GetVsTestConsoleWrapper(); var runEventHandler = new RunEventHandler(); - var netFrameworkDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_RUNNER_NETFX); - var netDll = GetTestDllForFramework("MSTestProject1.dll", "netcoreapp3.1"); + var netFrameworkDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_HOST_NETFX); + var netDll = GetTestDllForFramework("MSTestProject1.dll", DEFAULT_HOST_NETCORE); // Act // We have no preference around what TFM is used. It will be autodetected. From 4e02a3b3d81f9786f0727531addaefc6863e6214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 25 Jul 2022 18:53:07 +0200 Subject: [PATCH 27/34] Undo changes to installed net core frameworks --- scripts/common.lib.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/common.lib.ps1 b/scripts/common.lib.ps1 index f5a407eff7..526939e0f7 100644 --- a/scripts/common.lib.ps1 +++ b/scripts/common.lib.ps1 @@ -105,11 +105,13 @@ function Install-DotNetCli $dotnetInstallPath = Join-Path $env:TP_TOOLS_DIR "dotnet" New-Item -ItemType directory -Path $dotnetInstallPath -Force | Out-Null + & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '2.1' -Architecture x64 -NoPath -Version '2.1.30' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '3.1' -Architecture x64 -NoPath -Version '3.1.24' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '5.0' -Architecture x64 -NoPath -Version '5.0.16' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '6.0' -Architecture x64 -NoPath -Version '6.0.4' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Channel '7.0' -Architecture x64 -NoPath -Version $env:DOTNET_CLI_VERSION + & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '2.1' -Architecture x86 -NoPath -Version '2.1.30' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '3.1' -Architecture x86 -NoPath -Version '3.1.24' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '5.0' -Architecture x86 -NoPath -Version '5.0.16' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '6.0' -Architecture x86 -NoPath -Version '6.0.4' @@ -388,7 +390,7 @@ function Start-InlineProcess { } Add-Type -TypeDefinition @" - public static class Hash { + public static class Hash { public static string GetHash(string value) { unchecked @@ -412,6 +414,6 @@ function Get-Hash { [string]$Value ) - # PowerShell does not have unchecked keyword, so we can't do unchecked math easily. + # PowerShell does not have unchecked keyword, so we can't do unchecked math easily. [Hash]::GetHash($Value) } From a4b328ced9ad068a7b8cd21b53e1cc3be56f9518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Tue, 26 Jul 2022 09:40:27 +0200 Subject: [PATCH 28/34] Install .net core 3.1.25 instead of 3.1.24 --- scripts/common.lib.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/common.lib.ps1 b/scripts/common.lib.ps1 index 526939e0f7..2c390103eb 100644 --- a/scripts/common.lib.ps1 +++ b/scripts/common.lib.ps1 @@ -106,13 +106,13 @@ function Install-DotNetCli New-Item -ItemType directory -Path $dotnetInstallPath -Force | Out-Null & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '2.1' -Architecture x64 -NoPath -Version '2.1.30' - & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '3.1' -Architecture x64 -NoPath -Version '3.1.24' + & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '3.1' -Architecture x64 -NoPath -Version '3.1.25' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '5.0' -Architecture x64 -NoPath -Version '5.0.16' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '6.0' -Architecture x64 -NoPath -Version '6.0.4' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Channel '7.0' -Architecture x64 -NoPath -Version $env:DOTNET_CLI_VERSION & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '2.1' -Architecture x86 -NoPath -Version '2.1.30' - & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '3.1' -Architecture x86 -NoPath -Version '3.1.24' + & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '3.1' -Architecture x86 -NoPath -Version '3.1.25' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '5.0' -Architecture x86 -NoPath -Version '5.0.16' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '6.0' -Architecture x86 -NoPath -Version '6.0.4' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Channel '7.0' -Architecture x86 -NoPath -Version $env:DOTNET_CLI_VERSION From 4c3126667a5c66ac502b0b9b9d3e7a380901f107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Tue, 26 Jul 2022 10:16:26 +0200 Subject: [PATCH 29/34] Add back 3.1.24 and keep 3.1.25 --- scripts/common.lib.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/common.lib.ps1 b/scripts/common.lib.ps1 index 2c390103eb..b936f597fd 100644 --- a/scripts/common.lib.ps1 +++ b/scripts/common.lib.ps1 @@ -106,12 +106,14 @@ function Install-DotNetCli New-Item -ItemType directory -Path $dotnetInstallPath -Force | Out-Null & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '2.1' -Architecture x64 -NoPath -Version '2.1.30' + & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '3.1' -Architecture x64 -NoPath -Version '3.1.24' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '3.1' -Architecture x64 -NoPath -Version '3.1.25' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '5.0' -Architecture x64 -NoPath -Version '5.0.16' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '6.0' -Architecture x64 -NoPath -Version '6.0.4' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Channel '7.0' -Architecture x64 -NoPath -Version $env:DOTNET_CLI_VERSION & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '2.1' -Architecture x86 -NoPath -Version '2.1.30' + & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '3.1' -Architecture x86 -NoPath -Version '3.1.24' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '3.1' -Architecture x86 -NoPath -Version '3.1.25' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '5.0' -Architecture x86 -NoPath -Version '5.0.16' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '6.0' -Architecture x86 -NoPath -Version '6.0.4' From 0c9bdb32443537d44e3bbff0aef7befa3c6b6a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Tue, 26 Jul 2022 16:17:35 +0200 Subject: [PATCH 30/34] Install runtime 3.1.27 --- scripts/build.sh | 4 ++-- scripts/common.lib.ps1 | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 711a861889..635d7dfa48 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -215,9 +215,9 @@ function install_cli() return 1 fi chmod u+x $install_script - # Get netcoreapp1.1 shared components + # Runtime versions installed usually need to be kept in sync with the ones installed in common.lib.ps1 $install_script --runtime dotnet --install-dir "$TP_DOTNET_DIR" --no-path --architecture x64 --channel "2.1" --version "2.1.30" - $install_script --runtime dotnet --install-dir "$TP_DOTNET_DIR" --no-path --architecture x64 --channel "3.1" --version "3.1.24" + $install_script --runtime dotnet --install-dir "$TP_DOTNET_DIR" --no-path --architecture x64 --channel "3.1" --version "3.1.27" $install_script --runtime dotnet --install-dir "$TP_DOTNET_DIR" --no-path --architecture x64 --channel "5.0" --version "5.0.16" $install_script --runtime dotnet --install-dir "$TP_DOTNET_DIR" --no-path --architecture x64 --channel "6.0" --version "6.0.4" diff --git a/scripts/common.lib.ps1 b/scripts/common.lib.ps1 index b936f597fd..7c94afc973 100644 --- a/scripts/common.lib.ps1 +++ b/scripts/common.lib.ps1 @@ -105,16 +105,15 @@ function Install-DotNetCli $dotnetInstallPath = Join-Path $env:TP_TOOLS_DIR "dotnet" New-Item -ItemType directory -Path $dotnetInstallPath -Force | Out-Null + # Runtime versions installed usually need to be kept in sync with the ones installed in build.sh & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '2.1' -Architecture x64 -NoPath -Version '2.1.30' - & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '3.1' -Architecture x64 -NoPath -Version '3.1.24' - & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '3.1' -Architecture x64 -NoPath -Version '3.1.25' + & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '3.1' -Architecture x64 -NoPath -Version '3.1.27' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '5.0' -Architecture x64 -NoPath -Version '5.0.16' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Channel '6.0' -Architecture x64 -NoPath -Version '6.0.4' & $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Channel '7.0' -Architecture x64 -NoPath -Version $env:DOTNET_CLI_VERSION & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '2.1' -Architecture x86 -NoPath -Version '2.1.30' - & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '3.1' -Architecture x86 -NoPath -Version '3.1.24' - & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '3.1' -Architecture x86 -NoPath -Version '3.1.25' + & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '3.1' -Architecture x86 -NoPath -Version '3.1.27' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '5.0' -Architecture x86 -NoPath -Version '5.0.16' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Channel '6.0' -Architecture x86 -NoPath -Version '6.0.4' & $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Channel '7.0' -Architecture x86 -NoPath -Version $env:DOTNET_CLI_VERSION @@ -392,7 +391,7 @@ function Start-InlineProcess { } Add-Type -TypeDefinition @" - public static class Hash { + public static class Hash { public static string GetHash(string value) { unchecked @@ -416,6 +415,6 @@ function Get-Hash { [string]$Value ) - # PowerShell does not have unchecked keyword, so we can't do unchecked math easily. + # PowerShell does not have unchecked keyword, so we can't do unchecked math easily. [Hash]::GetHash($Value) } From 11371e2739fa275e990531a94f57dadeb809c096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 27 Jul 2022 09:17:21 +0200 Subject: [PATCH 31/34] 605 files? --- scripts/verify-nupkgs.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/verify-nupkgs.ps1 b/scripts/verify-nupkgs.ps1 index 31f9b0b675..49b38b6463 100644 --- a/scripts/verify-nupkgs.ps1 +++ b/scripts/verify-nupkgs.ps1 @@ -14,7 +14,7 @@ function Verify-Nuget-Packages($packageDirectory, $version) $expectedNumOfFiles = @{ "Microsoft.CodeCoverage" = 57; "Microsoft.NET.Test.Sdk" = 18; - "Microsoft.TestPlatform" = 599; + "Microsoft.TestPlatform" = 605; "Microsoft.TestPlatform.Build" = 21; "Microsoft.TestPlatform.CLI" = 499; "Microsoft.TestPlatform.Extensions.TrxLogger" = 35; From aff5545622bc681fe9019427504b68358dddfab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 27 Jul 2022 10:09:08 +0200 Subject: [PATCH 32/34] Add logging for arguments, revert later --- test/Microsoft.TestPlatform.AcceptanceTests/FrameworkTests.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/FrameworkTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/FrameworkTests.cs index ae90d73121..4ab468ca93 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/FrameworkTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/FrameworkTests.cs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; + using Microsoft.TestPlatform.TestUtilities; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -79,8 +81,10 @@ public void RunSpecificTestsShouldWorkWithFrameworkInCompatibleWarning(RunnerInf SetTestEnvironment(_testEnvironment, runnerInfo); var arguments = PrepareArguments(GetSampleTestAssembly(), string.Empty, string.Empty, string.Empty, resultsDirectory: TempDirectory.Path); + Console.WriteLine($">>>>>>> arguments: {arguments}"); arguments = string.Concat(arguments, " ", "/tests:PassingTest"); arguments = string.Concat(arguments, " ", "/Framework:Framework40"); + Console.WriteLine($">>>>>>> arguments concat: {arguments}"); InvokeVsTest(arguments); From 1ed6dad8ddedde9a2a742bac43d13f5c10d34ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Wed, 27 Jul 2022 11:25:39 +0200 Subject: [PATCH 33/34] Test can run on Linux --- .../Microsoft.TestPlatform.AcceptanceTests/FrameworkTests.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/FrameworkTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/FrameworkTests.cs index 4ab468ca93..1305b024f6 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/FrameworkTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/FrameworkTests.cs @@ -81,14 +81,13 @@ public void RunSpecificTestsShouldWorkWithFrameworkInCompatibleWarning(RunnerInf SetTestEnvironment(_testEnvironment, runnerInfo); var arguments = PrepareArguments(GetSampleTestAssembly(), string.Empty, string.Empty, string.Empty, resultsDirectory: TempDirectory.Path); - Console.WriteLine($">>>>>>> arguments: {arguments}"); arguments = string.Concat(arguments, " ", "/tests:PassingTest"); arguments = string.Concat(arguments, " ", "/Framework:Framework40"); - Console.WriteLine($">>>>>>> arguments concat: {arguments}"); InvokeVsTest(arguments); - if (runnerInfo.TargetFramework.Contains("netcore")) + var isWindows = Environment.OSVersion.Platform.ToString().StartsWith("Win"); + if (runnerInfo.TargetFramework.Contains("netcore") && isWindows) { StdOutputContains("No test is available"); } From 303f7e4c094a86feff3e2f86df8391bd47f364ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Wed, 27 Jul 2022 11:38:56 +0200 Subject: [PATCH 34/34] Explain RunSpecificTestsShouldWorkWithFrameworkInCompatibleWarning test --- .../FrameworkTests.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/FrameworkTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/FrameworkTests.cs index 1305b024f6..1cde245255 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/FrameworkTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/FrameworkTests.cs @@ -86,6 +86,15 @@ public void RunSpecificTestsShouldWorkWithFrameworkInCompatibleWarning(RunnerInf InvokeVsTest(arguments); + // When this test runs it provides an incorrect desired framework for the run. E.g. the dll is actually netcoreapp3.1 + // but we request to run as .NET Framework 4.0. On windows this has predictable results, for netcoreapp3.1 dll we fail + // to load it into .NET Framework testhost.exe, and fail with "No test is available". For .NET Framework dll, we + // just log a warning saying that we provided .NET Framework 472 dlls (or whatever the current tfm for test dlls is), + // but the settings requested .NET Framework 4.0. The test will still run because .NET Framework is compatible, and in reality + // the system has .NET Framework 472 or newer installed, which runs even if we ask for .NET Framework 4.0 testhost. + // + // On Linux and Mac we execute only netcoreapp3.1 tests, and even though we force .NET Framework, we end up running on mono + // which is suprisingly able to run the .NET CoreApp 3.1 dll, so we still just see a warning and 1 completed test. var isWindows = Environment.OSVersion.Platform.ToString().StartsWith("Win"); if (runnerInfo.TargetFramework.Contains("netcore") && isWindows) {