Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for no-op restore when deciding to update the info bar #6245

Merged
merged 4 commits into from
Feb 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ internal sealed class SolutionRestoreJob : ISolutionRestoreJob
private int _currentCount;
private AuditCheckResult _auditCheckResult;
private bool _solutionHasVulnerabilities;
private bool _didNewAuditCheckRun;

/// <summary>
/// Restore end status. For testing purposes
Expand Down Expand Up @@ -267,7 +268,10 @@ await RestorePackageSpecProjectsAsync(
}

// Display info bar in SolutionExplorer if there is a vulnerability during restore.
await _vulnerabilitiesFoundService.Value.ReportVulnerabilitiesAsync(_solutionHasVulnerabilities, token);
if (_didNewAuditCheckRun)
{
await _vulnerabilitiesFoundService.Value.ReportVulnerabilitiesAsync(_solutionHasVulnerabilities, token);
}
}
catch (OperationCanceledException)
{
Expand Down Expand Up @@ -508,6 +512,7 @@ await _logger.RunWithProgressAsync(
isRestoreSucceeded = restoreSummaries.All(summary => summary.Success == true);
_noOpProjectsCount += restoreSummaries.Count(summary => summary.NoOpRestore == true);
_solutionUpToDateChecker.SaveRestoreStatus(restoreSummaries);
_didNewAuditCheckRun = true;
_solutionHasVulnerabilities |= AnyProjectHasVulnerablePackageWarning(restoreSummaries);
}
catch
Expand Down Expand Up @@ -708,6 +713,7 @@ await _logger.RunWithProgressAsync(
_status = NuGetOperationStatus.Succeeded;
}
_auditResultCachingService.LastAuditCheckResult = _auditCheckResult;
_didNewAuditCheckRun = true;
jeffkl marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
Expand All @@ -721,6 +727,7 @@ await _logger.RunWithProgressAsync(
AuditChecker auditChecker = new(sourceRepositories, sourceCacheContext, _logger);
AuditCheckResult result = await auditChecker.CheckPackageVulnerabilitiesAsync(packages, auditProperties, token);
_auditResultCachingService.LastAuditCheckResult = result;
_didNewAuditCheckRun = true;
}
else
{
Expand Down
Loading