diff --git a/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CoreCLR/CorePsAssemblyLoadContext.cs b/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CoreCLR/CorePsAssemblyLoadContext.cs index 106cf402a5..c1e0e75220 100644 --- a/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CoreCLR/CorePsAssemblyLoadContext.cs +++ b/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CoreCLR/CorePsAssemblyLoadContext.cs @@ -141,8 +141,9 @@ namespace System.Management.Automation string asmCultureName = assemblyName.CultureName ?? string.Empty; string asmFilePath = null; - foreach (var probingPath in probingPaths) + for (int i = 0; i < probingPaths.Count; i++) { + string probingPath = probingPaths[i]; string asmCulturePath = Path.Combine(probingPath, asmCultureName); for (int k = 0; k < extensions.Length; k++) {