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

[DCR]: VS Credential Provider exception messages are not displayed by NuGet in Output/Error List window logs. #12068

Open
kartheekp-ms opened this issue Aug 31, 2022 · 2 comments
Assignees
Labels
Area:Authentication Area:ErrorHandling warnings and errors/log messages & related error codes. Category:Quality Week Issues that should be considered for quality week Partner:VS-Other Priority:2 Issues for the current backlog. Product:VS.Client Type:DCR Design Change Request

Comments

@kartheekp-ms
Copy link
Contributor

kartheekp-ms commented Aug 31, 2022

NuGet Product(s) Affected

Visual Studio Package Management UI

Current Behavior

While accessing private Azure DevOps feeds in Visual Studio, sometimes users may get 401 unauthorized errors because of state accounts, bad credentials etc., Visual Studio adds Unable to load service index from source: {source URL}. Response status code from the server didn't indicate success 401 (unauthorized). message to the Output -> Package Manager window and an entry to the Error List window. In few cases VS Credential Provider provides some additional information in the exception that may help customers to resolve the problem. Unfortunately, this information is not displayed to the user by NuGet.

Desired Behavior

Display VS Credential Provider additional information in the exception to the customer in Visual Studio so that the error message is more actionable. In few cases the action may resolve user error and helps customers to access their private feeds from the comfort of their VS IDE.

Additional Context

Repro steps

  1. Download the sample solution from authentication-demo.zip.
  2. Open the solution in Visual Studio.
  3. Navigate to the solution-level Package Manager UI.
  4. Visual Studio will attempt to access the private feed. During this process, a sign-in prompt will appear for the user to select an account.
  5. Choose a personal Microsoft account that does not have access to the feed.
  6. The Credential Provider will throw an exception as illustrated below: This exception was captured while debugging the NuGet Client extension.
    auth-demo-exception
  7. The exception thrown by the Credential Provider is not displayed in either the NuGet Output window or the Error List window in Visual Studio.
    auth-issue-output
@kartheekp-ms kartheekp-ms added Product:VS.Client Type:DCR Design Change Request Area:ErrorHandling warnings and errors/log messages & related error codes. Area:Authentication Triage:Untriaged labels Aug 31, 2022
@kartheekp-ms kartheekp-ms changed the title [DCR]: VS Credential Provider exception messages are not displayed in NuGet logs [DCR]: VS Credential Provider exception messages are not displayed by NuGet in Output/Error List window logs. Aug 31, 2022
@heng-liu heng-liu added internal-debugging For bot related testing and removed internal-debugging For bot related testing labels Sep 1, 2022
@nkolev92 nkolev92 added Priority:2 Issues for the current backlog. and removed Triage:NeedsTriageDiscussion labels Sep 12, 2022
@kartheekp-ms
Copy link
Contributor Author

The current implementation uses a NullLogger when attempting to fetch the service index, which suppresses all log messages.

https://github.com/NuGet/NuGet.Client/blob/b10ba996eeb40da639273848408d2628e01076f4/src/NuGet.Core/NuGet.Protocol/Providers/ServiceIndexResourceV3Provider.cs#L77

If the credential provider throws an exception, the user will not see the exception because all methods in NullLogger are no-ops.

@Nigusu-Allehu
Copy link
Contributor

This issue has also impacted NuGet/NuGet.Client#5990 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Authentication Area:ErrorHandling warnings and errors/log messages & related error codes. Category:Quality Week Issues that should be considered for quality week Partner:VS-Other Priority:2 Issues for the current backlog. Product:VS.Client Type:DCR Design Change Request
Projects
None yet
Development

No branches or pull requests

5 participants