Skip to content

Commit 4c1a866

Browse files
Add a fallback to hive detection in integration tests (#11885)
Add a fallback to path detection in integration tests to handle the case where the hive path is not found.
1 parent 9c0b981 commit 4c1a866

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/VisualStudioLogging.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,13 @@ internal static string GetHiveDirectory()
159159
// store things, the following is written to work even if installationId is an empty string. In
160160
// that case it will fall back to the previous behavior of expecting a single RoslynDev hive to
161161
// exist, or fail.
162-
var directories = Directory.GetDirectories(vsLocalDir, $"17*{installationId}RoslynDev", SearchOption.TopDirectoryOnly);
162+
var directories = Directory.GetDirectories(vsLocalDir, $"18*{installationId}RoslynDev", SearchOption.TopDirectoryOnly);
163163
var hiveDirectories = directories.Where(d => !d.Contains("$")).ToList();
164+
if (hiveDirectories.Count == 0)
165+
{
166+
directories = Directory.GetDirectories(vsLocalDir, $"17*{installationId}RoslynDev", SearchOption.TopDirectoryOnly);
167+
hiveDirectories = directories.Where(d => !d.Contains("$")).ToList();
168+
}
164169

165170
Assert.True(hiveDirectories.Count == 1, $"Could not find the hive path for InstallationID '{installationId}'. Found instead:{Environment.NewLine}{string.Join(Environment.NewLine, hiveDirectories)}");
166171

0 commit comments

Comments
 (0)