diff --git a/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs b/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs index 766d1b305147..4a8897cc5aa9 100644 --- a/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs +++ b/src/Cli/dotnet/NugetPackageDownloader/NuGetPackageDownloader.cs @@ -93,13 +93,14 @@ public async Task DownloadPackageAsync(PackageId packageId, SourceRepository repository = GetSourceRepository(source); - if (isTool && await repository.GetResourceAsync(cancellationToken).ConfigureAwait(false) is var searchResource) + if (isTool && await repository.GetResourceAsync(cancellationToken).ConfigureAwait(false) is var searchResource) { var results = await searchResource.SearchAsync(packageId.ToString(), new SearchFilter(includePrerelease: includePreview, filter: SearchFilterType.IsLatestVersion) { PackageTypes = [NuGet.Packaging.Core.PackageType.DotnetTool.Name] }, skip: 0, take: 10, log: _verboseLogger, cancellationToken: cancellationToken).ConfigureAwait(false); - if (results.Count() == 0) + + if (!results.Any()) { throw new ToolPackageException(string.Format(LocalizableStrings.NotATool, packageId)); }