diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index a3db321fae..b729394028 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -860,17 +860,17 @@ public ConcurrentDictionary get_outdated(ChocolateyConfig set_package_names_if_all_is_specified(config, () => { config.IgnoreDependencies = true; }); var packageNames = config.PackageNames.Split(new[] { ApplicationParameters.PackageNamesSeparator }, StringSplitOptions.RemoveEmptyEntries).or_empty_list_if_null().ToList(); - foreach (var packageName in packageNames) - { - var repository = packageManager.SourceRepository; + var repository = packageManager.SourceRepository; - bool isRemote = IsRepositoryRemote(repository); + bool isRemote = repository_is_remote(repository); + foreach (var packageName in packageNames) + { IPackage latestPackage; if (isRemote) { - latestPackage = repository.GetPackages().Where(x => x.Id.ToLower() == packageName && x.IsLatestVersion).SingleOrDefault(); + latestPackage = repository.GetPackages().Where(x => x.Id.ToLower() == packageName && x.IsLatestVersion).ToList().SingleOrDefault(); } else { @@ -920,7 +920,7 @@ public ConcurrentDictionary get_outdated(ChocolateyConfig return outdatedPackages; } - private bool IsRepositoryRemote(IPackageRepository repository) + private bool repository_is_remote(IPackageRepository repository) { bool isRemote; var aggregateRepo = repository as AggregateRepository;