Skip to content

Lazy initialize cred providers in VS - #7759

Merged
zivkan merged 1 commit into
devfrom
dev-zivkan-lazy-credential-factories
Oct 9, 2026
Merged

zivkan merged 1 commit into
devfrom
dev-zivkan-lazy-credential-factories

Conversation

@zivkan

@zivkan zivkan commented Oct 8, 2026

Copy link
Copy Markdown
Member

Bug

Fixes: NuGet/Home#10994

Description

#7745 changed the VS credential service provider to take methods in the constructor, so the service itself could be testable. However, in order for the product code to get the method pointers in the constructor, the methods need to be resolved at the time the constructor runs, not when the method is first called. This caused a VS perf test regression, as NuGet.Credentials.dll is now being loaded when it's otherwise not needed.

Therefore, the fix is to not reference the product functions until they're actually needed, effectively lazy loading them. But we can keep the func pointers so that the code is testable still.

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. N/A

@zivkan
zivkan requested a review from a team as a code owner October 8, 2026 21:55
@zivkan
zivkan requested review from donnie-msft and nkolev92 October 8, 2026 21:55
@zivkan
zivkan merged commit 23a2bb3 into dev Oct 9, 2026
18 checks passed
@zivkan
zivkan deleted the dev-zivkan-lazy-credential-factories branch October 9, 2026 01:34
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.

Visual Studio NuGet Package Manager Prompting for Authentication Before Trying Credential Provider

2 participants