From c4c4491da41cd51039eb64139ec5f26a5a202845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jare=C5=A1?= Date: Fri, 24 Jul 2020 14:24:15 +0100 Subject: [PATCH] Revert detecting default architecture, to allow dotnet to default to 64-bit (#2492) --- .../TestPlatformHelpers/TestRequestManager.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index e340f1d77e..5cfe3f809d 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -173,7 +173,7 @@ public void DiscoverTests(DiscoveryRequestPayload discoveryPayload, ITestDiscove // Collect Commands this.LogCommandsTelemetryPoints(requestData); } - + // create discovery request var criteria = new DiscoveryCriteria(discoveryPayload.Sources, batchSize, this.commandLineOptions.TestStatsEventTimeout, runsettings) { @@ -332,7 +332,7 @@ public void ProcessTestRunAttachments(TestRunAttachmentsProcessingPayload attach this.currentAttachmentsProcessingCancellationTokenSource = new CancellationTokenSource(); Task task = this.attachmentsProcessingManager.ProcessTestRunAttachmentsAsync(requestData, attachmentsProcessingPayload.Attachments, attachmentsProcessingEventsHandler, this.currentAttachmentsProcessingCancellationTokenSource.Token); - task.Wait(); + task.Wait(); } finally { @@ -357,7 +357,7 @@ private void LogTelemetryForLegacySettings(IRequestData requestData, string runs if (InferRunSettingsHelper.TryGetLegacySettingElements(runsettings, out Dictionary legacySettingsTelemetry)) { - foreach( var ciData in legacySettingsTelemetry) + foreach (var ciData in legacySettingsTelemetry) { // We are collecting telemetry for the legacy nodes and attributes used in the runsettings. requestData.MetricsCollection.Add(string.Format("{0}.{1}", TelemetryDataConstants.LegacySettingPrefix, ciData.Key), ciData.Value); @@ -444,8 +444,15 @@ private bool UpdateRunSettingsIfRequired(string runsettingsXml, List sou settingsUpdated |= this.UpdateFramework(document, navigator, sources, sourceFrameworks, registrar, out Framework chosenFramework); - // Set default architecture as X86 + // Choose default architecture based on the framework + // For .NET core, the default platform architecture should be based on the process. Architecture defaultArchitecture = Architecture.X86; + if (chosenFramework.Name.IndexOf("netstandard", StringComparison.OrdinalIgnoreCase) >= 0 + || chosenFramework.Name.IndexOf("netcoreapp", StringComparison.OrdinalIgnoreCase) >= 0 + || chosenFramework.Name.IndexOf("net5", StringComparison.OrdinalIgnoreCase) >= 0) + { + defaultArchitecture = Environment.Is64BitProcess ? Architecture.X64 : Architecture.X86; + } settingsUpdated |= this.UpdatePlatform(document, navigator, sources, sourcePlatforms, defaultArchitecture, out Architecture chosenPlatform); this.CheckSourcesForCompatibility(chosenFramework, chosenPlatform, defaultArchitecture, sourcePlatforms, sourceFrameworks, registrar); @@ -455,7 +462,7 @@ private bool UpdateRunSettingsIfRequired(string runsettingsXml, List sou settingsUpdated |= this.AddOrUpdateConsoleLogger(document, runConfiguration, loggerRunSettings); updatedRunSettingsXml = navigator.OuterXml; - } + } } return settingsUpdated;