Skip to content

Conversation

@apoorvdeshmukh
Copy link
Contributor

@apoorvdeshmukh apoorvdeshmukh commented Dec 15, 2025

Ports #3841 to release branch 6.1

Issues

AB#41015

Guidelines

Please review the contribution guidelines before submitting a pull request:

@apoorvdeshmukh apoorvdeshmukh requested a review from a team as a code owner December 15, 2025 15:40
Copilot AI review requested due to automatic review settings December 15, 2025 15:40
Copy link
Contributor

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 ports #3841 to the release/6.1 branch, introducing an app context switch (Switch.Microsoft.Data.SqlClient.EnableMultiSubnetFailoverByDefault) that allows applications to enable MultiSubnetFailover by default without explicitly setting it in each connection string. When the switch is set to true, MultiSubnetFailover defaults to true instead of false, enabling parallel IP connection attempts for improved connection times in multi-subnet environments.

Key changes:

  • Added new app context switch EnableMultiSubnetFailoverByDefault with tristate lazy initialization pattern
  • Changed MultiSubnetFailover default from const to static property to allow runtime evaluation based on the app context switch
  • Added comprehensive test coverage for the new switch behavior including unit and functional tests

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/LocalAppContextSwitches.cs Added EnableMultiSubnetFailoverByDefault property and backing field with tristate lazy initialization
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/ConnectionString/DbConnectionStringDefaults.cs Changed MultiSubnetFailover from const to static property that evaluates the app context switch
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnectionString.cs Changed DEFAULT.MultiSubnetFailover from const to static property to support runtime evaluation
src/Microsoft.Data.SqlClient/tests/Common/LocalAppContextSwitchesHelper.cs Added test helper infrastructure for manipulating and restoring the new switch value
src/Microsoft.Data.SqlClient/tests/FunctionalTests/LocalAppContextSwitchesTests.cs Added test to verify the new switch defaults to false
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/SqlConnectionStringTest.cs Added parameterized test for MultiSubnetFailover behavior with various combinations of connection string values and app context switch states; includes commented-out test for FailoverPartner validation

@apoorvdeshmukh apoorvdeshmukh added this to the 6.1.4 milestone Dec 15, 2025
@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 64.30%. Comparing base (8291391) to head (99d6fa3).
⚠️ Report is 1 commits behind head on release/6.1.

Files with missing lines Patch % Lines
...icrosoft/Data/SqlClient/LocalAppContextSwitches.cs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           release/6.1    #3851      +/-   ##
===============================================
- Coverage        66.21%   64.30%   -1.91%     
===============================================
  Files              279      279              
  Lines            53293    53301       +8     
===============================================
- Hits             35286    34275    -1011     
- Misses           18007    19026    +1019     
Flag Coverage Δ
addons 90.82% <ø> (ø)
netcore 68.44% <85.71%> (-4.31%) ⬇️
netfx 67.78% <85.71%> (+1.91%) ⬆️

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.

@paulmedynski paulmedynski self-assigned this Dec 15, 2025
@apoorvdeshmukh apoorvdeshmukh merged commit 34d0612 into release/6.1 Dec 16, 2025
252 checks passed
@apoorvdeshmukh apoorvdeshmukh deleted the dev/ad/port3841to61 branch December 16, 2025 06:13
This was referenced Jan 16, 2026
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.

4 participants