Skip to content

Latest commit

 

History

History
202 lines (157 loc) · 10.7 KB

3.0.0-preview1.md

File metadata and controls

202 lines (157 loc) · 10.7 KB

Release Notes

Microsoft.Data.SqlClient 3.0.0-preview1.21075.2 released 15 March 2021

This update brings the below changes over the previous release:

Breaking Changes over stable release v2.1

  • The minimum supported .NET Framework version has been increased to v4.6.1. .NET Framework v4.6.0 is no longer supported. #899

Added

  • Added support for Configurable Retry Logic #693 #966 Read more
  • Added support for Event counters in .NET Core 3.1+ and .NET Standard 2.1+ #719 Read more
  • Added support for Assembly Context Unloading in .NET Core #913
  • Added missing System.Runtime.Caching dependency for .NET Standard assemblies #877

Fixed

  • Fixed wrong results issues by changing the timeout timer to ensure a correct execution state #906
  • Fixed Kerberos authentication issues when configured Server Principal Name (SPN) didn't contain default port #930
  • Fixed MARS header errors when MakeReadAsyncBlocking App Context switch is set to false #910 #922
  • Fixed unwanted exceptions being thrown from SqlDataReader.Dispose #920
  • Fixed issues connecting to SQL Server instance with instance name specified from Unix environment #870
  • Fixed TCP Keep Alive issues in .NET Core #854
  • Fixed Kerberos Authentication issues caused due to regression #845
  • Fixed issues with System-Assigned Managed Identity in Azure Functions #829
  • Fixed missing error messages in Managed SNI #882
  • Fixed event source trace string issue #940

Changes

  • Changed App Context switch MakeReadAsyncBlocking default to false #937
  • Replaced usage of BinaryFormatter with DataContractSerializer #869
  • Prohibited DtdProcessing on XmlTextReader instance in .NET Core #884
  • Improved performance by reducing memory allocations in SerializeEncodingChar/WriteEncodingChar and some options boxing #785
  • Improved performance by preventing orphaned active packets being GC'ed without clear #888
  • Various performance improvements #889 #900
  • Partial event source tracing improvements in .NET Core #867 #897
  • Changes to share common files between NetFx and NetCore source code #827 #835 #838 #881

New features over stable release v2.1

Configurable Retry Logic

This new feature introduces configurable support for client applications to retry on "transient" or "retriable" errors. Configuration can be done through code or app config files and retry operations can be applied to opening a connection or executing a command. This feature is disabled by default and is currently in preview. To enable this support, client applications must turn on the following safety switch:

AppContext.SetSwitch("Switch.Microsoft.Data.SqlClient.EnableRetryLogic", true);

Once the .NET AppContext switch is enabled, a retry logic policy can be defined for SqlConnection and SqlCommand independently, or together using various customization options.

New public APIs are introduced in SqlConnection and SqlCommand for registering a custom SqlRetryLogicBaseProvider implementation:

public SqlConnection
{
    public SqlRetryLogicBaseProvider RetryLogicProvider;
}

public SqlCommand
{
    public SqlRetryLogicBaseProvider RetryLogicProvider;
}

API Usage examples can be found here: SqlConnection retry sample SqlCommand retry sample Sample for retry logic options

New configuration sections have also been introduced to do the same registration from configuration files, without having to modify existing code:

<section name="SqlConfigurableRetryLogicConnection"
            type="Microsoft.Data.SqlClient.SqlConfigurableRetryConnectionSection, Microsoft.Data.SqlClient"/>

<section name="SqlConfigurableRetryLogicCommand"
            type="Microsoft.Data.SqlClient.SqlConfigurableRetryCommandSection, Microsoft.Data.SqlClient"/>

A simple example of using the new configuration sections in configuration files is below:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="SqlConfigurableRetryLogicConnection"
             type="Microsoft.Data.SqlClient.SqlConfigurableRetryConnectionSection, Microsoft.Data.SqlClient"/>
    <section name="SqlConfigurableRetryLogicCommand"
             type="Microsoft.Data.SqlClient.SqlConfigurableRetryCommandSection, Microsoft.Data.SqlClient"/>

    <section name="AppContextSwitchOverrides"
             type="Microsoft.Data.SqlClient.AppContextSwitchOverridesSection, Microsoft.Data.SqlClient"/>
  </configSections>

  <!--Enable safety switch in .NET Core-->
  <AppContextSwitchOverrides value="Switch.Microsoft.Data.SqlClient.EnableRetryLogic=true"/>

  <!--Retry method for SqlConnection-->
  <SqlConfigurableRetryLogicConnection retryMethod ="CreateFixedRetryProvider" numberOfTries ="3" deltaTime ="00:00:10" maxTime ="00:00:30"
                                    transientErrors="40615" />

  <!--Retry method for SqlCommand containing SELECT queries-->
  <SqlConfigurableRetryLogicCommand retryMethod ="CreateIncrementalRetryProvider" numberOfTries ="5" deltaTime ="00:00:10" maxTime ="00:01:10"
                                    authorizedSqlCondition="\b(SELECT)\b" transientErrors="102, 4060, 0"/>
</configuration>

Alternatively, applications can implement their own provider of the SqlRetryLogicBaseProvider base class, and register it with SqlConnection/SqlCommand.

Event Counters

The following counters are now available for applications targeting .NET Core 3.1+ and .NET Standard 2.1+:

  • HardConnects: The number of physical connections that are being made.
  • HardDisconnects: The number of actual disconnects that are being made.
  • ActiveHardConnections: The number of active physical connections that are being made.
  • SoftConnects: The number of connections acquired from the pool.
  • SoftDisconnects: The number of connections returned to the pool.
  • ActiveSoftConnections: The total number of active pooled connections.
  • NumberOfNonPooledConnections: The total number of non-pooled connections.
  • NumberOfPooledConnections: The total number of pooled connections.
  • NumberOfActiveConnectionPoolGroups: The number of unique connection pool groups.
  • NumberOfInactiveConnectionPoolGroups: The number of unique connection pool groups to be pruned.
  • NumberOfActiveConnectionPools: The number of active connection pools.
  • NumberOfInactiveConnectionPools: The number of inactive connection pools.
  • NumberOfActiveConnections: The number of active connections currently in-use.
  • NumberOfFreeConnections: The number of free connections available for use.
  • NumberOfStasisConnections: The number of active free connections with open transactions.
  • NumberOfReclaimedConnections: The number of connections reclaimed from GC'd external connections.

These counters can be used with .NET Core global CLI tools: dotnet-counters and dotnet-trace in Windows or Linux and PerfView in Windows, using Microsoft.Data.SqlClient.EventSource as the provider name.

dotnet-counters monitor Microsoft.Data.SqlClient.EventSource -p
PerfView /onlyProviders=*Microsoft.Data.SqlClient.EventSource:EventCounterIntervalSec=1 collect

Target Platform Support

  • .NET Framework 4.6.1+ (Windows x86, Windows x64)
  • .NET Core 2.1+ (Windows x86, Windows x64, Windows ARM64, Windows ARM, Linux, macOS)
  • .NET Standard 2.0+ (Windows x86, Windows x64, Windows ARM64, Windows ARM, Linux, macOS)

Dependencies

.NET Framework 4.6.1

  • Microsoft.Data.SqlClient.SNI 2.1.1
  • Microsoft.Identity.Client 4.21.1
  • Microsoft.IdentityModel.Protocols.OpenIdConnect 6.8.0
  • Microsoft.IdentityModel.JsonWebTokens 6.8.0

.NET Core 2.1

  • Microsoft.Data.SqlClient.SNI.runtime 2.1.1
  • Microsoft.Win32.Registry 4.7.0
  • System.Security.Principal.Windows 4.7.0
  • System.Text.Encoding.CodePages 4.7.0
  • System.Diagnostics.DiagnosticSource 4.7.0
  • System.Configuration.ConfigurationManager 4.7.0
  • System.Runtime.Caching 4.7.0
  • Microsoft.Identity.Client 4.21.1
  • Microsoft.IdentityModel.Protocols.OpenIdConnect 6.8.0
  • Microsoft.IdentityModel.JsonWebTokens 6.8.0

.NET Core 3.1

  • Microsoft.Data.SqlClient.SNI.runtime 2.1.1
  • Microsoft.Win32.Registry 4.7.0
  • System.Security.Principal.Windows 4.7.0
  • System.Text.Encoding.CodePages 4.7.0
  • System.Diagnostics.DiagnosticSource 4.7.0
  • System.Configuration.ConfigurationManager 4.7.0
  • System.Runtime.Caching 4.7.0
  • Microsoft.Identity.Client 4.21.1
  • Microsoft.IdentityModel.Protocols.OpenIdConnect 6.8.0
  • Microsoft.IdentityModel.JsonWebTokens 6.8.0

.NET Standard 2.0

  • Microsoft.Data.SqlClient.SNI.runtime 2.1.1
  • Microsoft.Win32.Registry 4.7.0
  • System.Buffers 4.5.1
  • System.Memory 4.5.4
  • System.Security.Principal.Windows 4.7.0
  • System.Text.Encoding.CodePages 4.7.0
  • System.Runtime.Caching 4.7.0
  • Microsoft.Identity.Client 4.21.1
  • Microsoft.IdentityModel.Protocols.OpenIdConnect 6.8.0
  • Microsoft.IdentityModel.JsonWebTokens 6.8.0

.NET Standard 2.1

  • Microsoft.Data.SqlClient.SNI.runtime 2.1.1
  • Microsoft.Win32.Registry 4.7.0
  • System.Buffers 4.5.1
  • System.Memory 4.5.4
  • System.Security.Principal.Windows 4.7.0
  • System.Text.Encoding.CodePages 4.7.0
  • System.Runtime.Caching 4.7.0
  • Microsoft.Identity.Client 4.21.1
  • Microsoft.IdentityModel.Protocols.OpenIdConnect 6.8.0
  • Microsoft.IdentityModel.JsonWebTokens 6.8.0