private async Task <LibraryDependencyInfo> GetDependenciesCoreAsync( LibraryIdentity match, NuGetFramework targetFramework, SourceCacheContext cacheContext, ILogger logger, CancellationToken cancellationToken) { await EnsureResource(); FindPackageByIdDependencyInfo packageInfo = null; try { if (_throttle != null) { await _throttle.WaitAsync(); } // Read package info, this will download the package if needed. packageInfo = await _findPackagesByIdResource.GetDependencyInfoAsync( match.Name, match.Version, cacheContext, logger, cancellationToken); } catch (FatalProtocolException e) when(_ignoreFailedSources && !(e is InvalidCacheProtocolException)) { if (!_ignoreWarning) { await _logger.LogAsync(RestoreLogMessage.CreateWarning(NuGetLogCode.NU1801, e.Message, match.Name)); } } finally { _throttle?.Release(); } if (packageInfo == null) { // Package was not found return(LibraryDependencyInfo.CreateUnresolved(match, targetFramework)); } else { // Package found var originalIdentity = new LibraryIdentity( packageInfo.PackageIdentity.Id, packageInfo.PackageIdentity.Version, match.Type); var dependencies = GetDependencies(packageInfo, targetFramework); return(LibraryDependencyInfo.Create(originalIdentity, targetFramework, dependencies)); } }
private async Task <LibraryDependencyInfo> GetDependenciesCoreAsync( LibraryIdentity match, NuGetFramework targetFramework, SourceCacheContext cacheContext, ILogger logger, CancellationToken cancellationToken) { FindPackageByIdDependencyInfo packageInfo = null; try { await EnsureResource(); if (_throttle != null) { await _throttle.WaitAsync(); } // Read package info, this will download the package if needed. packageInfo = await _findPackagesByIdResource.GetDependencyInfoAsync( match.Name, match.Version, cacheContext, logger, cancellationToken); } catch (FatalProtocolException e) when(e is not InvalidCacheProtocolException) { if (_ignoreFailedSources) { await LogWarningAsync(logger, match.Name, e); } else { await LogErrorAsync(logger, match.Name, e); throw; } } finally { _throttle?.Release(); } if (packageInfo == null) { // Package was not found return(LibraryDependencyInfo.CreateUnresolved(match, targetFramework)); } else { // Package found var originalIdentity = new LibraryIdentity( packageInfo.PackageIdentity.Id, packageInfo.PackageIdentity.Version, match.Type); IEnumerable <LibraryDependency> dependencyGroup = GetDependencies(packageInfo, targetFramework); return(LibraryDependencyInfo.Create(originalIdentity, targetFramework, dependencies: dependencyGroup)); } }