diff --git a/dnSpy/dnSpy.Contracts.Logic/Utilities/NuGetPackageLocator.cs b/dnSpy/dnSpy.Contracts.Logic/Utilities/NuGetPackageLocator.cs index 4af7f0070a..f1862ca0ff 100644 --- a/dnSpy/dnSpy.Contracts.Logic/Utilities/NuGetPackageLocator.cs +++ b/dnSpy/dnSpy.Contracts.Logic/Utilities/NuGetPackageLocator.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; using NuGet.Configuration; @@ -38,7 +39,7 @@ static NuGetPackageLocator() { public static IReadOnlyList> GetPossibleNuGetPackageLocations(string packageName, string? packageVersion) => GetPossibleNuGetPackageLocations(new NuGetPackageInfo(packageName, packageVersion)); - static IReadOnlyList> GetPossibleNuGetPackageLocations(NuGetPackageInfo packageInfo) { + static List> GetPossibleNuGetPackageLocations(NuGetPackageInfo packageInfo) { var packageSources = new List>(); // This is the directory to which packages are downloaded to @@ -69,6 +70,9 @@ static IReadOnlyList> GetPossibleNuGetPackageLocations(NuG } static IReadOnlyList FindPackages(string packageStore, NuGetPackageInfo packageInfo) { + if (!Directory.Exists(packageStore)) + return Array.Empty(); + var result = new List(); string[] packages = Directory.GetDirectories(packageStore);