Skip to content

Remove Lingering Sql Server 2005 References - #4881

Merged
priyankatiwari08 merged 22 commits into
mainfrom
dev/russellben/remove-2005
Oct 26, 2026
Merged

priyankatiwari08 merged 22 commits into
mainfrom
dev/russellben/remove-2005

Conversation

@benrr101

Copy link
Copy Markdown
Contributor

Description

Despite the fact that we do not officially support SQL Server 2005 any longer, there is still a fair number of places that check for newer than 2005 before doing things. Additionally, there are comments and variable names that call out 2005 or 2008. Since we expect that the server we connect to will always be 2008 or newer, comments like this become confusing since they make it difficult to determine what the code seeks to do.

This PR removes a variety of these instances:

  • Removed SQL Server 2005 connectivity support: reject its TDS version and update version-validation tests.
  • Removed the SQL Server 2005 type-system option and its compatibility paths in SqlDataReader, including date/time string conversions and large-UDT fallbacks.
  • Removed obsolete capability checks for SQL Server 2008+, expanded date/time types, large UDTs, XML, and UDT support.
  • Simplified stored-procedure parameter discovery: use the modern metadata procedure and named column constants instead of pre-/post-2008 mappings.
  • Consolidated metadata type inference, retaining DateTime2 inference for CLR DateTime values.
  • Removed unused MetaType version-support flags and the redundant Is2008DateTimeType property and checks.
  • Renamed historical identifiers: IsStructuredType, IsPartialZombie, ExecuteTransactionInternal, and date/time formatting members without 2008.
  • Removed unused header constants and reduced the scratch buffer’s initial allocation from 12 to eight bytes using sizeof(long).
  • Updated misleading comments to describe current behavior while preserving useful compatibility history and valid version checks.

Breaking Changes

  1. If a user attempts to connect to SQL Server 2005, their connection will be rejected. This is a change that is congruent with our official support matrix, and shouldn't be controversial.
  2. This removes support for the Type System Version=SQL Server 2005 connection string option. This mode was available as a backwards-compatibility shim layer for projecting newer date/time types as strings, and large UDTs as binary values. Maintaining this feature requires several separate paths throughout reader metadata and value access. As we move to simplify and improve reader performance, removing this will aid in these goals, although it will force older applications to need to update to handle the new object types. The run up to 8.0.0 seems like as good a time as any to drop this feature.

@benrr101 benrr101 added this to the 8.0.0-preview1 milestone Oct 20, 2026
@benrr101 benrr101 added the Code Health 💊 Issues/PRs that are targeted to source code quality improvements. label Oct 20, 2026
@benrr101
benrr101 requested a review from a team as a code owner October 20, 2026 21:37
Copilot AI balanced review requested due to automatic review settings October 20, 2026 21:37
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Oct 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Existing tests still expect removed behavior, and the new rejection test uses the wrong protocol identifier.

3 open issues
What changed in this PR

Removes SQL Server 2005 connectivity and compatibility paths from SqlClient, simplifying code around newer server behavior.

Changes:

  • Rejects SQL Server 2005 connections and removes its type-system option.
  • Simplifies reader conversions, parameter discovery, and capability checks.
  • Renames historical identifiers, clarifies comments, and reduces scratch-buffer allocation.
File Description
src/​Microsoft.Data.SqlClient/​tests/​UnitTests/​Microsoft/​Data/​Common/​AdapterUtilTest.cs Updates protocol-version cases.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​TransactionRequest.cs Clarifies rollback comment.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​TdsParserStateObject.cs Shrinks scratch buffer and removes obsolete assertion.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​TdsParserHelperClasses.cs Removes redundant date/time classification.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​TdsParser.cs Removes obsolete capability checks.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​TdsEnums.cs Removes legacy protocol and header constants.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlTransaction.cs Renames partial-zombie checks.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlParameter.cs Clarifies size-conversion comments.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlMetaDataFactory.cs Corrects metadata-version comments.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlInternalTransaction.cs Clarifies transaction-cleanup comments.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlEnums.cs Removes version flags and renames structured-type classification.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlDataReader.cs Removes legacy type projections.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlConnectionOptions.cs Removes SQL Server 2005 type-system parsing.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlConnection.cs Removes obsolete version accessor.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlCommand.cs Simplifies parameter metadata discovery.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlCollation.cs Clarifies collation comment.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlBulkCopy.cs Removes legacy server branches.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlBuffer.cs Renames date/time formatting members.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​Server/​ValueUtilsSmi.cs Clarifies value-handling comments.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​Server/​SqlMetaData.cs Clarifies constructor comment.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​Server/​MetadataUtilsSmi.cs Consolidates inference, preserving DateTime2 mapping.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​Connection/​SqlConnectionInternal.cs Renames transaction execution and removes version accessor.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​Connection/​ConnectionCapabilities.cs Removes obsolete capability properties.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​Common/​AdapterUtil.cs Rejects SQL Server 2005 protocol version.

Review effort: Balanced

@benrr101 benrr101 added the Breaking Change 🔨 Issues/PRs that are related with breaking API changes in the driver. label Oct 20, 2026
@mdaigle mdaigle moved this from To triage to In review in SqlClient Board Oct 20, 2026

@paulmedynski paulmedynski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More Copilot findings have sufraced.

@github-project-automation github-project-automation Bot moved this from In review to Waiting for customer in SqlClient Board Oct 22, 2026
Copilot AI balanced review requested due to automatic review settings October 22, 2026 18:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Public API documentation still directs callers to a removed configuration that now fails during connection construction.

1 open issue
2 resolved since last review

Review effort: Balanced

paulmedynski
paulmedynski previously approved these changes Oct 22, 2026
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.85714% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.05%. Comparing base (616aeff) to head (a1fa63d).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...lClient/src/Microsoft/Data/SqlClient/SqlCommand.cs 28.00% 18 Missing ⚠️
...ient/src/Microsoft/Data/SqlClient/SqlDataReader.cs 86.79% 7 Missing ⚠️
...icrosoft/Data/SqlClient/Server/MetadataUtilsSmi.cs 0.00% 5 Missing ⚠️
...qlClient/src/Microsoft/Data/SqlClient/SqlBuffer.cs 42.85% 4 Missing ⚠️
...ent/src/Microsoft/Data/SqlClient/SqlTransaction.cs 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4881      +/-   ##
==========================================
- Coverage   67.58%   66.05%   -1.53%     
==========================================
  Files         310      304       -6     
  Lines       45543    68454   +22911     
==========================================
+ Hits        30779    45217   +14438     
- Misses      14764    23237    +8473     
Flag Coverage Δ
CI-SqlClient ?
PR-SqlClient-Project 66.05% <67.85%> (?)

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

☔ View full report in Codecov by Harness.
📢 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.

cheenamalhotra
cheenamalhotra previously approved these changes Oct 22, 2026
@mdaigle

mdaigle commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Copilot's docs comment is valid

Copilot AI balanced review requested due to automatic review settings October 23, 2026 02:02
@benrr101
benrr101 dismissed stale reviews from cheenamalhotra and paulmedynski via 39baa86 October 23, 2026 02:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The intentional protocol and reader compatibility breaks require maintainer sign-off backed by build and integration-test evidence.

1 open issue

Review effort: Balanced

paulmedynski
paulmedynski previously approved these changes Oct 23, 2026
mdaigle
mdaigle previously approved these changes Oct 23, 2026
Copilot AI balanced review requested due to automatic review settings October 23, 2026 19:44
@benrr101
benrr101 dismissed stale reviews from mdaigle and paulmedynski via a1fa63d October 23, 2026 19:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The intentional compatibility removals span core protocol and reader behavior and warrant maintainer sign-off supported by passing regression and integration tests.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@priyankatiwari08
priyankatiwari08 merged commit 2704794 into main Oct 26, 2026
126 checks passed
@priyankatiwari08
priyankatiwari08 deleted the dev/russellben/remove-2005 branch October 26, 2026 10:02
@github-project-automation github-project-automation Bot moved this from Waiting for customer to Done in SqlClient Board Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking Change 🔨 Issues/PRs that are related with breaking API changes in the driver. Code Health 💊 Issues/PRs that are targeted to source code quality improvements.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants