This update brings the following changes since the 7.1.0-preview1 release:
Important — package version alignment: Starting with the 7.0.2 release, the
Microsoft.Data.SqlClientdriver and its companion packages share a single aligned version. Preview 2 of the7.1line continues this alignment; the following packages ship together as7.1.0-preview2:
Microsoft.Data.SqlClientMicrosoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProviderMicrosoft.Data.SqlClient.Extensions.AzureMicrosoft.Data.SqlClient.Extensions.AbstractionsMicrosoft.Data.SqlClient.Internal.Logging(
Microsoft.SqlServer.Servercontinues to version independently and remains at1.0.0.)Applications must reference the same versions of
Microsoft.Data.SqlClientand its extensions for best compatibility. In particular, applications that referenceMicrosoft.Data.SqlClient.Extensions.Azuremust upgrade it to7.1.0-preview2when upgradingMicrosoft.Data.SqlClientto7.1.0-preview2.Compatibility guarantee: All aligned assemblies ship with
FileVersion 7.1.0.xandAssemblyVersion 7.0.0.0. TheAssemblyVersionis unchanged from 7.0.2, so upgrading from7.0.2to7.1.0-preview2does not require any new .NET Framework strong-name binding redirects. See the 7.0.2 release notes for the originalAssemblyVersionalignment (the one-time breaking change that raisedAssemblyVersionfrom1.0.0.0to7.0.0.0forExtensions.Azure,Extensions.Abstractions, andInternal.Logging;AzureKeyVaultProviderwas already on7.x).
What Changed:
- Added asynchronous overloads of
SqlConnection.GetSchemathat mirror the existing synchronous shapes and honor a suppliedCancellationToken. The .NET Framework schema code paths were also unified with the .NET Core implementation. (#3005)
Who Benefits:
- Applications that enumerate database metadata (databases, tables, columns, procedures, etc.) as part of a request pipeline can now do so without blocking a thread on synchronous I/O.
Impact:
- New
GetSchemaAsync(...)overloads are additive; existingGetSchema(...)calls are unchanged.
What Changed:
SqlBulkCopycolumn mappings now accept the SQL Graph pseudo-column aliases$node_id,$edge_id,$from_id, and$to_idas destination column names and transparently map them to the underlying physical columns. (#3677)
Who Benefits:
- Applications that bulk-load SQL Graph node or edge tables can now map source fields directly to the friendly graph aliases instead of pre-computing the internal physical column names.
Impact:
- Existing mappings continue to work; if a physical column with the same name as an alias already exists, the physical column keeps priority.
What Changed:
- The
SqlBatchCommand.CommandBehaviorproperty (which existed since batching was introduced but was previously ignored) is now plumbed through the batch execution path so per-command behaviors are honored inside aSqlBatch.SqlBatch.ExecuteReaderalso now respects theCommandBehaviorvalue passed to it. (#4125)
Who Benefits:
- Applications composing heterogeneous batches (for example, mixing
SchemaOnlymetadata queries with data-returning statements) can now express per-command reader behavior without splitting the batch.
Impact:
- Batches that previously set
SqlBatchCommand.CommandBehaviorbut relied on it being ignored will now see that value applied. Batches that left it at the default (CommandBehavior.Default) are unaffected.
What Changed:
- Added a
Connection Idle Timeoutconnection-string keyword and matchingSqlConnectionStringBuilder.IdleTimeoutproperty that let the connection pool evict pooled connections whose idle time exceeds the configured value. The default is300seconds; setting0disables idle expiration, and negative values throwArgumentException. Enforcement is gated on the newSwitch.Microsoft.Data.SqlClient.UseLegacyIdleTimeoutBehaviorAppContext switch, which defaults totrueto preserve historical pooling behavior; set it tofalseto enable idle-timeout enforcement. (#4295)
Who Benefits:
- Applications running against Azure SQL Database and other elastic backends can bound connection idle time to align with server-side session recycling and reduce stale-connection failures.
Impact:
- Default behavior is unchanged: the new keyword is parsed but not enforced until the legacy switch is turned off. When enabled, idle-timeout enforcement applies to the existing connection pool as well.
What Changed:
- Replaced raw
TimeSpantimeouts with a sharedTimeoutTimeracrossSqlConnection.Open[Async], pool acquisition, and physical connection creation, so theConnect Timeoutbudget can be deducted as a request waits in the pool. Introduces a dependency onMicrosoft.Bcl.TimeProvider. Enforcement is gated on the newSwitch.Microsoft.Data.SqlClient.UseOverallConnectTimeoutForPoolWaitAppContext switch, which defaults tofalseto preserve historical behavior; set it totrueto have pool waits count against the caller'sConnect Timeoutbudget. (#4270)
Who Benefits:
- Applications that observe pool contention can opt in via the new switch to have the configured
Connect Timeoutrespected end-to-end instead of the budget effectively restarting when a physical connection is eventually opened.
Impact:
- Default behavior is unchanged: pool waits do not count against
Connect Timeoutunless the new switch is enabled. When enabled,Open/OpenAsyncunder heavy pool contention may surface timeouts sooner than before. Successful opens are unaffected.
- Added the SQL Server 2025
jsondata type to theDataTypescollection returned bySqlConnection.GetSchema. (#3858) - Refactored
SqlConnectioninternal state transitions to useInterlocked.CompareExchangeguards, hardening the driver against races surfaced by concurrent open/close/reconnect. (#4267) - Removed legacy connection-options inheritance from internal APIs, simplifying
TryOpenConnection,TryReplaceConnection, and the pool interfaces. (#4237, #4261, #4235) - Refactored
ForceNewConnectionhandling. (#4415) - Added Async generic helpers to reduce duplication across sync/async code paths. (#4334)
- Use hardcoded LCID mappings when decoding strings, avoiding repeated culture lookups. (#4212)
- Reduced allocations by avoiding lock acquisition on
SqlErrorCollectioncounters when no errors exist, and by avoiding stack-trace materialization for expectednull-return paths. (#4157, #4099, #4102) - Improved
EnclaveDiffieHellmanInfo.Sizeaccuracy. (#4346) SqlVector<float>now serializes and deserializes little-endian multibyte values explicitly for consistent behavior across architectures. (#3861)- Updated the bundled .NET 10 SDK to
10.0.300. (#4287)
- Fixed a
NullReferenceExceptioninSqlCommand.Cancel()when the active connection has already been torn down. (#4372) - Fixed Always Encrypted column master key signature verification incorrectly reusing cached results after a prior verification failure. (#4339)
- Fixed missing bounds checks on TDS token and feature-extension-acknowledgment data lengths that could allow a spoofing server to trigger unbounded allocations. (#4340)
- Fixed
SqlBulkCopyfailing in least-privilege environments where the caller lacks permission to run the previous metadata query path. (#4306) - Fixed Always Encrypted reads of
CekMdVersionandEkValueCountto align with the TDS specification. (#4240) - Fixed
LoginWithFailoverto validate parser state before continuing, preventing null-reference failures during failover login. (#4140) - Fixed the SPN used during login to use the resolved port instead of the instance name when
Protocol=NoneorProtocol=Adminis specified. (#4180) - Fixed a race in
SqlConnection.TryOpenInnerthat could surface asInvalidCastException; the same race now returns a deterministicInvalidOperationException. (#4179) - Fixed several
CancellationTokenSourceleaks inSqlDataReader,SqlConnection,SqlCommandreconnect paths, and the sequential-stream helpers. (#4009) - Documentation fix for server certificate configuration. (#4408)
What Changed:
- Removed dead protocol-level code paths for SQL Server 7.0 and SQL Server 2000, along with the now-orphaned
SQL Server 2000type-system compatibility option. TheTypeSystem.SQLServer2000enum value and theType System Version=SQL Server 2000connection-string branch are gone. (#4015)
Who Benefits:
- The driver no longer carries dead legacy code, and the documented connection-string surface (
Latest,SQL Server 2005,SQL Server 2008,SQL Server 2012) now matches the implementation exactly.
Impact:
- Breaking: A connection string that specifies
Type System Version=SQL Server 2000now throwsArgumentExceptionwhen the connection is opened, instead of being accepted. Applications currently using this value should switch to a supported value such asLatest. There is no change to which servers the driver will connect to — SQL Server 7.0 and 2000 were already rejected during login version negotiation.
- .NET Framework 4.6.2+ (Windows x86, Windows x64, Windows ARM64)
- .NET 8.0+ (Windows x86, Windows x64, Windows ARM, Windows ARM64, Linux, macOS)
- Microsoft.Bcl.Cryptography 9.0.13
- Microsoft.Data.SqlClient.Extensions.Abstractions 7.1.0-preview2
- Microsoft.Data.SqlClient.Internal.Logging 7.1.0-preview2
- Microsoft.Data.SqlClient.SNI.runtime 6.0.2
- Microsoft.Extensions.Caching.Memory 9.0.13
- Microsoft.IdentityModel.JsonWebTokens 8.16.0
- Microsoft.IdentityModel.Protocols.OpenIdConnect 8.16.0
- Microsoft.SqlServer.Server 1.0.0
- System.Configuration.ConfigurationManager 9.0.13
- System.Security.Cryptography.Pkcs 9.0.13
- Microsoft.Bcl.Cryptography 8.0.0
- Microsoft.Data.SqlClient.Extensions.Abstractions 7.1.0-preview2
- Microsoft.Data.SqlClient.Internal.Logging 7.1.0-preview2
- Microsoft.Data.SqlClient.SNI.runtime 6.0.2
- Microsoft.Extensions.Caching.Memory 8.0.1
- Microsoft.IdentityModel.JsonWebTokens 8.16.0
- Microsoft.IdentityModel.Protocols.OpenIdConnect 8.16.0
- Microsoft.SqlServer.Server 1.0.0
- System.Configuration.ConfigurationManager 8.0.1
- System.Security.Cryptography.Pkcs 8.0.1
- Microsoft.Bcl.Cryptography 8.0.0
- Microsoft.Bcl.TimeProvider 8.0.1
- Microsoft.Data.SqlClient.Extensions.Abstractions 7.1.0-preview2
- Microsoft.Data.SqlClient.Internal.Logging 7.1.0-preview2
- Microsoft.Data.SqlClient.SNI.runtime 6.0.2
- Microsoft.Extensions.Caching.Memory 8.0.1
- Microsoft.IdentityModel.JsonWebTokens 8.16.0
- Microsoft.IdentityModel.Protocols.OpenIdConnect 8.16.0
- Microsoft.SqlServer.Server 1.0.0
- System.Configuration.ConfigurationManager 8.0.1
- System.Security.Cryptography.Pkcs 8.0.1
- System.Text.Json 10.0.3
- System.Threading.Channels 10.0.3
- Microsoft.Bcl.Cryptography 8.0.0
- Microsoft.Bcl.TimeProvider 8.0.1
- Microsoft.Data.SqlClient.Extensions.Abstractions 7.1.0-preview2
- Microsoft.Data.SqlClient.Internal.Logging 7.1.0-preview2
- Microsoft.Data.SqlClient.SNI 6.0.2
- Microsoft.Extensions.Caching.Memory 8.0.1
- Microsoft.IdentityModel.JsonWebTokens 8.16.0
- Microsoft.IdentityModel.Protocols.OpenIdConnect 8.16.0
- System.Buffers 4.6.1
- System.Data.Common 4.3.0
- System.Diagnostics.DiagnosticSource 10.0.3
- System.Memory 4.6.3
- System.Runtime.InteropServices.RuntimeInformation 4.3.0
- System.Security.Cryptography.Pkcs 8.0.1
- System.Text.Json 10.0.3
- System.Threading.Channels 10.0.3
- System.ValueTuple 4.6.2