Repository: files-community/Files
File: tests/Files.InteractionTests/SessionManager.cs (C#)

Code before:
			{
				// Use next app ID since the current one was failing
				if (exc.Message.Contains("Package was not found"))
				{
					appIdIndex++;
				}
				else
				{
					Console.WriteLine("Failed to update start driver, got exception:" + exc.Message);
				}
			}
		}

		[AssemblyInitialize]
		public static void CreateSession(TestContext _)
		{
			if (_session is null)
			{

				int timeoutCount = 50;

				tryInitializeSession();
				if (_session is null)
				{
					// WinAppDriver is probably not running, so lets start it!
					if (File.Exists($@"{Environment.GetEnvironmentVariable("SystemDrive")}\Program Files (x86)\Windows Application Driver\WinAppDriver.exe"))
					{
						Process.Start($@"{Environment.GetEnvironmentVariable("SystemDrive")}\Program Files (x86)\Windows Application Driver\WinAppDriver.exe");
					}
					else if (File.Exists($@"{Environment.GetEnvironmentVariable("SystemDrive")}\Program Files\Windows Application Driver\WinAppDriver.exe"))
					{
						Process.Start($@"{Environment.GetEnvironmentVariable("SystemDrive")}\Program Files\Windows Application Driver\WinAppDriver.exe");
					}
					else
					{
						throw new Exception("Unable to start WinAppDriver since no suitable location was found.");
					}

					Thread.Sleep(10000);
					tryInitializeSession();
				}

				while (_session is null && timeoutCount < 1000 * 4)
				{
					tryInitializeSession();
					Thread.Sleep(timeoutCount);
					timeoutCount *= 2;
				}

				Thread.Sleep(3000);
				Assert.IsNotNull(_session);

Review comment (suggestion):
Use %ProgramData(x86)%
```suggestion
					if (File.Exists($@"{Environment.GetEnvironmentVariable("ProgramData(x86)")}\Windows Application Driver\WinAppDriver.exe"))
```

Code after:
			{
				// Use next app ID since the current one was failing
				if (exc.Message.Contains("Package was not found"))
				{
					appIdIndex++;
				}
				else
				{
					Console.WriteLine("Failed to update start driver, got exception:" + exc.Message);
				}
			}
		}

		[AssemblyInitialize]
		public static void CreateSession(TestContext _)
		{
			if (_session is null)
			{

				int timeoutCount = 50;

				tryInitializeSession();
				if (_session is null)
				{
					// WinAppDriver is probably not running, so lets start it!
					if (File.Exists($@"{Environment.GetEnvironmentVariable("ProgramFiles(x86)")}\Windows Application Driver\WinAppDriver.exe"))
					{
						Process.Start($@"{Environment.GetEnvironmentVariable("ProgramFiles(x86)")}\Windows Application Driver\WinAppDriver.exe");
					}
					else if (File.Exists($@"{Environment.GetEnvironmentVariable("ProgramFiles")}\Windows Application Driver\WinAppDriver.exe"))
					{
						Process.Start($@"{Environment.GetEnvironmentVariable("ProgramFiles")}\Windows Application Driver\WinAppDriver.exe");
					}
					else
					{
						throw new Exception("Unable to start WinAppDriver since no suitable location was found.");
					}

					Thread.Sleep(10000);
					tryInitializeSession();
				}

				while (_session is null && timeoutCount < 1000 * 4)
				{
					tryInitializeSession();
					Thread.Sleep(timeoutCount);
					timeoutCount *= 2;
				}

				Thread.Sleep(3000);
				Assert.IsNotNull(_session);