Skip to content

Conversation

cheenamalhotra
Copy link
Member

Fixes #3618

The issue is reproducible when config file is configured with a custom authentication provider.
Using SetProvider (as in tests) to override default providers does not reproduce issue, hence missed.

The fix will be back-ported to other affected branches (release/6.0 and 6.1).

@cheenamalhotra cheenamalhotra requested a review from a team as a code owner September 18, 2025 17:52
@Copilot Copilot AI review requested due to automatic review settings September 18, 2025 17:52
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 fixes an issue where SetProvider method would continue execution after finding a user-defined provider instead of returning immediately, potentially allowing the replacement of existing user-defined authentication providers.

  • Replaces break statement with return false to prevent overriding user-defined providers
  • Ensures proper early exit when a user-defined provider already exists for the authentication method

@paulmedynski
Copy link
Contributor

Should we add a test that confirms the broken behaviour when using the config-file based auth provider registration? And then see it pass with your fix.

Copy link

codecov bot commented Sep 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.31%. Comparing base (1765de5) to head (a792b51).
⚠️ Report is 23 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3620      +/-   ##
==========================================
+ Coverage   69.61%   77.31%   +7.69%     
==========================================
  Files         276      273       -3     
  Lines       61714    46058   -15656     
==========================================
- Hits        42964    35611    -7353     
+ Misses      18750    10447    -8303     
Flag Coverage Δ
addons 90.82% <ø> (ø)
netcore 77.11% <0.00%> (+3.81%) ⬆️
netfx 76.44% <100.00%> (+8.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ErikEJ
Copy link
Contributor

ErikEJ commented Sep 18, 2025

Wonder if it would be possible to add a test to prevent regression?

@paulmedynski paulmedynski self-assigned this Sep 23, 2025
@cheenamalhotra cheenamalhotra added this to the 7.0-preview2 milestone Sep 23, 2025
paulmedynski
paulmedynski previously approved these changes Sep 24, 2025
@samsharma2700 samsharma2700 self-assigned this Sep 26, 2025
paulmedynski
paulmedynski previously approved these changes Sep 30, 2025
@cheenamalhotra cheenamalhotra merged commit d5ba064 into main Oct 3, 2025
252 checks passed
@cheenamalhotra cheenamalhotra deleted the dev/cheena/fix-provider-replacement branch October 3, 2025 16:39
cheenamalhotra added a commit that referenced this pull request Oct 3, 2025
…3620)

* Fix SetProvider to return immediately if user-defined provider found

* Include test

* Fix tests

* Remove unwanted changes

* Update config file name

* Rename file back to app.config

* Copy always

* Disable tests for now.

* Fix framework inclusion

* Fix test failures

* Touch ups

* Fix test (continued)
cheenamalhotra added a commit that referenced this pull request Oct 3, 2025
…3620)

* Fix SetProvider to return immediately if user-defined provider found

* Include test

* Fix tests

* Remove unwanted changes

* Update config file name

* Rename file back to app.config

* Copy always

* Disable tests for now.

* Fix framework inclusion

* Fix test failures

* Touch ups

* Fix test (continued)
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.

Custom SqlClientAuthenticationProvider being overwritten by default one
5 participants