Repository navigation
Remove Lingering Sql Server 2005 References - #4881
Conversation
…ue and never used anywhere)
…placed with a static class of constants
…nd unnecessary for the purposes.
There was a problem hiding this comment.
🟡 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
paulmedynski
left a comment
There was a problem hiding this comment.
More Copilot findings have sufraced.
Codecov Report❌ Patch coverage is 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Copilot's docs comment is valid |
39baa86
There was a problem hiding this comment.
🔵 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


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:
Breaking Changes
Type System Version=SQL Server 2005connection 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.