Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 3 additions & 23 deletions src/vstest.console/TestPlatformHelpers/TestRequestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ internal class TestRequestManager : ITestRequestManager
{
private static ITestRequestManager? s_testRequestManagerInstance;

// Defines the default architecture to be used for AnyCPU or non-dll sources. This is just temporary, and unsupported, DO NOT use.
private static readonly string VSTEST_DEFAULT_ARCHITECTURE_FOR_ANYCPU = nameof(VSTEST_DEFAULT_ARCHITECTURE_FOR_ANYCPU);

private readonly ITestPlatform _testPlatform;
private readonly ITestPlatformEventSource _testPlatformEventSource;
// TODO: No idea what is Task supposed to buy us, Tasks start immediately on instantiation
Expand Down Expand Up @@ -723,7 +720,7 @@ private bool UpdateRunSettingsIfRequired(
// it can be specified by user on the command line with --arch or through runsettings.
// If it's not specified by user will be filled by current processor architecture;
// should be the same as SDK.
defaultArchitecture = GetDefaultArchitecture(runConfiguration, runsettingsXml);
defaultArchitecture = GetDefaultArchitecture(runConfiguration);
}
else
{
Expand All @@ -734,7 +731,7 @@ private bool UpdateRunSettingsIfRequired(
// As default architecture we specify the expected test host architecture,
// it can be specified by user on the command line with /Platform or through runsettings.
// If it's not specified by user will be filled by current processor architecture.
defaultArchitecture = GetDefaultArchitecture(runConfiguration, runsettingsXml);
defaultArchitecture = GetDefaultArchitecture(runConfiguration);
}

// Other scenarios, most notably .NET Framework with MultiTFM disabled, will use the old default X86 architecture.
Expand Down Expand Up @@ -809,7 +806,7 @@ private bool UpdateRunSettingsIfRequired(

return settingsUpdated;

Architecture GetDefaultArchitecture(RunConfiguration runConfiguration, string runsettingsXml)
Architecture GetDefaultArchitecture(RunConfiguration runConfiguration)
{
if (!RunSettingsHelper.Instance.IsDefaultTargetArchitecture)
{
Expand All @@ -822,23 +819,6 @@ Architecture GetDefaultArchitecture(RunConfiguration runConfiguration, string ru
return defaultArchitectureFromRunsettings.Value;
}

// Returns null, where there are none.
Dictionary<string, string?>? environmentVariables = InferRunSettingsHelper.GetEnvironmentVariables(runsettingsXml);
if (environmentVariables != null)
{
string? defaultArchitectureFromRunsettingsEnvironmentVariables = environmentVariables.TryGetValue(VSTEST_DEFAULT_ARCHITECTURE_FOR_ANYCPU, out var architecture) ? architecture : null;

if (defaultArchitectureFromRunsettingsEnvironmentVariables != null)
{
Architecture? defaultArchitecture = Enum.TryParse<Architecture>(defaultArchitectureFromRunsettingsEnvironmentVariables, out var arch) ? arch : null;

if (defaultArchitecture != null)
{
return defaultArchitecture.Value;
}
}
}

return TranslateToArchitecture(_processHelper.GetCurrentProcessArchitecture());
}

Expand Down