Skip to content

Create Restore Bar logger in Package Manager UI #6433

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

Merged
merged 5 commits into from
May 5, 2025

Conversation

donnie-msft
Copy link
Contributor

Bug

Fixes: NuGet/Home#13407

Description

Informational messages are no longer logged to the RestoreBar (InfoBar / Gold Bar / Yellow bar) in NuGet's Package Manager UI.

  • Create a new logger that specifically models the RestoreBar's logger where only Warning level or higher are displayed.
    • Maintains the adapter approach for INuGetProjectContext.
  • Output Pane continues to show Info level, informational logging.
    • For example, CACHE https://api.nuget.org/v3/vulnerabilities/index.json is shown in Output Pane but no longer in the Restore Bar.

image

Side effects

  • Reduces screen flicker which occurred from briefly showing and hiding the Restore Bar for HTTP status (GET / OK / CACHE).

Future considerations

  • Suggest that the next step be to look into simplifying the logging overall.
  • Possibly LoggerBase and LoggerAdapter can be merged as there's a lot of overlap.
  • INuGetProjectContext representing a project and a logger isn't a great abstraction. The separation of concerns could be improved.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

@donnie-msft donnie-msft requested a review from a team as a code owner May 2, 2025 23:11
@donnie-msft donnie-msft requested review from dtivel and nkolev92 May 2, 2025 23:59
@aortiz-msft aortiz-msft requested a review from Copilot May 5, 2025 19:03
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new RestoreBarLogger to ensure that only log messages of Warning level or higher are displayed in NuGet's Package Manager UI Restore Bar, addressing the bug described in NuGet/Home#13407.

  • Added unit tests for RestoreBarLogger behavior.
  • Updated PackageRestoreBar.xaml.cs to use RestoreBarLogger instead of LoggerAdapter.
  • Implemented RestoreBarLogger to forward only selected log levels to the underlying INuGetProjectContext.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Utility/RestoreBarLoggerTests.cs Added tests verifying that only Warning level and above messages are logged.
src/NuGet.Clients/NuGet.PackageManagement.UI/Xamls/PackageRestoreBar.xaml.cs Updated logger initialization to use RestoreBarLogger.
src/NuGet.Clients/NuGet.PackageManagement.UI/Utility/RestoreBarLogger.cs Introduced RestoreBarLogger with filtering based on verbosity level.

@donnie-msft donnie-msft merged commit bbbc1e6 into dev May 5, 2025
21 checks passed
@donnie-msft donnie-msft deleted the dev-donnie-msft-cacheGoldBar branch May 5, 2025 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Yellow 'CACHE' bar shown in Visual Studio on add operations from PM UI
5 participants