Skip to content

Commit 51b2ac4

Browse files
authored
Enable searching for assemblies in GAC_Arm64 on Windows (PowerShell#17816)
1 parent cd380bc commit 51b2ac4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/System.Management.Automation/CoreCLR/CorePsAssemblyLoadContext.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,14 +365,14 @@ private bool TryFindInGAC(AssemblyName assemblyName, out string assemblyFilePath
365365

366366
if (!assemblyFound)
367367
{
368-
string gacBitnessAwarePath = null;
368+
string gacBitnessAwarePath;
369369

370370
if (Environment.Is64BitProcess)
371371
{
372372
if (string.IsNullOrEmpty(_gacPath64))
373373
{
374-
// cache value of '_gacPath64' folder in member variable.
375-
_gacPath64 = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_64";
374+
var gacName = RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? "GAC_Arm64" : "GAC_64";
375+
_gacPath64 = Path.Join(_winDir, "Microsoft.NET", "assembly", gacName);
376376
}
377377

378378
gacBitnessAwarePath = _gacPath64;
@@ -381,8 +381,7 @@ private bool TryFindInGAC(AssemblyName assemblyName, out string assemblyFilePath
381381
{
382382
if (string.IsNullOrEmpty(_gacPath32))
383383
{
384-
// cache value of '_gacPath32' folder in member variable.
385-
_gacPath32 = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_32";
384+
_gacPath32 = Path.Join(_winDir, "Microsoft.NET", "assembly", "GAC_32");
386385
}
387386

388387
gacBitnessAwarePath = _gacPath32;

0 commit comments

Comments
 (0)