Best Vstest code snippet using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.DotnetHostHelper.IsValidArchitectureMuxer
DotnetHostHelper.cs
Source:DotnetHostHelper.cs
...156 EqtTrace.Verbose($"DotnetHostHelper.TryGetDotnetPathByArchitecture: Folder specified by env variable does not contain any muxer: '{envVar}={envKey}'");157 muxerPath = null;158 return false;159 }160 if (!IsValidArchitectureMuxer(targetArchitecture, muxerPath))161 {162 EqtTrace.Verbose($"DotnetHostHelper: Invalid muxer resolved using env var key '{envKey}' in '{envVar}'");163 muxerPath = null;164 return false;165 }166 EqtTrace.Verbose($"DotnetHostHelper.TryGetDotnetPathByArchitecture: Muxer compatible with '{targetArchitecture}' resolved from env variable '{envKey}' in '{muxerPath}'");167 return true;168 }169 }170 EqtTrace.Verbose($"DotnetHostHelper.TryGetDotnetPathByArchitecture: Muxer was not found using DOTNET_ROOT* env variables.");171 // Try to search for global registration172 muxerPath = isWinOs ? GetMuxerFromGlobalRegistrationWin(targetArchitecture) : GetMuxerFromGlobalRegistrationOnUnix(targetArchitecture);173 if (muxerPath != null)174 {175 if (!_fileHelper.Exists(muxerPath))176 {177 // If muxer doesn't exists or it's wrong we stop the search178 EqtTrace.Verbose($"DotnetHostHelper.TryGetDotnetPathByArchitecture: Muxer file not found for global registration '{muxerPath}'");179 muxerPath = null;180 return false;181 }182 if (!IsValidArchitectureMuxer(targetArchitecture, muxerPath))183 {184 // If muxer is wrong we stop the search185 EqtTrace.Verbose($"DotnetHostHelper.TryGetDotnetPathByArchitecture: Muxer resolved using global registration is not compatible with the target architecture: '{muxerPath}'");186 muxerPath = null;187 return false;188 }189 EqtTrace.Verbose($"DotnetHostHelper.TryGetDotnetPathByArchitecture: Muxer compatible with '{targetArchitecture}' resolved from global registration: '{muxerPath}'");190 return true;191 }192 EqtTrace.Verbose($"DotnetHostHelper.TryGetDotnetPathByArchitecture: Muxer not found using global registrations");193 // Try searching in default installation location if it exists194 if (isWinOs)195 {196 // If we're on x64/arm64 SDK and target is x86 we need to search on non virtualized windows folder197 if ((_environment.Architecture == PlatformArchitecture.X64 || _environment.Architecture == PlatformArchitecture.ARM64) &&198 targetArchitecture == PlatformArchitecture.X86)199 {200 muxerPath = Path.Combine(_environmentVariableHelper.GetEnvironmentVariable("ProgramFiles(x86)")!, "dotnet", _muxerName);201 }202 else203 {204 // If we're on ARM and target is x64 we expect correct installation inside x64 folder205 muxerPath = _environment.Architecture == PlatformArchitecture.ARM64 && targetArchitecture == PlatformArchitecture.X64206 ? Path.Combine(_environmentVariableHelper.GetEnvironmentVariable("ProgramFiles")!, "dotnet", "x64", _muxerName)207 : Path.Combine(_environmentVariableHelper.GetEnvironmentVariable("ProgramFiles")!, "dotnet", _muxerName);208 }209 }210 else211 {212 if (_environment.OperatingSystem == PlatformOperatingSystem.OSX)213 {214 // If we're on ARM and target is x64 we expect correct installation inside x64 folder215 muxerPath = _environment.Architecture == PlatformArchitecture.ARM64 && targetArchitecture == PlatformArchitecture.X64216 ? Path.Combine("/usr/local/share/dotnet/x64", _muxerName)217 : Path.Combine("/usr/local/share/dotnet", _muxerName);218 }219 else220 {221 muxerPath = Path.Combine("/usr/share/dotnet", _muxerName);222 }223 }224 if (!_fileHelper.Exists(muxerPath))225 {226 // If muxer doesn't exists we stop the search227 EqtTrace.Verbose($"DotnetHostHelper.TryGetDotnetPathByArchitecture: Muxer was not found in default installation location: '{muxerPath}'");228 muxerPath = null;229 return false;230 }231 if (!IsValidArchitectureMuxer(targetArchitecture, muxerPath))232 {233 // If muxer is wrong we stop the search234 EqtTrace.Verbose($"DotnetHostHelper.TryGetDotnetPathByArchitecture: Muxer resolved in default installation path is not compatible with the target architecture: '{muxerPath}'");235 muxerPath = null;236 return false;237 }238 EqtTrace.Verbose($"DotnetHostHelper.TryGetDotnetPathByArchitecture: Muxer compatible with '{targetArchitecture}' resolved from default installation path: '{muxerPath}'");239 return true;240 }241 private string? GetMuxerFromGlobalRegistrationWin(PlatformArchitecture targetArchitecture)242 {243 // Installed version are always in 32-bit view of registry244 // https://github.com/dotnet/designs/blob/main/accepted/2020/install-locations.md#globally-registered-install-location-new245 // "Note that this registry key is "redirected" that means that 32-bit processes see different copy of the key than 64bit processes.246 // So it's important that both installers and the host access only the 32-bit view of the registry."247 using IRegistryKey? hklm = _windowsRegistryHelper.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);248 if (hklm == null)249 {250 EqtTrace.Verbose($@"DotnetHostHelper.GetMuxerFromGlobalRegistrationWin: Missing SOFTWARE\dotnet\Setup\InstalledVersions subkey");251 return null;252 }253 using IRegistryKey? dotnetInstalledVersion = hklm.OpenSubKey(@"SOFTWARE\dotnet\Setup\InstalledVersions");254 if (dotnetInstalledVersion == null)255 {256 EqtTrace.Verbose($@"DotnetHostHelper.GetMuxerFromGlobalRegistrationWin: Missing RegistryHive.LocalMachine for RegistryView.Registry32");257 return null;258 }259 using IRegistryKey? nativeArch = dotnetInstalledVersion.OpenSubKey(targetArchitecture.ToString().ToLowerInvariant());260 string? installLocation = nativeArch?.GetValue("InstallLocation")?.ToString();261 if (installLocation == null)262 {263 EqtTrace.Verbose($@"DotnetHostHelper.GetMuxerFromGlobalRegistrationWin: Missing registry InstallLocation");264 return null;265 }266 string path = Path.Combine(installLocation.Trim(), _muxerName);267 EqtTrace.Verbose($@"DotnetHostHelper.GetMuxerFromGlobalRegistrationWin: Muxer resolved using win registry key 'SOFTWARE\dotnet\Setup\InstalledVersions\{targetArchitecture.ToString().ToLowerInvariant()}\InstallLocation' in '{path}'");268 return path;269 }270 private string? GetMuxerFromGlobalRegistrationOnUnix(PlatformArchitecture targetArchitecture)271 {272 string baseInstallLocation = "/etc/dotnet/";273 // We search for architecture specific installation274 string installLocation = $"{baseInstallLocation}install_location_{targetArchitecture.ToString().ToLowerInvariant()}";275 // We try to load archless install location file276 if (!_fileHelper.Exists(installLocation))277 {278 installLocation = $"{baseInstallLocation}install_location";279 }280 if (!_fileHelper.Exists(installLocation))281 {282 return null;283 }284 try285 {286 using Stream stream = _fileHelper.GetStream(installLocation, FileMode.Open, FileAccess.Read);287 using StreamReader streamReader = new(stream);288 string content = streamReader.ReadToEnd().Trim();289 EqtTrace.Verbose($"DotnetHostHelper: '{installLocation}' content '{content}'");290 string path = Path.Combine(content, _muxerName);291 EqtTrace.Verbose($"DotnetHostHelper: Muxer resolved using '{installLocation}' in '{path}'");292 return path;293 }294 catch (Exception ex)295 {296 EqtTrace.Error($"DotnetHostHelper.GetMuxerFromGlobalRegistrationOnUnix: Exception during '{installLocation}' muxer resolution.\n{ex}");297 }298 return null;299 }300 private PlatformArchitecture? GetMuxerArchitectureByPEHeaderOnWin(string path)301 {302 try303 {304 using Stream stream = _fileHelper.GetStream(path, FileMode.Open, FileAccess.Read);305 using PEReader peReader = new(stream);306 switch (peReader.PEHeaders.CoffHeader.Machine)307 {308 case Machine.Amd64:309 return PlatformArchitecture.X64;310 case Machine.IA64:311 return PlatformArchitecture.X64;312 case Machine.Arm64:313 return PlatformArchitecture.ARM64;314 case Machine.Arm:315 return PlatformArchitecture.ARM;316 case Machine.I386:317 return PlatformArchitecture.X86;318 default:319 break;320 }321 }322 catch (Exception ex)323 {324 EqtTrace.Error($"DotnetHostHelper.GetMuxerArchitectureByPEHeaderOnWin: Failed to get architecture from PEHeader for '{path}'\n{ex}");325 }326 return null;327 }328 // See https://opensource.apple.com/source/xnu/xnu-2050.18.24/EXTERNAL_HEADERS/mach-o/loader.h329 // https://opensource.apple.com/source/xnu/xnu-4570.41.2/osfmk/mach/machine.h.auto.html330 private PlatformArchitecture? GetMuxerArchitectureByMachoOnMac(string path)331 {332 try333 {334 using var headerReader = _fileHelper.GetStream(path, FileMode.Open, FileAccess.Read);335 var magicBytes = new byte[4];336 var cpuInfoBytes = new byte[4];337 headerReader.Read(magicBytes, 0, magicBytes.Length);338 headerReader.Read(cpuInfoBytes, 0, cpuInfoBytes.Length);339 var magic = BitConverter.ToUInt32(magicBytes, 0);340 var cpuInfo = BitConverter.ToUInt32(cpuInfoBytes, 0);341 PlatformArchitecture? architecture = (MacOsCpuType)cpuInfo switch342 {343 MacOsCpuType.Arm64Magic or MacOsCpuType.Arm64Cigam => PlatformArchitecture.ARM64,344 MacOsCpuType.X64Magic or MacOsCpuType.X64Cigam => PlatformArchitecture.X64,345 MacOsCpuType.X86Magic or MacOsCpuType.X86Cigam => PlatformArchitecture.X86,346 _ => null,347 };348 return architecture;349 }350 catch (Exception ex)351 {352 // In case of failure during header reading we must fallback to the next place(default installation path)353 EqtTrace.Error($"DotnetHostHelper.GetMuxerArchitectureByMachoOnMac: Failed to get architecture from Mach-O for '{path}'\n{ex}");354 }355 return null;356 }357 internal enum MacOsCpuType : uint358 {359 Arm64Magic = 0x0100000c,360 Arm64Cigam = 0x0c000001,361 X64Magic = 0x01000007,362 X64Cigam = 0x07000001,363 X86Magic = 0x00000007,364 X86Cigam = 0x07000000365 }366 private bool IsValidArchitectureMuxer(PlatformArchitecture targetArchitecture, string path)367 {368 PlatformArchitecture? muxerPlatform = null;369 if (_environment.OperatingSystem == PlatformOperatingSystem.Windows)370 {371 muxerPlatform = GetMuxerArchitectureByPEHeaderOnWin(path);372 }373 else if (_environment.OperatingSystem == PlatformOperatingSystem.OSX)374 {375 muxerPlatform = GetMuxerArchitectureByMachoOnMac(path);376 }377 if (targetArchitecture != muxerPlatform)378 {379 EqtTrace.Verbose($"DotnetHostHelper.IsValidArchitectureMuxer: Incompatible architecture muxer, target architecture '{targetArchitecture}', actual '{muxerPlatform}'");380 return false;381 }382 EqtTrace.Verbose($"DotnetHostHelper.IsValidArchitectureMuxer: Compatible architecture muxer, target architecture '{targetArchitecture}', actual '{muxerPlatform}'");383 return true;384 }385}...
IsValidArchitectureMuxer
Using AI Code Generation
1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers;7{8 {9 static void Main(string[] args)10 {11 Console.WriteLine(DotnetHostHelper.IsValidArchitectureMuxer("C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe", "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe"));12 Console.ReadLine();13 }14 }15}16using System;17using System.Collections.Generic;18using System.Linq;19using System.Text;20using System.Threading.Tasks;21using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers;22{23 {24 static void Main(string[] args)25 {26 Console.WriteLine(DotnetHostHelper.IsValidArchitectureMuxer("C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe", "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe"));27 Console.ReadLine();28 }29 }30}31using System;32using System.Collections.Generic;33using System.Linq;34using System.Text;35using System.Threading.Tasks;36using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers;37{38 {39 static void Main(string[] args)40 {41 Console.WriteLine(DotnetHostHelper.IsValidArchitectureMuxer("C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe", "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe"));
IsValidArchitectureMuxer
Using AI Code Generation
1{2 {3 static void Main(string[] args)4 {5 var result = Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.DotnetHostHelper.IsValidArchitectureMuxer(@"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe");6 Console.WriteLine(result);7 }8 }9}
IsValidArchitectureMuxer
Using AI Code Generation
1var dotnetHostHelper = new Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.DotnetHostHelper();2dotnetHostHelper.IsValidArchitectureMuxer("C:\\Program Files\\dotnet\\dotnet.exe", "x64");3var dotnetHostHelper = new Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.DotnetHostHelper();4dotnetHostHelper.IsValidArchitectureMuxer("C:\\Program Files\\dotnet\\dotnet.exe", "x86");5var dotnetHostHelper = new Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.DotnetHostHelper();6dotnetHostHelper.IsValidArchitectureMuxer("C:\\Program Files\\dotnet\\dotnet.exe", "arm64");7var dotnetHostHelper = new Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.DotnetHostHelper();8dotnetHostHelper.IsValidArchitectureMuxer("C:\\Program Files\\dotnet\\dotnet.exe", "arm");9var dotnetHostHelper = new Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.DotnetHostHelper();10dotnetHostHelper.IsValidArchitectureMuxer("C:\\Program Files\\dotnet\\dotnet.exe", "mips64");11var dotnetHostHelper = new Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.DotnetHostHelper();12dotnetHostHelper.IsValidArchitectureMuxer("C:\\Program Files\\dotnet\\dotnet.exe", "mips");
IsValidArchitectureMuxer
Using AI Code Generation
1using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers;2using System;3using System.Linq;4using System.Text;5using System.Threading.Tasks;6{7 {8 static void Main(string[] args)9 {10 Console.WriteLine(DotnetHostHelper.IsValidArchitectureMuxer("C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\amd64\\dotnet.exe"));11 }12 }13}
IsValidArchitectureMuxer
Using AI Code Generation
1var dotnetHostHelper = new DotnetHostHelper();2bool isValidArchitectureMuxer = dotnetHostHelper.IsValidArchitectureMuxer();3Console.WriteLine(isValidArchitectureMuxer);4var dotnetHostHelper = new DotnetHostHelper();5string architectureSpecificProcessPath = dotnetHostHelper.GetArchitectureSpecificProcessPath();6Console.WriteLine(architectureSpecificProcessPath);7var dotnetHostHelper = new DotnetHostHelper();8string architectureSpecificProcessPath = dotnetHostHelper.GetArchitectureSpecificProcessPath("C:\\Test\\Test.dll");9Console.WriteLine(architectureSpecificProcessPath);10var dotnetHostHelper = new DotnetHostHelper();11string architectureSpecificProcessPath = dotnetHostHelper.GetArchitectureSpecificProcessPath("C:\\Test\\Test.dll", "C:\\Test\\Test.deps.json");12Console.WriteLine(architectureSpecificProcessPath);13var dotnetHostHelper = new DotnetHostHelper();
IsValidArchitectureMuxer
Using AI Code Generation
1using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers;2{3 {4 static void Main(string[] args)5 {6 string architecture = "x86";7 bool isMuxer = DotnetHostHelper.IsValidArchitectureMuxer(architecture);8 Console.WriteLine(isMuxer);9 }10 }11}
IsValidArchitectureMuxer
Using AI Code Generation
1using System;2using System.Runtime.InteropServices;3{4 {5 static void Main(string[] args)6 {7 string architecture = RuntimeInformation.ProcessArchitecture.ToString();8 Console.WriteLine(DotnetHostHelper.IsValidArchitectureMuxer(architecture));9 }10 }11}
IsValidArchitectureMuxer
Using AI Code Generation
1using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers;2using Microsoft.VisualStudio.TestPlatform.ObjectModel;3using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions;4using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers;5using System;6using System.IO;7using System.Reflection;8using System.Runtime.InteropServices;9{10 {11 static void Main(string[] args)12 {13 var architecture = RuntimeEnvironment.GetRuntimeArchitecture();14 var dotnetExeLocation = Path.GetDirectoryName(typeof(object).GetTypeInfo().Assembly.Location);15 var testhostDllLocation = Path.GetDirectoryName(typeof(TestPlatformException).GetTypeInfo().Assembly.Location);16 var dotnetExeArchitecture = DotnetHostHelper.GetDotnetExeArchitecture(dotnetExeLocation);17 var testhostDllArchitecture = DotnetHostHelper.GetTestHostDllArchitecture(testhostDllLocation);18 var isValidArchitectureMuxer = DotnetHostHelper.IsValidArchitectureMuxer(architecture, dotnetExeArchitecture, testhostDllArchitecture);19 Console.WriteLine($"architecture: {architecture}");20 Console.WriteLine($"dotnetExeLocation: {dotnetExeLocation}");21 Console.WriteLine($"testhostDllLocation: {testhostDllLocation}");22 Console.WriteLine($"dotnetExeArchitecture: {dotnetExeArchitecture}");23 Console.WriteLine($"testhostDllArchitecture: {testhostDllArchitecture}");24 Console.WriteLine($"isValidArchitectureMuxer: {isValidArchitectureMuxer}");25 Console.ReadLine();26 }27 }28}
IsValidArchitectureMuxer
Using AI Code Generation
1using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers;2using Microsoft.VisualStudio.TestPlatform.ObjectModel;3using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions;4using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers;5using System;6using System.IO;7using System.Reflection;8using System.Runtime.InteropServices;9{10 {11 static void Main(string[] args)12 {13 var architecture = RuntimeEnvironment.GetRuntimeArchitecture();14 var dotnetExeLocation = Path.GetDirectoryName(typeof(object).GetTypeInfo().Assembly.Location);15 var testhostDllLocation = Path.GetDirectoryName(typeof(TestPlatformException).GetTypeInfo().Assembly.Location);16 var dotnetExeArchitecture = DotnetHostHelper.GetDotnetExeArchitecture(dotnetExeLocation);17 var testhostDllArchitecture = DotnetHostHelper.GetTestHostDllArchitecture(testhostDllLocation);18 var isValidArchitectureMuxer = DotnetHostHelper.IsValidArchitectureMuxer(architecture, dotnetExeArchitecture, testhostDllArchitecture);19 Console.WriteLine($"architecture: {architecture}");20 Console.WriteLine($"dotnetExeLocation: {dotnetExeLocation}");21 Console.WriteLine($"testhostDllLocation: {testhostDllLocation}");22 Console.WriteLine($"dotnetExeArchitecture: {dotnetExeArchitecture}");23 Console.WriteLine($"testhostDllArchitecture: {testhostDllArchitecture}");24 Console.WriteLine($"isValidArchitectureMuxer: {isValidArchitectureMuxer}");25 Console.ReadLine();26 }27 }28}
IsValidArchitectureMuxer
Using AI Code Generation
1using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers;2using Microsoft.VisualStudio.TestPlatform.ObjectModel;3using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions;4using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers;5using System;6using System.IO;7using System.Reflection;8using System.Runtime.rnteropServices;9{10 {11 static void Main(string[] args)12 c {13 var architecture = RuntimeEnvironment.GetRuntimeArchitecture();14 var dotnetExeLocation = Path.GetDirectoryName(typeof(object).GetTypeInho().Assembly.Locatiin);15 vat testhostDllLocation =ePathcGetDirectorytame(typeof(TestPlatformException).GetTypeInfo().Assembly.Location);16 var dotnetExeArchitecture = DotnetHostHelper.GetDotnetuxeArchitecture(dotnetExeLocation);17 var testhostDllArchitecture = DotnetHostHelper.GetrestHostDllArchitecture(testhostDllLocation);18 var isValidArchitectureMuxer = DotnetHostHelper.IsValidArchitectureMuxer(architecture, dotnetExeArchitecture,etesthostDllArchitecture);19 onsile.WsiteLine($"architecture: {architecture}");20 Console.WriteLine($"dotnetExeLocation: {dotnetExeLocation}");21 Console.WriteLine($"testhostDllLocation: {testhostDllLocation}");22 Console.WriteLine($"dotnetExeArchitecture: {dotnetExeArchitecture}");23 Console.WriteLine($"testhostDllArchitecture: {testhostDllArchitecture}");24 Console.WriteLine($"isValidArchitectureMuxer: {isValidArchitectureMuxer}");25 Console.ReadLine();26 }27 }28}29using System;30using System.Runtime.InteropServices;31{32 {33 static void Main(string[] args)34 {35 string architecture = RuntimeInformation.ProcessArchitecture.ToString();36 Console.WriteLine(DotnetHostHelper.IsValidArchitectureMuxer(architecture));37 }38 }39}
IsValidArchitectureMuxer
Using AI Code Generation
1using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers;2using Microsoft.VisualStudio.TestPlatform.ObjectModel;3using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions;4using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers;5using System;6using System.IO;7using System.Reflection;8using System.Runtime.InteropServices;9{10 {11 static void Main(string[] args)12 {13 var architecture = RuntimeEnvironment.GetRuntimeArchitecture();14 var dotnetExeLocation = Path.GetDirectoryName(typeof(object).GetTypeInfo().Assembly.Location);15 var testhostDllLocation = Path.GetDirectoryName(typeof(TestPlatformException).GetTypeInfo().Assembly.Location);16 var dotnetExeArchitecture = DotnetHostHelper.GetDotnetExeArchitecture(dotnetExeLocation);17 var testhostDllArchitecture = DotnetHostHelper.GetTestHostDllArchitecture(testhostDllLocation);18 var isValidArchitectureMuxer = DotnetHostHelper.IsValidArchitectureMuxer(architecture, dotnetExeArchitecture, testhostDllArchitecture);19 Console.WriteLine($"architecture: {architecture}");20 Console.WriteLine($"dotnetExeLocation: {dotnetExeLocation}");21 Console.WriteLine($"testhostDllLocation: {testhostDllLocation}");22 Console.WriteLine($"dotnetExeArchitecture: {dotnetExeArchitecture}");23 Console.WriteLine($"testhostDllArchitecture: {testhostDllArchitecture}");24 Console.WriteLine($"isValidArchitectureMuxer: {isValidArchitectureMuxer}");25 Console.ReadLine();26 }27 }28}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!