Skip to content

VisualStudioCredential throw CUE for all failures except task cancellation #50470

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 1 commit into from
Jun 10, 2025

Conversation

christothes
Copy link
Member

fixes #50450

@Copilot Copilot AI review requested due to automatic review settings June 6, 2025 16:54
@christothes christothes requested review from JonathanCrd and a team as code owners June 6, 2025 16:54
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 standardizes the exception behavior for VisualStudioCredential by ensuring that all failures, except when cancellation is requested, throw CredentialUnavailableException.

  • Test methods are refactored to remove the chained credential flag and now uniformly expect CredentialUnavailableException.
  • The catch block in VisualStudioCredential is updated to remove legacy error string matching in favor of a cancellation check.

Reviewed Changes

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

File Description
sdk/identity/Azure.Identity/tests/VisualStudioCredentialTests.cs Removed conditional handling based on a boolean flag and updated test expectations accordingly.
sdk/identity/Azure.Identity/src/Credentials/VisualStudioCredential.cs Simplified exception handling by removing error string matching and adding cancellation logic.
sdk/identity/Azure.Identity/CHANGELOG.md Updated changelog to describe the new exception throwing behavior.
Comments suppressed due to low confidence (1)

sdk/identity/Azure.Identity/src/Credentials/VisualStudioCredential.cs:122

  • [nitpick] Local variable naming in C# typically uses camelCase. Consider renaming 'IsCancellationRequested' to 'isCancellationRequested' for consistency.
bool IsCancellationRequested = e is OperationCanceledException && cancellationToken.IsCancellationRequested;

@github-project-automation github-project-automation bot moved this from Untriaged to In Progress in Azure Identity SDK Improvements Jun 9, 2025
@christothes christothes merged commit 2385a0a into Azure:main Jun 10, 2025
27 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Azure Identity SDK Improvements Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

[BUG] VisualStudioCredential preventing fallback on error AADSTS65001
2 participants