Skip to content

Commit f74acaa

Browse files
authored
Replace GetFiles in TestModuleManifestCommand (#14317)
1 parent cb13c30 commit f74acaa

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/System.Management.Automation/engine/Modules/TestModuleManifestCommand.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -420,23 +420,13 @@ private static bool IsValidGacAssembly(string assemblyName)
420420

421421
try
422422
{
423-
var allFiles = Directory.GetFiles(gacPath, assemblyFile, SearchOption.AllDirectories);
424-
425-
if (allFiles.Length == 0)
426-
{
427-
var allNgenFiles = Directory.GetFiles(gacPath, ngenAssemblyFile, SearchOption.AllDirectories);
428-
if (allNgenFiles.Length == 0)
429-
{
430-
return false;
431-
}
432-
}
423+
return Directory.EnumerateFiles(gacPath, assemblyFile, SearchOption.AllDirectories).Any()
424+
|| Directory.EnumerateFiles(gacPath, ngenAssemblyFile, SearchOption.AllDirectories).Any();
433425
}
434426
catch
435427
{
436428
return false;
437429
}
438-
439-
return true;
440430
#endif
441431
}
442432
}

0 commit comments

Comments
 (0)