diff --git a/.config/CredScanSuppressions.json b/.config/CredScanSuppressions.json
new file mode 100644
index 0000000000..ffc7e87789
--- /dev/null
+++ b/.config/CredScanSuppressions.json
@@ -0,0 +1,25 @@
+{
+ "tool": "Credential Scanner",
+ "suppressions": [
+ {
+ "file": "src/Microsoft.Data.SqlClient/tests/Docker/DockerLinuxTest/Program.cs",
+ "justification": "Test projects should be skipped"
+ },
+ {
+ "file": "src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.Servers/TDSServerArguments.cs",
+ "justification": "Test projects should be skipped"
+ },
+ {
+ "file": "src/Microsoft.Data.SqlClient/tests/tools/TDS/TDS.Servers/TdsServerCertificate.pfx",
+ "justification": "Test projects should be skipped"
+ },
+ {
+ "file": "src/docker-compose.yml",
+ "justification": "Docker test project should be excluded"
+ },
+ {
+ "file": "doc/samples/SqlConnectionStringBuilder.cs",
+ "justification": "Documentation could include sample data and can be ignored"
+ }
+ ]
+}
diff --git a/.config/PolicheckExclusions.xml b/.config/PolicheckExclusions.xml
new file mode 100644
index 0000000000..d8c47d335d
--- /dev/null
+++ b/.config/PolicheckExclusions.xml
@@ -0,0 +1,5 @@
+
+ SRC/MICROSOFT.DATA.SQLCLIENT/TESTS
+ .YML|.MD|.SQL
+ NOTICE.TXT
+
\ No newline at end of file
diff --git a/.config/tsaoptions.json b/.config/tsaoptions.json
new file mode 100644
index 0000000000..077ef21c76
--- /dev/null
+++ b/.config/tsaoptions.json
@@ -0,0 +1,14 @@
+{
+ "instanceUrl": "https://sqlclientdrivers.visualstudio.com/",
+ "projectName": "ADO.Net",
+ "areaPath": "ADO.Net",
+ "iterationPath": "ADO.Net\\TSA\\SqlClient",
+ "notificationAliases": [ "SqlClient@microsoft.com" ],
+ "repositoryName": "SqlClient",
+ "codebaseName": "SqlClient",
+ "allTools": true,
+ "template": "MSDATA_RevolutionR_Overloaded0",
+ "language": "csharp",
+ "includePathPatterns": "src/Microsoft.Data.SqlClient/*, src/Microsoft.SqlServer.Server/*, tools/*",
+ "excludePathPatterns": "src/Microsoft.Data.SqlClient/tests/*"
+}
diff --git a/BUILDGUIDE.md b/BUILDGUIDE.md
index 47cacc9fb7..8b2c950997 100644
--- a/BUILDGUIDE.md
+++ b/BUILDGUIDE.md
@@ -165,7 +165,6 @@ Manual Tests require the below setup to run:
|TCPConnectionString | Connection String for a TCP enabled SQL Server instance. | `Server={servername};Database={Database_Name};Trusted_Connection=True;`
OR `Data Source={servername};Initial Catalog={Database_Name};Integrated Security=True;`|
|NPConnectionString | Connection String for a Named Pipes enabled SQL Server instance.| `Server=\\{servername}\pipe\sql\query;Database={Database_Name};Trusted_Connection=True;`
OR
`Data Source=np:{servername};Initial Catalog={Database_Name};Integrated Security=True;`|
|TCPConnectionStringHGSVBS | (Optional) Connection String for a TCP enabled SQL Server with Host Guardian Service (HGS) attestation protocol configuration. | `Server=tcp:{servername}; Database={Database_Name}; UID={UID}; PWD={PWD}; Attestation Protocol = HGS; Enclave Attestation Url = {AttestationURL};`|
- |TCPConnectionStringAASVBS | (Optional) Connection String for a TCP enabled SQL Server with a VBS Enclave and using Microsoft Azure Attestation (AAS) attestation protocol configuration. | `Server=tcp:{servername}; Database={Database_Name}; UID={UID}; PWD={PWD}; Attestation Protocol = AAS; Enclave Attestation Url = {AttestationURL};`|
|TCPConnectionStringNoneVBS | (Optional) Connection String for a TCP enabled SQL Server with a VBS Enclave and using None Attestation protocol configuration. | `Server=tcp:{servername}; Database={Database_Name}; UID={UID}; PWD={PWD}; Attestation Protocol = NONE;`|
|TCPConnectionStringAASSGX | (Optional) Connection String for a TCP enabled SQL Server with a SGX Enclave and using Microsoft Azure Attestation (AAS) attestation protocol configuration. | `Server=tcp:{servername}; Database={Database_Name}; UID={UID}; PWD={PWD}; Attestation Protocol = AAS; Enclave Attestation Url = {AttestationURL};`|
|EnclaveEnabled | Enables tests requiring an enclave-configured server.|
@@ -176,8 +175,6 @@ Manual Tests require the below setup to run:
|AADSecurePrincipalSecret | (Optional) A Secret defined for a registered application which has been granted permission to the database defined in the AADPasswordConnectionString. | {Secret} |
|AzureKeyVaultURL | (Optional) Azure Key Vault Identifier URL | `https://{keyvaultname}.vault.azure.net/` |
|AzureKeyVaultTenantId | (Optional) The Azure Active Directory tenant (directory) Id of the service principal. | _{Tenant ID of Active Directory}_ |
- |AzureKeyVaultClientId | (Optional) "Application (client) ID" of an Active Directory registered application, granted access to the Azure Key Vault specified in `AZURE_KEY_VAULT_URL`. Requires the key permissions Get, List, Import, Decrypt, Encrypt, Unwrap, Wrap, Verify, and Sign. | _{Client Application ID}_ |
- |AzureKeyVaultClientSecret | (Optional) "Client Secret" of the Active Directory registered application, granted access to the Azure Key Vault specified in `AZURE_KEY_VAULT_URL` | _{Client Application Secret}_ |
|SupportsIntegratedSecurity | (Optional) Whether or not the USER running tests has integrated security access to the target SQL Server.| `true` OR `false`|
|LocalDbAppName | (Optional) If Local Db Testing is supported, this property configures the name of Local DB App instance available in client environment. Empty string value disables Local Db testing. | Name of Local Db App to connect to.|
|LocalDbSharedInstanceName | (Optional) If LocalDB testing is supported and the instance is shared, this property configures the name of the shared instance of LocalDB to connect to. | Name of shared instance of LocalDB. |
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 129ca46b22..674ab87826 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,108 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
+# Release Notes
+
+## [Stable release 5.1.7] - 2025-04-25
+
+This update brings the following changes since the 5.1.6 release:
+
+### Fixed
+
+- Fixed possible `NullPointerException` during socket receive (PR [#3285](https://github.com/dotnet/SqlClient/pull/3285))
+- Fixed inconsistencies between source and reference projects (PR [#3180](https://github.com/dotnet/SqlClient/pull/3180))
+
+### Changed
+
+- Updated the following dependencies:
+ - [Microsoft.Data.SqlClient.SNI](https://www.nuget.org/packages/Microsoft.Data.SqlClient.SNI/5.1.2) 5.1.1 to 5.1.2 for .NET Framework on Windows (PR [#3294](https://github.com/dotnet/SqlClient/pull/3294))
+ - [Microsoft.Data.SqlClient.SNI.runtime](https://www.nuget.org/packages/Microsoft.Data.SqlClient.SNI.runtime/5.1.2) 5.1.1 to 5.1.2 for .NET on Windows (PR [#3294](https://github.com/dotnet/SqlClient/pull/3294))
+ - [Microsoft.Extensions.Caching.Memory](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Memory/6.0.3) 6.0.1 to 6.0.3 - Avoid [CVE-2024-43483](https://github.com/advisories/GHSA-qj66-m88j-hmgj) (PR [#3068](https://github.com/dotnet/SqlClient/pull/3068))
+ - [Microsoft.Extensions.Hosting](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/6.0.1) 6.0.0 to 6.0.1 - Avoid transitive dependency on vulnerable [System.Text.Json](https://www.nuget.org/packages/System.Text.Json/6.0.0) 6.0.0 (PR [#3207](https://github.com/dotnet/SqlClient/pull/3207))
+ - [System.Private.Uri](https://www.nuget.org/packages/System.Private.Uri) 4.3.2 - Avoid transitive [CVE-2019-0820](https://msrc.microsoft.com/update-guide/en-US/advisory/CVE-2019-0820) (PR [#3077](https://github.com/dotnet/SqlClient/pull/3077))
+ - [System.Text.Encodings.Web](https://www.nuget.org/packages/System.Text.Encodings.Web/6.0.1) 6.0.0 to 6.0.1 - Avoid transitive downgrade for .NET Framework targets (PR [#3279](https://github.com/dotnet/SqlClient/pull/3279))
+ - [System.Text.Json](https://www.nuget.org/packages/System.Text.Json/6.0.11) 6.0.11 - Avoid transitive dependencies on older vulnerable versions for .NET Framework targets (PR [#3279](https://github.com/dotnet/SqlClient/pull/3279))
+
+## [Stable release 5.1.6] - 2024-08-27
+
+### Fixed
+
+- Fixed Transient fault handling issue with `OpenAsync`. [#1983](https://github.com/dotnet/SqlClient/pull/1983) [#2508](https://github.com/dotnet/SqlClient/pull/2508)
+- Fixed `AcquireTokenAsync` timeout handling for edge cases in `ActiveDirectoryAuthenticationProvider`. [#2706](https://github.com/dotnet/SqlClient/pull/2706)
+- Fixed pending data with `SqlDataReader` against an encrypted column. [#2618](https://github.com/dotnet/SqlClient/pull/2618) [#2818](https://github.com/dotnet/SqlClient/pull/2818)
+
+### Changed
+
+- Upgraded `Azure.Identity` version from 1.11.3 to 1.11.4 [#2649] (https://github.com/dotnet/SqlClient/pull/2649) [#2529] (https://github.com/dotnet/SqlClient/pull/2529) to address [CVE-2024-35255](https://github.com/advisories/GHSA-m5vv-6r4h-3vj9).
+- Upgraded `Microsoft.Identity.Client` version from 4.60.0 to 4.61.3 [#2649] (https://github.com/dotnet/SqlClient/pull/2649) [#2529] (https://github.com/dotnet/SqlClient/pull/2529) to address [CVE-2024-35255](https://github.com/advisories/GHSA-m5vv-6r4h-3vj9).
+- Added caching to `TokenCredential` objects to take advantage of token caching. [#2776](https://github.com/dotnet/SqlClient/pull/2776)
+- Code health improvements: [#2490] (https://github.com/dotnet/SqlClient/pull/2490)
+
+## [Stable release 5.1.5] - 2024-01-29
+
+This update brings the below changes over the previous release:
+
+### Fixed
+
+- Fixed connection to unsubscribe from transaction completion events before returning it to the connection pool [#2321](https://github.com/dotnet/SqlClient/pull/2321)
+- Fixed InvalidCastException when reading an Always Encrypted date or time column [#2324](https://github.com/dotnet/SqlClient/pull/2324)
+
+### Changed
+
+- Changed Microsoft.IdentityModel.JsonWebTokens and Microsoft.IdentityModel.Protocols.OpenIdConnect version 6.24.0 to 6.35.0 [#2320](https://github.com/dotnet/SqlClient/pull/2320) to address [CVE-2024-21319](https://www.cve.org/CVERecord?id=CVE-2024-21319)
+
+## [Stable release 5.1.4] - 2024-01-09
+
+This update brings the below changes over the previous release:
+
+### Fixed
+
+- Fixed a deadlock problem for distributed transactions when on .NET.
+
+### Changed
+
+- Upgraded `Azure.Identity` dependency version to [1.10.3](https://www.nuget.org/packages/Azure.Identity/1.10.3) to address [CVE-2023-36414](https://github.com/advisories/GHSA-5mfx-4wcx-rv27).
+
+## [Stable release 5.1.3] - 2024-01-09
+
+This update brings the below changes over the previous release:
+
+### Fixed
+
+- Fixed encryption downgrade issue. [CVE-2024-0056](https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-0056)
+- Fixed certificate chain validation logic flow.
+
+## [Stable release 5.1.2] - 2023-10-26
+
+This update brings the below changes over the previous release:
+
+### Fixed
+
+- Fixed access violation when using SQL Express user instance. [#2101](https://github.com/dotnet/SqlClient/pull/2101)
+- Fixed Always Encrypted secure enclave retry logic for async queries. [#1988](https://github.com/dotnet/SqlClient/pull/1988)
+- Fixed LocalDb and managed SNI by improving the error messages and avoid falling back to the local service. [#2129](https://github.com/dotnet/SqlClient/pull/2129)
+- Fixed .NET and .NET Standard file version. [2093](https://github.com/dotnet/SqlClient/pull/2093)
+- Fixed non-string values and `SqlConnectionStringBuilder` property indexer issue. [#2018](https://github.com/dotnet/SqlClient/pull/2018)
+- Fixed `SqlConnectionEncryptOption` type conversion by introducing the `SqlConnectionEncryptOptionConverter` attribute when using **appsettings.json** files. [#2057](https://github.com/dotnet/SqlClient/pull/2057)
+- Fixed Transient fault handling issue with `OpenAsync`. [#1983](https://github.com/dotnet/SqlClient/pull/1983)
+- Fixed activity correlator to continue use of same GUID for connection activity. [#1997](https://github.com/dotnet/SqlClient/pull/1997)
+
+### Changed
+
+- Updated `Microsoft.Data.SqlClient.SNI` (.NET Framework dependency) and `Microsoft.Data.SqlClient.SNI.runtime` (.NET Core/Standard dependency) version to `5.1.1`. [#2123](https://github.com/dotnet/SqlClient/pull/2123)
+
+## [Stable release 5.1.1] - 2023-03-28
+
+This update brings the below changes over the previous release:
+
+### Fixed
+
+- Fixed an incorrect exception when a symmetric key fails to decrypt a column using Always Encrypted. [#1968](https://github.com/dotnet/SqlClient/pull/1968)
+- Fixed `TransactionScope` connection issue when `Enlist` is `enabled`, `Pooling` is `disabled`, and `Network Connection Type` is set to `Redirect`. [#1967](https://github.com/dotnet/SqlClient/pull/1967)
+- Fixed throttling of token requests by calling `AcquireTokenSilent`. [#1966](https://github.com/dotnet/SqlClient/pull/1966)
+- Fixed TDS RPC error on large queries in `SqlCommand.ExecuteReaderAsync`. [#1965](https://github.com/dotnet/SqlClient/pull/1965)
+- Fixed `NullReferenceException` in `GetBytesAsync`. [#1964](https://github.com/dotnet/SqlClient/pull/1964)
+
## [Stable release 5.1.0] - 2023-01-19
This update brings the below changes over the previous release:
diff --git a/src/NuGet.config b/NuGet.config
similarity index 67%
rename from src/NuGet.config
rename to NuGet.config
index 5832a9da27..4f39716bf4 100644
--- a/src/NuGet.config
+++ b/NuGet.config
@@ -4,4 +4,8 @@
+
+
+
+
diff --git a/build.proj b/build.proj
index 1b3372bc95..1f295abc94 100644
--- a/build.proj
+++ b/build.proj
@@ -105,7 +105,7 @@
- $(DotNetCmd) dotnet build -c Release -p:ReferenceType=$(ReferenceType)"
+ $(DotNetCmd) dotnet build -c Release -p:ReferenceType=$(ReferenceType)
diff --git a/doc/samples/SqlConnectionStringBuilder.cs b/doc/samples/SqlConnectionStringBuilder.cs
index f1c3252880..d1d22254f1 100644
--- a/doc/samples/SqlConnectionStringBuilder.cs
+++ b/doc/samples/SqlConnectionStringBuilder.cs
@@ -21,12 +21,12 @@ static void Main()
// connection string, and you can retrieve and
// modify any of the elements.
builder.ConnectionString = "server=(local);user id=ab;" +
- "password= a!Pass113;initial catalog=AdventureWorks";
+ "password=********;initial catalog=AdventureWorks";
// Now that the connection string has been parsed,
// you can work with individual items.
Console.WriteLine(builder.Password);
- builder.Password = "new@1Password";
+ builder.Password = "********";
// You can refer to connection keys using strings,
// as well. When you use this technique (the default
diff --git a/doc/samples/SqlConnectionStringBuilder3.cs b/doc/samples/SqlConnectionStringBuilder3.cs
index 3e0c253039..fc691489fe 100644
--- a/doc/samples/SqlConnectionStringBuilder3.cs
+++ b/doc/samples/SqlConnectionStringBuilder3.cs
@@ -10,7 +10,7 @@ static void Main()
try
{
string connectString =
- "Server=(local);Database=AdventureWorks;UID=ab;Pwd= a!Pass@@";
+ "Server=(local);Database=AdventureWorks;UID=ab;Pwd=********";
Console.WriteLine("Original: " + connectString);
SqlConnectionStringBuilder builder =
new SqlConnectionStringBuilder(connectString);
diff --git a/doc/samples/SqlConnectionStringBuilder_IntegratedSecurity.cs b/doc/samples/SqlConnectionStringBuilder_IntegratedSecurity.cs
index 693298dd35..b2e6773559 100644
--- a/doc/samples/SqlConnectionStringBuilder_IntegratedSecurity.cs
+++ b/doc/samples/SqlConnectionStringBuilder_IntegratedSecurity.cs
@@ -10,7 +10,7 @@ static void Main()
try
{
string connectString =
- "Data Source=(local);User ID=ab;Password=MyPassword;" +
+ "Data Source=(local);User ID=ab;Password=********;" +
"Initial Catalog=AdventureWorks";
SqlConnectionStringBuilder builder =
diff --git a/doc/samples/SqlConnectionStringBuilder_Remove.cs b/doc/samples/SqlConnectionStringBuilder_Remove.cs
index 7de94386a1..835b8906c3 100644
--- a/doc/samples/SqlConnectionStringBuilder_Remove.cs
+++ b/doc/samples/SqlConnectionStringBuilder_Remove.cs
@@ -10,7 +10,7 @@ static void Main()
try
{
string connectString =
- "Data Source=(local);User ID=ab;Password= a1Pass@@11;" +
+ "Data Source=(local);User ID=ab;Password=********;" +
"Initial Catalog=AdventureWorks";
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(connectString);
diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionEnclaveProvider.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionEnclaveProvider.xml
index 261f5e57ed..dfbdbe8782 100644
--- a/doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionEnclaveProvider.xml
+++ b/doc/snippets/Microsoft.Data.SqlClient/SqlColumnEncryptionEnclaveProvider.xml
@@ -20,8 +20,8 @@ the enclave attestation protocol as well as the logic for creating and caching e
The information the provider uses to attest the enclave and generate a symmetric key for the session. The format of this information is specific to the enclave attestation protocol.
A Diffie-Hellman algorithm object that encapsulates a client-side key pair.
The set of parameters required for an enclave session.
- The set of extra data needed for attestating the enclave.
- The length of the extra data needed for attestating the enclave.
+ The set of extra data needed for attesting the enclave.
+ The length of the extra data needed for attesting the enclave.
The requested enclave session or if the provider doesn't implement session caching.
A counter that the enclave provider is expected to increment each time SqlClient retrieves the session from the cache. The purpose of this field is to prevent replay attacks.
When overridden in a derived class, performs enclave attestation, generates a symmetric key for the session, creates a an enclave session and stores the session information in the cache.
@@ -29,8 +29,8 @@ the enclave attestation protocol as well as the logic for creating and caching e
The endpoint of an attestation service for attesting the enclave.
- A set of extra data needed for attestating the enclave.
- The length of the extra data needed for attestating the enclave.
+ A set of extra data needed for attesting the enclave.
+ The length of the extra data needed for attesting the enclave.
Gets the information that SqlClient subsequently uses to initiate the process of attesting the enclave and to establish a secure session with the enclave.
The information SqlClient subsequently uses to initiate the process of attesting the enclave and to establish a secure session with the enclave.
To be added.
@@ -38,10 +38,11 @@ the enclave attestation protocol as well as the logic for creating and caching e
The set of parameters required for enclave session.
to indicate that a set of extra data needs to be generated for attestation; otherwise, .
+ Indicates if this is a retry from a failed call.
When this method returns, the requested enclave session or if the provider doesn't implement session caching. This parameter is treated as uninitialized.
A counter that the enclave provider is expected to increment each time SqlClient retrieves the session from the cache. The purpose of this field is to prevent replay attacks.
- A set of extra data needed for attestating the enclave.
- The length of the extra data needed for attestating the enclave.
+ A set of extra data needed for attesting the enclave.
+ The length of the extra data needed for attesting the enclave.
When overridden in a derived class, looks up an existing enclave session information in the enclave session cache. If the enclave provider doesn't implement enclave session caching, this method is expected to return in the parameter.
To be added.
diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml
index 82f7aa8ec9..6bb436390f 100644
--- a/doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml
+++ b/doc/snippets/Microsoft.Data.SqlClient/SqlConnectionStringBuilder.xml
@@ -839,7 +839,7 @@ Connections are considered the same if they have the same connection string. Dif
The example displays the following text in the console window:
```
-Original: Data Source=(local);Initial Catalog=AdventureWorks;User ID=ab;Password= a1Pass@@11
+Original: Data Source=(local);Initial Catalog=AdventureWorks;User ID=ab;Password=********
Modified: Data Source=(local);Initial Catalog=AdventureWorks;Integrated Security=True
Database = AdventureWorks
```
diff --git a/eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml b/eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml
new file mode 100644
index 0000000000..43109253dc
--- /dev/null
+++ b/eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml
@@ -0,0 +1,72 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+parameters:
+ - name: symbolsFolder
+ type: string
+ default: symbols
+
+ - name: softwareFolder
+ type: string
+ default: software
+
+ - name: publishSymbols
+ type: boolean
+
+jobs:
+- job: build_signed_akv_package
+ displayName: 'Build Signed AKV Provider Package'
+ pool:
+ type: windows # read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs
+
+ variables:
+ - template: ../../../libraries/variables.yml@self
+ - name: PublishSymbols
+ value: ${{ parameters['PublishSymbols'] }}
+
+ steps:
+ - script: SET
+ displayName: 'Print Environment Variables'
+
+ - template: ../steps/build-all-configurations-signed-dlls-step.yml@self
+ parameters:
+ product: AKV
+ nugetPackageRefVersion: $(MDS_PackageRef_Version)
+ AssemblyFileVersion: $(AKVAssemblyFileVersion)
+
+ - template: ../steps/code-analyze-step.yml@self
+ parameters:
+ analyzeType: all
+ product: AKV
+ nugetPackageRefVersion: $(MDS_PackageRef_Version)
+
+ - template: ../steps/esrp-code-signing-step.yml@self
+ parameters:
+ artifactType: dll
+
+ - template: ../steps/generate-nuget-package-step.yml@self
+ parameters:
+ OutputDirectory: $(artifactDirectory)
+ nuspecPath: ${{variables.akvNuspecPath }}
+ NugetPackageVersion: ${{variables.AKVNuGetPackageVersion }}
+ referenceType: package
+
+ - template: ../steps/esrp-code-signing-step.yml@self
+ parameters:
+ artifactType: pkg
+
+ - template: ../steps/copy-dlls-for-test-step.yml@self
+ parameters:
+ product: AKV
+ referenceType: package
+
+ # Publish symbols to servers
+ - template: ../steps/publish-symbols-step.yml@self
+ parameters:
+ referenceType: package
+ symbolsVersion: ${{variables.AKVNuGetPackageVersion }}
+ product: AKV
+ publishSymbols: ${{ parameters['PublishSymbols'] }}
+ symbolsArtifactName: akv_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_$(NuGetPackageVersion)_$(System.TimelineId)
diff --git a/eng/pipelines/common/templates/jobs/build-signed-package-job.yml b/eng/pipelines/common/templates/jobs/build-signed-package-job.yml
new file mode 100644
index 0000000000..bfd392b186
--- /dev/null
+++ b/eng/pipelines/common/templates/jobs/build-signed-package-job.yml
@@ -0,0 +1,61 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+parameters:
+ - name: symbolsFolder
+ type: string
+ default: symbols
+
+ - name: softwareFolder
+ type: string
+ default: software
+
+ - name: publishSymbols
+ type: boolean
+
+jobs:
+- job: build_signed_package
+ displayName: 'Build Signed MDS Package'
+ pool:
+ type: windows # read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs
+
+ variables:
+ - template: ../../../libraries/variables.yml@self
+
+ steps:
+ - script: SET
+ displayName: 'Print Environment Variables'
+
+ - powershell: |
+ Write-Host "##vso[task.setvariable variable=CDP_BUILD_TYPE_COPY;isOutput=true]$($env:CDP_BUILD_TYPE)"
+ name: GetBuildType
+
+ - template: ../steps/build-all-configurations-signed-dlls-step.yml@self
+
+ - template: ../steps/code-analyze-step.yml@self
+ parameters:
+ analyzeType: all
+
+ - template: ../steps/esrp-code-signing-step.yml@self
+ parameters:
+ artifactType: dll
+
+ - template: ../steps/generate-nuget-package-step.yml@self
+ parameters:
+ OutputDirectory: $(artifactDirectory)
+
+ - template: ../steps/esrp-code-signing-step.yml@self
+ parameters:
+ artifactType: pkg
+
+ - template: ../steps/copy-dlls-for-test-step.yml@self
+ parameters:
+ product: MDS
+
+ # Publish symbols to servers
+ - template: ../steps/publish-symbols-step.yml@self
+ parameters:
+ publishSymbols: ${{ parameters['PublishSymbols'] }}
+ symbolsArtifactName: mds_symbols_$(System.TeamProject)_$(Build.Repository.Name)_$(Build.SourceBranchName)_$(NuGetPackageVersion)_$(System.TimelineId)
diff --git a/eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml b/eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml
new file mode 100644
index 0000000000..a9fcd12720
--- /dev/null
+++ b/eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml
@@ -0,0 +1,59 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+parameters:
+ - name: downloadPackageStep
+ type: step
+ default:
+ script: echo
+
+ - name: packageFolderName
+ type: string
+ default: drop_build_build_signed_package
+
+ - name: dependsOn
+ type: string
+ default: empty
+
+jobs:
+- job: run_tests_package_reference
+ displayName: 'Run tests with package reference'
+ ${{ if ne(parameters.dependsOn, 'empty')}}:
+ dependsOn: '${{parameters.dependsOn }}'
+ pool:
+ type: windows # read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs
+ isCustom: true
+ name: ADO-1ES-Pool
+ vmImage: 'ADO-MMS22-SQL19'
+
+ variables: # More settings at https://aka.ms/obpipelines/yaml/jobs
+ - template: ../../../libraries/mds-validation-variables.yml@self
+
+ steps:
+ - template: ../steps/pre-build-step.yml
+
+ - ${{parameters.downloadPackageStep }}
+
+ - template: ../steps/update-nuget-config-local-feed-step.yml
+ parameters:
+ downloadedNugetPath: $(Pipeline.Workspace)\${{parameters.packageFolderName }}
+
+ - template: ../steps/update-config-file-step.yml
+ parameters:
+ TCPConnectionString: $(SQL_TCP_CONN_STRING)
+ NPConnectionString: $(SQL_NP_CONN_STRING)
+ SupportsIntegratedSecurity: false
+
+ - template: ../steps/prepare-test-db-step.yml
+
+# build & test
+ - template: ../steps/build-and-run-tests-netfx-step.yml
+ parameters:
+ referenceType: Package
+
+ - template: ../steps/build-and-run-tests-netcore-step.yml
+ parameters:
+ referenceType: Package
+ cleanFirst: true
diff --git a/eng/pipelines/common/templates/jobs/validate-signed-package-job.yml b/eng/pipelines/common/templates/jobs/validate-signed-package-job.yml
new file mode 100644
index 0000000000..1439aa1bb1
--- /dev/null
+++ b/eng/pipelines/common/templates/jobs/validate-signed-package-job.yml
@@ -0,0 +1,337 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+parameters:
+ - name: downloadPackageStep
+ type: step
+ default:
+ script: echo
+
+ - name: packageFolderName
+ type: string
+ default: drop_build_build_signed_package
+
+ - name: dependsOn
+ type: string
+ default: ''
+
+ - name: packageType
+ type: string
+ default: both
+ values:
+ - dll
+ - pdb
+ - both
+
+ - name: assembly_file_version_netfx
+ type: string
+ default: $(AssemblyFileVersion)
+
+ - name: assembly_file_version_core
+ type: string
+ default: $(AssemblyFileVersion)
+
+ - name: current_netfx_target_framework
+ type: string
+ default: $(CurrentNetFxVersion)
+
+jobs:
+- job: validate_signed_package
+ displayName: 'Verify signed package'
+ ${{ if ne(parameters.dependsOn, '')}}:
+ dependsOn: '${{parameters.dependsOn }}'
+ pool:
+ type: windows # read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs
+ isCustom: true
+ name: ADO-1ES-Pool
+ vmImage: 'ADO-MMS22-SQL19'
+
+ variables: # More settings at https://aka.ms/obpipelines/yaml/jobs
+ - template: ../../../libraries/mds-validation-variables.yml@self
+
+ - name: pathToDownloadedNuget # path to the downloaded nuget files
+ value: $(Pipeline.Workspace)\${{parameters.packageFolderName }}
+
+ - name: BuildType
+ value: $[ stageDependencies.buildMDS.build_signed_package.outputs['GetBuildType.CDP_BUILD_TYPE_COPY'] ]
+
+ steps:
+ - script: SET
+ displayName: 'Print Environment Variables'
+
+ - task: NuGetToolInstaller@1
+ displayName: 'Use NuGet'
+
+ - powershell: |
+ #Sets Variables for AssemblyFileVersion, AssemblyVersion and NugetPackageVersion
+
+ [Xml] $versionprops = Get-Content -Path ".\tools\props\Versions.props"
+ Write-Host $versionprops.Project.PropertyGroup[0].AssemblyFileVersion
+
+ $AssemblyVersion = $versionprops.Project.PropertyGroup[0].AssemblyVersion
+
+ Write-Host "##vso[task.setvariable variable=ASSEMBLY_VERSION;]$AssemblyVersion"
+ displayName: 'Update assembly version property'
+
+ - powershell: |
+ # Displays the paths of all the local cache directories
+ nuget locals all -List
+
+ #Clears all files from all local cache directories
+ nuget locals all -Clear
+ displayName: 'Clear local cache'
+
+ - ${{parameters.downloadPackageStep }}
+
+ - powershell: |
+ # Install nuget package
+ Install-Package -Name "Microsoft.Data.SqlClient" -Destination "$(TempFolderName)" -Force -Source $(pathToDownloadedNuget) -SkipDependencies
+
+ Write-Host "--------------------------------------------------"
+ Write-Host '$(TempFolderName)'
+ ls $(TempFolderName)
+ Write-Host "--------------------------------------------------"
+ displayName: 'Extract Nuget in temp folder'
+
+ - powershell: |
+ # Artifact is stored in the Nuget folder
+ $packageType = '${{parameters.packageType}}'
+
+ Write-Host "--------------------------------------------------"
+ Write-Host "This will verify the artifact signature" -ForegroundColor Green
+ Write-Host "--------------------------------------------------"
+
+ nuget verify -All $(pathToDownloadedNuget)\*.nupkg
+ displayName: 'Verify nuget signature'
+
+ - powershell: |
+ $buildType = [string]"$(BuildType)"
+
+ if($buildType -eq 'Official')
+ {
+ # Recursively find all .dll files in TempFolder (installed nuget folder)
+ # Microsoft.Data.SqlClient.dll and Microsoft.Data.SqlClient.resources.dll (in localized folders) should have strong name
+ $dllFiles = Get-ChildItem -Path $(TempFolderName) -Recurse -Filter *.dll
+ $badDlls = @()
+ foreach ($file in $dllFiles)
+ {
+ # Run sn.k to verify the strong name on each dll
+ $result = & "C:\Program Files (x86)\Microsoft SDKs\Windows\*\bin\NETFX 4.8.1 Tools\sn.exe" -vf $file.FullName
+ Write-OutPut $result
+
+ # if thhe dll is not valid, it would be delay signed or test-signed which is not meant for production
+ if($result[$result.Length-1] -notlike "* is valid")
+ {
+ $badDlls += $result[$result.Length-1]
+ }
+ }
+ if($badDlls.Count -gt 0)
+ {
+ Write-OutPut "Error: Invalid dlls are detected. Chek below list:"
+ foreach($dll in $badDlls)
+ {
+ Write-Output $dll
+ }
+ Exit -1
+ }
+ Write-Host "Strong name has been verified for all dlls"
+ }
+ else
+ {
+ Write-OutPut "Strong name verification is not required for non-official builds"
+ }
+ displayName: 'Verify strong name is generated for production'
+
+ - powershell: |
+ # Checks the expected folder names such as lib, ref, runtimes
+ Get-ChildItem -Path $(extractedNugetPath) -Directory | select Name | foreach {
+ if('$(expectedFolderNames)'.contains($_.Name)){
+ Write-Host expected folder name verfied: $_.Name
+ }
+ }
+ displayName: 'Check expected folder names'
+
+ - powershell: |
+ # Checks the version of DotNetFramework, NetStandard and NetCore
+ $countErr = 0
+ $countPass = 0
+ $excludNamesFromRuntimeFolder = 'lib','win','unix'
+
+ Get-ChildItem -Path $(extractedNugetPath) -Directory | foreach {
+ $parentname=$_.Name
+ Write-Host $_.FullName -ForegroundColor yellow
+
+ if($_.Name -ne 'runtimes') {
+ Get-ChildItem -Path $_.FullName -Directory | select Name | foreach {
+ if('$(expectedDotnetVersions)'.Contains($_.Name)){
+ Write-Host "`tExpected version verified in $parentname": $_.Name -ForegroundColor green
+ $countPass += 1
+ }
+ else{
+ Write-Host "`tUnexpected version detected in $parentname": $_.Name
+ $countErr += 1
+ }
+ }
+ }
+
+ elseif ($_.Name -eq 'runtimes'){
+ Get-ChildItem -Depth 3 -Path $_.FullName -Exclude $excludNamesFromRuntimeFolder -Directory | foreach{
+ if('$(expectedDotnetVersions)'.Contains($_.Name)){
+ Write-Host "`tExpected version verfied in $parentname": $_.Name
+ $countPass += 1
+ }
+ else{
+ Write-Host "`tUnexpected version detected": $_.Name -ForegroundColor Red
+ $countErr += 1
+ }
+ }
+ }
+ else{
+ Write-Host "`tUnknown folder " $_.Name -ForegroundColor Red
+ Exit -1
+ }
+ }
+
+ Write-Host "_______________"
+ Write-Host "Expected: $countPass"
+ Write-Host "Unexpected: $countErr"
+ Write-Host "_______________"
+ if ($countErr -ne 0)
+ {
+ Write-Host "Unexpected versions are detected!" -ForegroundColor Red
+ Exit -1
+ }
+ displayName: 'Check Expected framework'
+
+ - powershell: |
+ # list all the child items of created temp folder
+
+ #Verify all DLLs unzipped match "expected" hierarchy
+
+ foreach( $folderName in (Get-ChildItem -Path $(extractedNugetPath) -Directory).Name)
+ {
+ # List all Childerns of the Path
+ Get-ChildItem -Path $(extractedNugetPath)\$folderName -Recurse -File
+ $subFiles = Get-ChildItem -Path $(extractedNugetPath)\$folderName -Recurse -File
+
+ foreach($file in $subFiles)
+ {
+ if($subFiles[0].Name -like "*.dll" -and $subFiles[1].Name -like "*.pdb" )
+ {
+ Write-Host $subFiles[0].Name -ForegroundColor Green
+ Write-Host $subFiles[1].Name -ForegroundColor Green
+ if(($folderName -eq 'lib') -or ($folderName -eq 'ref'))
+ {
+ if($subFiles[2].Name -like "*.xml")
+ {
+ Write-Host $subFiles[2].Name -ForegroundColor Green
+ }
+ else
+ {
+ $subFiles[2].Name
+ Write-Host "Expected file pattern did not match to *.xml" -ForegroundColor Red
+ Exit -1
+ }
+ }
+ }
+ else
+ {
+ $subFiles[0].Name
+ $subFiles[1].Name
+ Write-Host "Expected file pattern did not match to *.dll, *.pdb" -ForegroundColor Red
+ Exit -1
+ }
+ }
+ }
+ displayName: 'Verify all DLLs unzipped match "expected" hierarchy'
+ - powershell: |
+ # Verify all dlls status are Valid
+
+ $dlls = Get-ChildItem -Path $(extractedNugetPath) -Recurse -Include *.dll
+ foreach ($status in $dlls | Get-AuthenticodeSignature)
+ {
+ if ($status.Status -eq "Valid")
+ {
+ Write-Host $status.Status $status.Path
+ }
+ else
+ {
+ Write-Host "dll status of '$status.Path' is not valid!" -ForegroundColor Red
+ $status
+ Exit -1
+ }
+ }
+ displayName: 'Verify all dlls status are Valid'
+
+ - powershell: |
+ # This will check for ProductVersion and FileVersion
+ # For NetFx we have a different FileVersion, but product versions are all the same some may have and extra numbering at the end. we only check for # first parts
+
+ foreach ( $pVersion in Get-ChildItem *.dll -Path $(extractedNugetPath) -Recurse | ForEach-Object versioninfo )
+ {
+ if ($pVersion.ProductVersion -Like '$(ProductVersion)*')
+ {
+ Write-Host Valid Product Version:"$pVersion.ProductVersion" $pVersion.ProductVersion detected for $pVersion.FileName -ForegroundColor Green
+ }
+ else
+ {
+ Write-Host "Wrong ProductVersion detected. Expected: '$(ProductVersion)', but Detected: "$pVersion.ProductVersion""
+ Exit -1
+ }
+
+ if($pVersion.FileName -like '*lib\${{parameters.current_netfx_target_framework }}*'){
+
+ if($pVersion.FileVersion -eq '${{parameters.assembly_file_version_netfx }}')
+ {
+ Write-Host 'Correct File version Detected for net46,' $pVersion.FileVersion -ForegroundColor Green
+ }
+ else
+ {
+ Write-Host 'Wrong File version Detected for net46,' $pVersion.FileVersion -ForegroundColor Red
+ Exit -1
+ }
+ }
+ else
+ {
+
+ if($pVersion.FileVersion -eq '${{parameters.assembly_file_version_core}}')
+ {
+ Write-Host 'Correct File version Detected for netcore and netstandard,' $pVersion.FileVersion -ForegroundColor Green
+ }
+ else
+ {
+ Write-Host 'Wrong File version Detected for netcore and netstandard and ref folder of netfx,' $pVersion.FileVersion -ForegroundColor Red
+ Exit -1
+ }
+ }
+ }
+
+ Get-ChildItem *.dll -Path $(extractedNugetPath) -Recurse | ForEach-Object versioninfo
+ displayName: 'Verify "File Version" matches provided pipeline variable "ASSEMBLY_FILE_VERSION" for DLLs'
+
+ - powershell: |
+ #Change TestMicrosoftDataSqlClientVersion
+
+ [Xml] $versionprops = Get-Content -Path "tools/props/Versions.props"
+ $versionpropspath = "tools\props\Versions.props"
+ $versionprops.Project.PropertyGroup[$versionprops.Project.PropertyGroup.Count-1].TestMicrosoftDataSqlClientVersion ="$(NugetPackageVersion)"
+ Write-Host "Saving Test nuget version at $rootfolder\props ...." -ForegroundColor Green
+ $versionprops.Save($versionpropspath)
+
+ displayName: 'Modify TestMicrosoftDataSqlClientVersion'
+
+ - powershell: |
+ #Change TestMicrosoftDataSqlClientVersion
+
+ [Xml] $versionprops = Get-Content -Path "tools/props/Versions.props"
+ $AssemblyFileVersion = $versionprops.Project.PropertyGroup[0].AssemblyFileVersion
+ $AssemblyVersion = $versionprops.Project.PropertyGroup[0].AssemblyVersion
+
+ if($AssemblyFileVersion -eq $AssemblyVersion)
+ {
+ Write-Host AssemblyFileVersion: $AssemblyFileVersion should not be equal to: $AssemblyVersion
+ Exit -1
+ }
+ displayName: 'Check "AssemblyFileVersion" is not same as "AssemblyVersion" in version.props'
diff --git a/eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml b/eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml
new file mode 100644
index 0000000000..36bc57c7da
--- /dev/null
+++ b/eng/pipelines/common/templates/steps/build-all-configurations-signed-dlls-step.yml
@@ -0,0 +1,61 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+parameters:
+ - name: AssemblyFileVersion
+ type: string
+ default: $(AssemblyFileVersion)
+
+ - name: Configuration
+ type: string
+ default: '$(Configuration)'
+
+ - name: nugetPackageRefVersion
+ type: string
+ default: ''
+
+ - name: product
+ default: MDS
+ values:
+ - MDS
+ - AKV
+ - MSS
+
+steps:
+- task: DownloadSecureFile@1
+ displayName: 'Download Key Pair'
+ inputs:
+ secureFile: netfxKeypair.snk
+ retryCount: 5
+
+- ${{ if eq(parameters.product, 'MDS') }}:
+ - task: MSBuild@1
+ displayName: 'BuildAllConfigurations using build.proj'
+ inputs:
+ solution: '**/build.proj'
+ configuration: '${{parameters.Configuration }}'
+ msbuildArguments: '-p:AssemblyFileVersion=${{parameters.AssemblyFileVersion }} -t:BuildAllConfigurations -p:GenerateNuget=false -p:SignAssembly=true -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk'
+
+- ${{ if eq(parameters.product, 'AKV') }}:
+ - task: MSBuild@1
+ displayName: 'BuildAKVNetStAllOS using build.proj'
+ inputs:
+ solution: '**/build.proj'
+ configuration: '$(Configuration)'
+ msbuildArguments: '-p:AssemblyFileVersion=${{parameters.AssemblyFileVersion }} -t:BuildAKVNetStAllOS -p:NugetPackageVersion=${{parameters.nugetPackageRefVersion }} -p:ReferenceType=Package -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk'
+
+ - task: MSBuild@1
+ displayName: 'BuildAKVNetFx using build.proj'
+ inputs:
+ solution: '**/build.proj'
+ configuration: '$(Configuration)'
+ msbuildArguments: '-p:AssemblyFileVersion=${{parameters.AssemblyFileVersion }} -t:BuildAKVNetFx -p:NugetPackageVersion=${{parameters.nugetPackageRefVersion }} -p:ReferenceType=Package -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk'
+
+ - task: MSBuild@1
+ displayName: 'BuildAKVNetCoreAllOS using build.proj'
+ inputs:
+ solution: '**/build.proj'
+ configuration: '$(Configuration)'
+ msbuildArguments: '-p:AssemblyFileVersion=${{parameters.AssemblyFileVersion }} -t:BuildAKVNetCoreAllOS -p:NugetPackageVersion=${{parameters.nugetPackageRefVersion }} -p:ReferenceType=Package -p:SignAssembly=true -p:AssemblyOriginatorKeyFile=$(Agent.TempDirectory)\netfxKeypair.snk'
diff --git a/eng/pipelines/common/templates/steps/build-and-run-tests-netcore-step.yml b/eng/pipelines/common/templates/steps/build-and-run-tests-netcore-step.yml
new file mode 100644
index 0000000000..f747fa57e6
--- /dev/null
+++ b/eng/pipelines/common/templates/steps/build-and-run-tests-netcore-step.yml
@@ -0,0 +1,80 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+parameters:
+ - name: TargetNetCoreVersion
+ type: string
+ default: $(TargetNetCoreVersion)
+
+ - name: configuration
+ type: string
+ default: $(Configuration)
+
+ - name: referenceType
+ default: Project
+ values:
+ - Project
+ - Package
+
+ - name: NugetPackageVersion
+ type: string
+ default: $(NugetPackageVersion)
+
+ - name: platform
+ type: string
+ default: $(Platform)
+
+ - name: cleanFirst
+ type: boolean
+ default: false
+
+ - name: TestTargetOS
+ type: string
+ default: Windowsnetcoreapp
+ values:
+ - Windowsnetfx
+ - Windowsnetcoreapp
+ - Unixnetcoreapp
+
+ - name: retryCountOnManualTests
+ type: number
+ default: 2
+
+steps:
+- ${{ if eq(parameters.cleanFirst, true)}}:
+ - task: MSBuild@1
+ displayName: 'Clean artifacts folder'
+ inputs:
+ solution: build.proj
+ msbuildArguments: '-t:clean'
+
+- task: MSBuild@1
+ displayName: 'Build AKV Provider .NET'
+ inputs:
+ solution: build.proj
+ msbuildArchitecture: x64
+ msbuildArguments: '-p:Configuration=${{parameters.configuration }} -t:BuildAKVNetCore -p:ReferenceType=${{parameters.referenceType }} '
+
+- task: MSBuild@1
+ displayName: 'MSBuild Build Tests for ${{parameters.TargetNetCoreVersion }}'
+ inputs:
+ solution: build.proj
+ msbuildArchitecture: x64
+ msbuildArguments: '-t:BuildTestsNetCore -p:ReferenceType=${{parameters.referenceType }} -p:TargetNetCoreVersion=${{parameters.TargetNetCoreVersion }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} -p:Configuration=${{parameters.configuration }}'
+
+- task: DotNetCoreCLI@2
+ displayName: 'Run Functional Tests for ${{parameters.TargetNetCoreVersion }}'
+ inputs:
+ command: test
+ projects: 'src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj'
+ arguments: '-p:Platform=${{parameters.platform }} -p:TestTargetOS="${{parameters.TestTargetOS }}" -p:TargetNetCoreVersion=${{parameters.TargetNetCoreVersion }} -p:ReferenceType=${{parameters.referenceType }} -p:Configuration=${{parameters.configuration }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests"'
+
+- task: DotNetCoreCLI@2
+ displayName: 'Run Manual Tests for ${{parameters.TargetNetCoreVersion }}'
+ inputs:
+ command: test
+ projects: 'src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj'
+ arguments: '-p:Platform=${{parameters.platform }} -p:TestTargetOS="${{parameters.TestTargetOS }}" -p:TargetNetCoreVersion=${{parameters.TargetNetCoreVersion }} -p:ReferenceType=${{parameters.referenceType }} -p:Configuration=${{parameters.configuration }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} --no-build -v n --filter category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests --collect "Code Coverage"'
+ retryCountOnTaskFailure: ${{parameters.retryCountOnManualTests }}
diff --git a/eng/pipelines/common/templates/steps/build-and-run-tests-netfx-step.yml b/eng/pipelines/common/templates/steps/build-and-run-tests-netfx-step.yml
new file mode 100644
index 0000000000..ab77af3ee9
--- /dev/null
+++ b/eng/pipelines/common/templates/steps/build-and-run-tests-netfx-step.yml
@@ -0,0 +1,79 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+parameters:
+ - name: TargetNetFxVersion
+ type: string
+ default: $(TargetNetFxVersion)
+
+ - name: configuration
+ type: string
+ default: $(Configuration)
+
+ - name: referenceType
+ default: Project
+ values:
+ - Project
+ - Package
+
+ - name: NugetPackageVersion
+ type: string
+ default: $(NugetPackageVersion)
+
+ - name: platform
+ type: string
+ default: $(Platform)
+
+ - name: cleanFirst
+ type: boolean
+ default: false
+
+ - name: TestTargetOS
+ type: string
+ default: Windowsnetfx
+ values:
+ - Windowsnetfx
+ - Windowsnetcoreapp
+ - Unixnetcoreapp
+
+ - name: retryCountOnManualTests
+ type: number
+ default: 2
+
+steps:
+- ${{ if eq(parameters.cleanFirst, true)}}:
+ - task: MSBuild@1
+ displayName: 'Clean artifacts folder'
+ inputs:
+ solution: build.proj
+ msbuildArguments: '-t:clean'
+
+- task: MSBuild@1
+ displayName: 'Build AKV Provider .NET Framework'
+ inputs:
+ solution: build.proj
+ msbuildArchitecture: x64
+ msbuildArguments: '-p:Configuration=${{parameters.configuration }} -t:BuildAKVNetFx -p:ReferenceType=${{parameters.referenceType }} '
+
+- task: MSBuild@1
+ displayName: 'MSBuild Build Tests for ${{parameters.TargetNetFxVersion }}'
+ inputs:
+ solution: build.proj
+ msbuildArguments: ' -t:BuildTestsNetFx -p:ReferenceType=${{parameters.referenceType }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} -p:TargetNetFxVersion=${{parameters.TargetNetFxVersion }} -p:Configuration=${{parameters.configuration }} -p:Platform=${{parameters.platform }}'
+
+- task: DotNetCoreCLI@2
+ displayName: 'Run Functional Tests for ${{parameters.TargetNetFxVersion }}'
+ inputs:
+ command: test
+ projects: 'src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj'
+ arguments: '-p:Platform=${{parameters.platform }} -p:TestTargetOS="${{parameters.TestTargetOS }}" -p:TargetNetFxVersion=${{parameters.TargetNetFxVersion }} -p:ReferenceType=${{parameters.referenceType }} -p:Configuration=${{parameters.configuration }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests" --collect "Code Coverage"'
+
+- task: DotNetCoreCLI@2
+ displayName: 'Run Manual Tests for ${{parameters.TargetNetFxVersion }}'
+ inputs:
+ command: test
+ projects: 'src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj'
+ arguments: '-p:Platform=${{parameters.platform }} -p:TestTargetOS="${{parameters.TestTargetOS }}" -p:TargetNetFxVersion=${{parameters.TargetNetFxVersion }} -p:ReferenceType=${{parameters.referenceType }} -p:Configuration=${{parameters.configuration }} -p:TestMicrosoftDataSqlClientVersion=${{parameters.NugetPackageVersion }} --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests" --collect "Code Coverage"'
+ retryCountOnTaskFailure: ${{parameters.retryCountOnManualTests }}
diff --git a/eng/pipelines/common/templates/steps/code-analyze-step.yml b/eng/pipelines/common/templates/steps/code-analyze-step.yml
new file mode 100644
index 0000000000..918bc273fa
--- /dev/null
+++ b/eng/pipelines/common/templates/steps/code-analyze-step.yml
@@ -0,0 +1,51 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+parameters:
+ - name: analyzeType
+ values:
+ - roslyn
+ - inspect
+ - all
+
+ - name: sourceRoot
+ type: string
+ default: $(REPOROOT)
+
+ - name: nugetPackageRefVersion
+ type: string
+ default: ''
+
+ - name: product
+ default: MDS
+ values:
+ - MDS
+ - AKV
+ - MSS
+
+steps:
+- ${{ if or(eq(parameters.analyzeType, 'roslyn'), eq(parameters.analyzeType, 'all')) }}:
+ - ${{ if eq(parameters.product, 'MDS') }}:
+ - task: securedevelopmentteam.vss-secure-development-tools.build-task-roslynanalyzers.RoslynAnalyzers@3
+ displayName: 'Guardian Dotnet Analyzers '
+ inputs:
+ msBuildVersion: 17.0
+ msBuildArchitecture: x64
+ setupCommandlinePicker: vs2022
+ msBuildCommandline: 'msbuild ${{parameters.sourceRoot}}\build.proj -p:configuration=Release -p:GenerateNuget=false -p:BuildTools=false -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk'
+ - ${{ if eq(parameters.product, 'AKV') }}:
+ - task: securedevelopmentteam.vss-secure-development-tools.build-task-roslynanalyzers.RoslynAnalyzers@3
+ displayName: 'Guardian Dotnet Analyzers '
+ inputs:
+ msBuildVersion: 17.0
+ msBuildArchitecture: x64
+ setupCommandlinePicker: vs2022
+ msBuildCommandline: 'msbuild ${{parameters.sourceRoot}}\build.proj -p:configuration=Release -p:GenerateNuget=false -p:BuildTools=false -p:NugetPackageVersion=${{parameters.nugetPackageRefVersion }} -p:ReferenceType=Package -t:BuildAKVNetCoreAllOS -p:SigningKeyPath=$(Agent.TempDirectory)\netfxKeypair.snk'
+
+- ${{ if or(eq(parameters.analyzeType, 'inspect'), eq(parameters.analyzeType, 'all')) }}:
+ - task: securedevelopmentteam.vss-secure-development-tools.build-task-codeinspector.CodeInspector@2
+ displayName: 'Run Code Inspector'
+ inputs:
+ LogLevel: Error
diff --git a/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml b/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml
new file mode 100644
index 0000000000..ec1ac1f94f
--- /dev/null
+++ b/eng/pipelines/common/templates/steps/copy-dlls-for-test-step.yml
@@ -0,0 +1,107 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+parameters:
+ - name: Configuration
+ type: string
+ default: '$(Configuration)'
+
+ - name: symbolsFolder
+ type: string
+ default: symbols
+
+ - name: softwareFolder
+ type: string
+ default: software
+
+ - name: referenceType
+ default: project
+ values:
+ - project
+ - package
+
+ - name: listOfTF
+ type: object
+ default:
+ - net462
+ - net6.0
+ - netstandard2.0
+ - netstandard2.1
+
+ - name: product
+ default: MDS
+ values:
+ - MDS
+ - AKV
+ - MSS
+
+steps:
+- powershell: |
+ $software = '${{parameters.softwareFolder}}'
+ $symbols = '${{parameters.symbolsFolder}}'
+
+ md $software
+ md $software\win
+
+ md $symbols
+ md $symbols\win
+ displayName: 'Make base directories'
+
+- ${{ each targetFramework in parameters.listOfTF }}:
+ - ${{ if eq(parameters.product, 'MDS') }}:
+ - powershell: |
+ $software = '${{parameters.softwareFolder}}'
+ $tf = '${{ targetFramework }}'
+ md $software\win\$tf
+
+ if ($tf.StartsWith('net4'))
+ {
+ Copy-Item "artifacts\${{parameters.referenceType }}\bin\Windows_NT\${{parameters.Configuration }}.AnyCPU\Microsoft.Data.SqlClient\netfx\Microsoft.Data.SqlClient.dll" "$software\win\$tf" -recurse
+ }
+ else
+ {
+ Copy-Item "artifacts\${{parameters.referenceType }}\bin\Windows_NT\${{parameters.Configuration }}.AnyCPU\Microsoft.Data.SqlClient\netcore\$tf\Microsoft.Data.SqlClient.dll" "$software\win\$tf" -recurse
+ }
+
+ $symbols = '${{parameters.symbolsFolder}}'
+ md $symbols\win\$tf
+
+ if ($tf.StartsWith('net4'))
+ {
+ Copy-Item "artifacts\Project\bin\Windows_NT\Release.AnyCPU\Microsoft.Data.SqlClient\netfx\Microsoft.Data.SqlClient.pdb" "$symbols\win\$tf" -recurse
+ }
+ else
+ {
+ Copy-Item "artifacts\Project\bin\Windows_NT\Release.AnyCPU\Microsoft.Data.SqlClient\netcore\$tf\Microsoft.Data.SqlClient.pdb" "$symbols\win\$tf" -recurse
+ }
+
+ Write-Host "Artifacts fetched for testing"
+ Get-Location
+ displayName: 'Prepare ${{ targetFramework }} Arifacts for Testing'
+
+ - ${{ if eq(parameters.product, 'AKV') }}:
+ - powershell: |
+ $software = '${{parameters.softwareFolder}}'
+ $tf = '${{ targetFramework }}'
+ md $software\win\$tf
+
+ Copy-Item "artifacts\${{parameters.referenceType }}\bin\Windows_NT\${{parameters.Configuration }}.AnyCPU\AzureKeyVaultProvider\$tf\Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.dll" "$software\win\$tf" -recurse
+
+ $symbols = '${{parameters.symbolsFolder}}'
+ md $symbols\win\$tf
+
+ Copy-Item "artifacts\${{parameters.referenceType }}\bin\Windows_NT\${{parameters.Configuration }}.AnyCPU\AzureKeyVaultProvider\$tf\Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.pdb" "$symbols\win\$tf" -recurse
+
+ Write-Host "Artifacts fetched for testing"
+ Get-Location
+ displayName: 'Prepare ${{ targetFramework }} Arifacts for Testing'
+
+- powershell: |
+ $software = '${{parameters.softwareFolder}}'
+ $symbols = '${{parameters.symbolsFolder}}'
+
+ Get-ChildItem -recurse "$software\*.dll"
+ Get-ChildItem -recurse "$symbols\*.pdb"
+ displayName: 'List the prepared files'
diff --git a/eng/pipelines/common/templates/steps/esrp-code-signing-step.yml b/eng/pipelines/common/templates/steps/esrp-code-signing-step.yml
new file mode 100644
index 0000000000..b1e14aa604
--- /dev/null
+++ b/eng/pipelines/common/templates/steps/esrp-code-signing-step.yml
@@ -0,0 +1,153 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+parameters:
+ - name: artifactType
+ values:
+ - dll
+ - pkg
+
+ - name: sourceRoot
+ type: string
+ default: $(REPOROOT)
+
+ - name: artifactDirectory
+ type: string
+ default: $(artifactDirectory)
+
+ - name: ESRPConnectedServiceName
+ type: string
+ default: $(ESRPConnectedServiceName)
+
+ - name: appRegistrationClientId
+ type: string
+ default: $(appRegistrationClientId)
+
+ - name: appRegistrationTenantId
+ type: string
+ default: $(appRegistrationTenantId)
+
+ - name: AuthAKVName
+ type: string
+ default: $(AuthAKVName)
+
+ - name: AuthSignCertName
+ type: string
+ default: $(AuthSignCertName)
+
+ - name: EsrpClientId
+ type: string
+ default: $(EsrpClientId)
+
+steps:
+- ${{ if eq(parameters.artifactType, 'dll') }}:
+ - task: EsrpMalwareScanning@5
+ displayName: 'ESRP MalwareScanning'
+ inputs:
+ ConnectedServiceName: '${{parameters.ESRPConnectedServiceName }}'
+ AppRegistrationClientId: '${{parameters.appRegistrationClientId }}'
+ AppRegistrationTenantId: '${{parameters.appRegistrationTenantId }}'
+ EsrpClientId: '${{parameters.EsrpClientId }}'
+ UseMSIAuthentication: true
+ FolderPath: '${{parameters.sourceRoot }}'
+ Pattern: '*.dll'
+ CleanupTempStorage: 1
+ VerboseLogin: 1
+ - task: EsrpCodeSigning@5
+ displayName: 'ESRP CodeSigning'
+ inputs:
+ ConnectedServiceName: '${{parameters.ESRPConnectedServiceName }}'
+ AppRegistrationClientId: '${{parameters.appRegistrationClientId }}'
+ AppRegistrationTenantId: '${{parameters.appRegistrationTenantId }}'
+ EsrpClientId: '${{parameters.EsrpClientId }}'
+ UseMSIAuthentication: true
+ AuthAKVName: '${{parameters.AuthAKVName }}'
+ AuthSignCertName: '${{parameters.AuthSignCertName }}'
+ FolderPath: '${{parameters.sourceRoot }}'
+ Pattern: '*.dll'
+ signConfigType: inlineSignParams
+ inlineOperation: |
+ [
+ {
+ "keyCode": "CP-230012",
+ "operationSetCode": "SigntoolSign",
+ "parameters": [
+ {
+ "parameterName": "OpusName",
+ "parameterValue": "Microsoft Data SqlClient Data Provider for SQL Server"
+ },
+ {
+ "parameterName": "OpusInfo",
+ "parameterValue": "http://www.microsoft.com"
+ },
+ {
+ "parameterName": "FileDigest",
+ "parameterValue": "/fd \"SHA256\""
+ },
+ {
+ "parameterName": "PageHash",
+ "parameterValue": "/NPH"
+ },
+ {
+ "parameterName": "TimeStamp",
+ "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
+ }
+ ],
+ "toolName": "sign",
+ "toolVersion": "1.0"
+ },
+ {
+ "keyCode": "CP-230012",
+ "operationSetCode": "SigntoolVerify",
+ "parameters": [ ],
+ "toolName": "sign",
+ "toolVersion": "1.0"
+ }
+ ]
+
+- ${{ if eq(parameters.artifactType, 'pkg') }}:
+ - task: EsrpMalwareScanning@5
+ displayName: 'ESRP MalwareScanning Nuget Package'
+ inputs:
+ ConnectedServiceName: '${{parameters.ESRPConnectedServiceName }}'
+ AppRegistrationClientId: '${{parameters.appRegistrationClientId }}'
+ AppRegistrationTenantId: '${{parameters.appRegistrationTenantId }}'
+ EsrpClientId: '${{parameters.EsrpClientId }}'
+ UseMSIAuthentication: true
+ FolderPath: '${{parameters.artifactDirectory }}'
+ Pattern: '*.nupkg'
+ CleanupTempStorage: 1
+ VerboseLogin: 1
+ - task: EsrpCodeSigning@5
+ displayName: 'ESRP CodeSigning Nuget Package'
+ inputs:
+ inputs:
+ ConnectedServiceName: '${{parameters.ESRPConnectedServiceName }}'
+ AppRegistrationClientId: '${{parameters.appRegistrationClientId }}'
+ AppRegistrationTenantId: '${{parameters.appRegistrationTenantId }}'
+ EsrpClientId: '${{parameters.EsrpClientId }}'
+ UseMSIAuthentication: true
+ AuthAKVName: '${{parameters.AuthAKVName }}'
+ AuthSignCertName: '${{parameters.AuthSignCertName }}'
+ FolderPath: '${{parameters.artifactDirectory }}'
+ Pattern: '*.nupkg'
+ signConfigType: inlineSignParams
+ inlineOperation: |
+ [
+ {
+ "keyCode": "CP-401405",
+ "operationSetCode": "NuGetSign",
+ "parameters": [ ],
+ "toolName": "sign",
+ "toolVersion": "1.0"
+ },
+ {
+ "keyCode": "CP-401405",
+ "operationSetCode": "NuGetVerify",
+ "parameters": [ ],
+ "toolName": "sign",
+ "toolVersion": "1.0"
+ }
+ ]
diff --git a/eng/pipelines/common/templates/steps/generate-nuget-package-step.yml b/eng/pipelines/common/templates/steps/generate-nuget-package-step.yml
new file mode 100644
index 0000000000..34e3544ce6
--- /dev/null
+++ b/eng/pipelines/common/templates/steps/generate-nuget-package-step.yml
@@ -0,0 +1,42 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+parameters:
+ - name: nuspecPath
+ type: string
+ default: '$(nuspecPath)'
+
+ - name: NugetPackageVersion
+ type: string
+ default: '$(NugetPackageVersion)'
+
+ - name: OutputDirectory
+ type: string
+ default: '$(Build.SourcesDirectory)/packages'
+
+ - name: Configuration
+ type: string
+ default: '$(Configuration)'
+
+ - name: referenceType
+ default: project
+ values:
+ - project
+ - package
+
+steps:
+- task: NuGetToolInstaller@1
+ displayName: 'Install Latest Nuget'
+ inputs:
+ checkLatest: true
+- powershell: |
+ $Commit=git rev-parse HEAD
+ Write-Host "##vso[task.setvariable variable=CommitHead;]$Commit"
+ displayName: CommitHead
+- task: NuGetCommand@2
+ displayName: 'NuGet pack'
+ inputs:
+ command: custom
+ arguments: 'pack ${{parameters.nuspecPath}} -Version ${{parameters.NugetPackageVersion}} -OutputDirectory ${{parameters.OutputDirectory}} -properties "COMMITID=$(CommitHead);Configuration=${{parameters.Configuration}};ReferenceType=${{parameters.referenceType}}"'
diff --git a/eng/pipelines/common/templates/steps/pre-build-step.yml b/eng/pipelines/common/templates/steps/pre-build-step.yml
new file mode 100644
index 0000000000..327b5f21a5
--- /dev/null
+++ b/eng/pipelines/common/templates/steps/pre-build-step.yml
@@ -0,0 +1,20 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+steps:
+- script: SET
+ displayName: 'Print Environment Variables'
+
+- powershell: |
+ # use sqlcmd to try to connect to localdb
+ $svc_name = "SQLBrowser"
+ Get-Service $svc_name | Select-Object -Property Name, StartType, Status
+ Set-Service -StartupType Automatic $svc_name
+ net start $svc_name
+ Get-Service $svc_name | Select-Object -Property Name, StartType, Status
+ displayName: 'Start SQLBrowser'
+
+- task: NuGetToolInstaller@1
+ displayName: 'Use NuGet '
diff --git a/eng/pipelines/common/templates/steps/prepare-test-db-step.yml b/eng/pipelines/common/templates/steps/prepare-test-db-step.yml
new file mode 100644
index 0000000000..8597a0c9e5
--- /dev/null
+++ b/eng/pipelines/common/templates/steps/prepare-test-db-step.yml
@@ -0,0 +1,26 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+parameters:
+ - name: databaseName
+ type: string
+ default: $(Database)
+
+ - name: targetFramework
+ type: string
+ default: net6.0
+
+steps:
+- task: DotNetCoreCLI@2
+ displayName: 'Build Ext Utilities'
+ inputs:
+ arguments: '-f ${{parameters.targetFramework }}'
+ workingDirectory: src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities
+- task: DotNetCoreCLI@2
+ displayName: 'Create Test Database'
+ inputs:
+ command: run
+ arguments: '-f ${{parameters.targetFramework }} -- "CreateDatabase" ${{parameters.databaseName }} '
+ workingDirectory: src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.ExtUtilities
diff --git a/eng/pipelines/common/templates/steps/publish-symbols-step.yml b/eng/pipelines/common/templates/steps/publish-symbols-step.yml
new file mode 100644
index 0000000000..cd1954ce77
--- /dev/null
+++ b/eng/pipelines/common/templates/steps/publish-symbols-step.yml
@@ -0,0 +1,150 @@
+####################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+# #
+# doc: https://www.osgwiki.com/wiki/Symbols_Publishing_Pipeline_to_SymWeb_and_MSDL #
+####################################################################################
+parameters:
+ - name: SymAccount
+ type: string
+ default: 'SqlClientDrivers'
+
+ - name: publishSymbols
+ type: string
+ default: '$(PublishSymbols)'
+
+ - name: symbolsVersion
+ type: string
+ default: '$(NuGetPackageVersion)'
+
+ - name: symbolServer
+ type: string
+ default: '$(SymbolServer)'
+
+ - name: symbolTokenUri
+ type: string
+ default: '$(SymbolTokenUri)'
+
+ - name: symbolsArtifactName
+ type: string
+
+ - name: publishToServers
+ type: object
+ default:
+ internal: true
+ public: true
+
+ - name: referenceType
+ default: project
+ values:
+ - project
+ - package
+
+ - name: product
+ default: MDS
+ values:
+ - MDS
+ - AKV
+ - MSS
+
+steps:
+- powershell: 'Write-Host "##vso[task.setvariable variable=ArtifactServices.Symbol.AccountName;]${{parameters.SymAccount}}"'
+ displayName: 'Update Symbol.AccountName with ${{parameters.SymAccount}}'
+ condition: and(succeeded(), ${{ eq(parameters.publishSymbols, 'true') }})
+
+- ${{ if eq(parameters.product, 'MDS') }}:
+ - task: PublishSymbols@2
+ displayName: 'Upload symbols to ${{parameters.SymAccount }} org'
+ inputs:
+ SymbolsFolder: '$(Build.SourcesDirectory)\artifacts\${{parameters.referenceType }}\bin'
+ SearchPattern: |
+ Windows_NT/$(Configuration).AnyCPU/**/Microsoft.Data.SqlClient.pdb
+ Unix/$(Configuration).AnyCPU/**/Microsoft.Data.SqlClient.pdb
+ IndexSources: false
+ SymbolServerType: TeamServices
+ SymbolsMaximumWaitTime: 60
+ SymbolExpirationInDays: 1825 # 5 years
+ SymbolsProduct: Microsoft.Data.SqlClient
+ SymbolsVersion: ${{parameters.symbolsVersion }}
+ SymbolsArtifactName: ${{parameters.symbolsArtifactName }}
+ Pat: $(System.AccessToken)
+ condition: and(succeeded(), ${{ eq(parameters.publishSymbols, 'true') }})
+
+- ${{ if eq(parameters.product, 'AKV') }}:
+ - task: PublishSymbols@2
+ displayName: 'Upload symbols to ${{parameters.SymAccount }} org'
+ inputs:
+ SymbolsFolder: '$(Build.SourcesDirectory)\artifacts\${{parameters.referenceType }}\bin'
+ SearchPattern: |
+ Windows_NT/$(Configuration).AnyCPU/AzureKeyVaultProvider/**/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.pdb
+ AnyOS/$(Configuration).AnyCPU/AzureKeyVaultProvider/**/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.pdb
+ IndexSources: false
+ SymbolServerType: TeamServices
+ SymbolsMaximumWaitTime: 60
+ SymbolExpirationInDays: 1825 # 5 years
+ SymbolsProduct: Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider
+ SymbolsVersion: ${{parameters.symbolsVersion }}
+ SymbolsArtifactName: ${{parameters.symbolsArtifactName }}
+ Pat: $(System.AccessToken)
+ condition: and(succeeded(), ${{ eq(parameters.publishSymbols, 'true') }})
+
+- task: AzureCLI@2
+ displayName: 'Publish symbols'
+ condition: and(succeeded(), ${{ eq(parameters.publishSymbols, 'true') }})
+ inputs:
+ azureSubscription: 'Symbols publishing Workload Identity federation service-ADO.Net'
+ scriptType: ps
+ scriptLocation: inlineScript
+ inlineScript: |
+ $publishToInternalServer = "${{parameters.publishToServers.internal }}".ToLower()
+ $publishToPublicServer = "${{parameters.publishToServers.public }}".ToLower()
+
+ echo "Publishing request name: ${{parameters.symbolsArtifactName }}"
+ echo "Publish to internal server: $publishToInternalServer"
+ echo "Publish to public server: $publishToPublicServer"
+
+ $symbolServer = "${{parameters.symbolServer }}"
+ $tokenUri = "${{parameters.symbolTokenUri }}"
+ # Registered project name in the symbol publishing pipeline: https://portal.microsofticm.com/imp/v3/incidents/incident/520844254/summary
+ $projectName = "Microsoft.Data.SqlClient.SNI"
+
+ # Get the access token for the symbol publishing service
+ $symbolPublishingToken = az account get-access-token --resource $tokenUri --query accessToken -o tsv
+
+ echo "> 1.Symbol publishing token acquired."
+
+ echo "Registering the request name ..."
+ $requestName = "${{parameters.symbolsArtifactName }}"
+ $requestNameRegistrationBody = "{'requestName': '$requestName'}"
+ Invoke-RestMethod -Method POST -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" -Body $requestNameRegistrationBody
+
+ echo "> 2.Registration of request name succeeded."
+
+ echo "Publishing the symbols ..."
+ $publishSymbolsBody = "{'publishToInternalServer': $publishToInternalServer, 'publishToPublicServer': $publishToPublicServer}"
+ echo "Publishing symbols request body: $publishSymbolsBody"
+ Invoke-RestMethod -Method POST -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json" -Body $publishSymbolsBody
+
+ echo "> 3.Request to publish symbols succeeded."
+
+ # The following REST calls are used to check publishing status.
+ echo "> 4.Checking the status of the request ..."
+
+ Invoke-RestMethod -Method GET -Uri "https://$symbolServer.trafficmanager.net/projects/$projectName/requests/$requestName" -Headers @{ Authorization = "Bearer $symbolPublishingToken" } -ContentType "application/json"
+
+ echo "Use below tables to interpret the values of xxxServerStatus and xxxServerResult fields from the response."
+
+ echo "PublishingStatus"
+ echo "-----------------"
+ echo "0 NotRequested; The request has not been requested to publish."
+ echo "1 Submitted; The request is submitted to be published"
+ echo "2 Processing; The request is still being processed"
+ echo "3 Completed; The request has been completed processing. It can be failed or successful. Check PublishingResult to get more details"
+
+ echo "PublishingResult"
+ echo "-----------------"
+ echo "0 Pending; The request has not completed or has not been requested."
+ echo "1 Succeeded; The request has published successfully"
+ echo "2 Failed; The request has failed to publish"
+ echo "3 Cancelled; The request was cancelled"
diff --git a/eng/pipelines/common/templates/steps/update-config-file-step.yml b/eng/pipelines/common/templates/steps/update-config-file-step.yml
new file mode 100644
index 0000000000..2530f35d23
--- /dev/null
+++ b/eng/pipelines/common/templates/steps/update-config-file-step.yml
@@ -0,0 +1,35 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+parameters:
+ - name: TCPConnectionString
+ type: string
+ default: ''
+
+ - name: NPConnectionString
+ type: string
+ default: ''
+
+ - name: SupportsIntegratedSecurity
+ type: boolean
+ default: false
+
+steps:
+# All properties should be added here, and this template should be used for any manipulation of the config.json file.
+- powershell: |
+ $jdata = Get-Content -Raw "config.default.json" | ConvertFrom-Json
+ foreach ($p in $jdata)
+ {
+ if ("${{parameters.TCPConnectionString }}" -ne ""){
+ $p.TCPConnectionString="${{parameters.TCPConnectionString }}"}
+
+ if ("${{parameters.NPConnectionString }}" -ne ""){
+ $p.NPConnectionString="${{parameters.NPConnectionString }}"}
+
+ $p.SupportsIntegratedSecurity=[System.Convert]::ToBoolean("${{parameters.SupportsIntegratedSecurity }}")
+ }
+ $jdata | ConvertTo-Json | Set-Content "config.json"
+ workingDirectory: src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities
+ displayName: 'Update config.json'
diff --git a/eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml b/eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml
new file mode 100644
index 0000000000..5258a3941d
--- /dev/null
+++ b/eng/pipelines/common/templates/steps/update-nuget-config-local-feed-step.yml
@@ -0,0 +1,78 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+parameters:
+ - name: downloadedNugetPath # path to the downloaded nuget files
+ type: string
+
+ - name: nugetPackageVersion
+ type: string
+ default: $(NugetPackageVersion)
+
+steps:
+- powershell: |
+ # Get a list of package sources available
+ Get-PackageSource
+
+ #Current location
+ Get-Location
+
+ # Register the local nuget folder to be used by nuget.config
+ Register-PackageSource -Name "Package Source" -Location ${{parameters.downloadedNugetPath }} -Force -ProviderName NuGet -Trusted
+
+ # Get a list of package sources available after the change
+ Get-PackageSource
+
+ #Set the Nuget.config file in the project to use extracted package
+ $rootFolder = Get-location
+ [Xml] $nugetConfig = Get-Content -Path "Nuget.config"
+ $Value = Resolve-Path ${{parameters.downloadedNugetPath }}
+ $newAdd = $nugetConfig.CreateElement("add")
+ $newAdd.SetAttribute("key","Package source")
+ $newAdd.SetAttribute("value", "$Value\" )
+ $nugetConfig.configuration.packageSources.AppendChild($newAdd)
+ $nugetConfig.Save("$rootFolder\Nuget.config")
+ displayName: 'Update NuGet config file to read from Nuget folder'
+
+- task: MSBuild@1
+ displayName: 'Restore nugets'
+ inputs:
+ solution: build.proj
+ msbuildArchitecture: x64
+ msbuildArguments: '-t:restore'
+
+- powershell: |
+ $Doc = [xml](Get-Content ".\Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj")
+ $parent_xpath = '/Project/ItemGroup/ProjectReference'
+ $node = $Doc.SelectSingleNode($parent_xpath)
+ $parentNode = $node.ParentNode
+ while($node -ne $null) {
+ $node.ParentNode.RemoveChild($node)
+ $node = $Doc.SelectSingleNode($parent_xpath)
+ }
+
+ $parent_xpath = '/Project/ItemGroup/PackageReference[@Include="Microsoft.Data.SqlClient"]'
+ $node = $Doc.SelectSingleNode($parent_xpath)
+
+ if($node -ne $null){
+ $node.Version="${{parameters.nugetPackageVersion }}"
+ }
+ else{
+ $packagerefnode = $doc.createelement("packagereference")
+ $value = $doc.selectsinglenode('/project/itemgroup/projectreference')
+ $attrinclude = $doc.createattribute("include")
+ $attrinclude.value = "microsoft.data.sqlclient"
+ $attrversion = $doc.createattribute("version")
+ $attrversion.value = "${{parameters.nugetPackageVersion }}"
+ $packagerefnode.attributes.append($attrinclude)
+ $packagerefnode.attributes.append($attrversion)
+ $parentNode.AppendChild($packageRefNode)
+ }
+
+ $currentFolder = Get-Location
+ $filePath = Join-Path $currentFolder "Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj"
+ $Doc.Save($filePath)
+ workingDirectory: 'src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider'
+ displayName: 'Update AKV Project Ref to Package Ref (.NET Framework/Core)'
diff --git a/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml b/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml
new file mode 100644
index 0000000000..299a4085fa
--- /dev/null
+++ b/eng/pipelines/dotnet-sqlclient-signing-pipeline.yml
@@ -0,0 +1,179 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+
+name: $(Year:YY)$(DayOfYear)$(Rev:.rr)
+trigger:
+ branches:
+ include:
+ - internal/release/5.1
+ paths:
+ include:
+ - src
+ - eng
+ - tools
+ - .config
+ - build.proj
+ - '*.cmd'
+ - '*.sh'
+
+schedules:
+- cron: '30 23 * * Sun'
+ displayName: Weekly Sunday 4:30 PM (UTC - 7) Build
+ branches:
+ include:
+ - internal/release/5.1
+ always: true
+
+- cron: '30 3 * * Mon-Fri'
+ displayName: Mon-Fri 8:30 PM (UTC - 7) Build
+ branches:
+ include:
+ - internal/release/5.1
+
+parameters: # parameters are shown up in ADO UI in a build queue time
+- name: 'debug'
+ displayName: 'Enable debug output'
+ type: boolean
+ default: false
+
+- name: publishSymbols
+ type: boolean
+ default: false
+
+- name: MDS_PackageRef_Version
+ displayName: 'MDS package version of AKV Provider (build AKV)'
+ type: string
+ default: 5.1.2
+
+- name: CurrentNetFxVersion
+ displayName: 'Lowest supported .NET Framework version (MDS validation)'
+ type: string
+ default: 'net462'
+
+- name: enableAllSdlTools
+ displayName: 'Enable all SDL tools'
+ type: boolean
+ default: true
+
+- name: oneBranchType
+ displayName: 'Select OneBranch template'
+ default: Official
+ values:
+ - NonOfficial
+ - Official
+
+variables:
+ - template: /eng/pipelines/libraries/variables.yml@self
+ - name: packageFolderName
+ value: drop_buildMDS_build_signed_package
+ - name: PublishSymbols
+ value: ${{ parameters['publishSymbols'] }}
+ - name: MDS_PackageRef_Version
+ value: ${{ parameters['MDS_PackageRef_Version'] }}
+ - name: CurrentNetFxVersion
+ value: ${{ parameters['CurrentNetFxVersion'] }}
+ - name: ProductVersion #MDS product version (MDS validation)
+ value: $(NUGETPACKAGEVERSION)
+
+resources:
+ repositories:
+ - repository: templates
+ type: git
+ name: OneBranch.Pipelines/GovernedTemplates
+ ref: refs/heads/main
+
+extends:
+ template: v2/OneBranch.${{parameters.oneBranchType }}.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates
+ parameters:
+ featureFlags:
+ WindowsHostVersion: 1ESWindows2022
+ globalSdl: # https://aka.ms/obpipelines/sdl
+ tsa:
+ # The OneBranch template will set 'break' to false for the other SDL
+ # tools when TSA is enabled. This allows TSA to gather the results
+ # and publish them for downstream analysis.
+ enabled: ${{parameters.enableAllSdlTools }}
+ apiscan:
+ enabled: ${{parameters.enableAllSdlTools }}
+ # For non-official builds, the OneBranch template seems to set APIScan's
+ # 'break' to true even when TSA is enabled. We don't want APIScan to
+ # break non-official builds, so we explicitly set 'break' to false here.
+ ${{ if ne(parameters.oneBranchType, 'Official') }}:
+ break: false
+ softwareFolder: $(softwareFolder)
+ symbolsFolder: $(symbolsFolder)
+ softwarename: Microsoft.Data.SqlClient
+ versionNumber: $(AssemblyFileVersion)
+ codeql:
+ compiled:
+ enabled: false #[warning]Consider running CodeQL on the default branch only.
+ sbom:
+ enabled: ${{parameters.enableAllSdlTools }}
+ packageName: Microsoft.Data.SqlClient
+ packageVersion: $(NugetPackageVersion)
+ policheck:
+ enabled: ${{parameters.enableAllSdlTools }}
+ break: true # always break the build on policheck issues. You can disable it by setting to 'false'
+ exclusionsFile: $(REPOROOT)\.config\PolicheckExclusions.xml
+ asyncSdl:
+ enabled: false
+ credscan:
+ enabled: ${{parameters.enableAllSdlTools }}
+ suppressionsFile: $(REPOROOT)/.config/CredScanSuppressions.json
+ binskim:
+ enabled: ${{parameters.enableAllSdlTools }}
+ armory:
+ enabled: ${{parameters.enableAllSdlTools }}
+ break: true
+ eslint: # TypeScript and JavaScript
+ enabled: false
+ roslyn:
+ enabled: ${{parameters.enableAllSdlTools }}
+ break: true
+ publishLogs:
+ enabled: ${{parameters.enableAllSdlTools }}
+ tsaOptionsPath: $(REPOROOT)\.config\tsaoptions.json
+ disableLegacyManifest: true
+ stages:
+ - stage: buildAKV
+ displayName: 'Build AKV Provider'
+ jobs:
+ - template: eng/pipelines/common/templates/jobs/build-signed-akv-package-job.yml@self
+ parameters:
+ symbolsFolder: $(symbolsFolder)
+ softwareFolder: $(softwareFolder)
+ publishSymbols: ${{ parameters['publishSymbols'] }}
+
+ - stage: buildMDS
+ displayName: 'Build MDS'
+ jobs:
+ - template: eng/pipelines/common/templates/jobs/build-signed-package-job.yml@self
+ parameters:
+ symbolsFolder: $(symbolsFolder)
+ softwareFolder: $(softwareFolder)
+ publishSymbols: ${{ parameters['publishSymbols'] }}
+
+ - stage: mds_package_validation
+ displayName: 'MDS Package Validation'
+ dependsOn: buildMDS
+ jobs:
+ - template: eng/pipelines/common/templates/jobs/validate-signed-package-job.yml@self
+ parameters:
+ packageFolderName: $(packageFolderName)
+ downloadPackageStep:
+ download: current
+ artifact: $(packageFolderName)
+ patterns: '**/*.nupkg'
+ displayName: 'Download NuGet Package'
+
+ - template: eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml@self
+ parameters:
+ packageFolderName: $(packageFolderName)
+ downloadPackageStep:
+ download: current
+ artifact: $(packageFolderName)
+ patterns: '**/*.nupkg'
+ displayName: 'Download NuGet Package'
diff --git a/eng/pipelines/libraries/akv-variables.yml b/eng/pipelines/libraries/akv-variables.yml
new file mode 100644
index 0000000000..a4aa80d555
--- /dev/null
+++ b/eng/pipelines/libraries/akv-variables.yml
@@ -0,0 +1,21 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+
+variables:
+ - group: AKV Release Variables
+ - name: AKVMajor
+ value: 5
+ - name: AKVMinor
+ value: 1
+ - name: AKVPatch
+ value: 0
+
+ - name: AKVNugetPackageVersion
+ value: $(AKVMajor).$(AKVMinor).$(AKVPatch)
+ - name: AKVAssemblyFileVersion
+ value: '$(AKVMajor).$(AKVMinor)$(AKVPatch).$(Build.BuildNumber)'
+ - name: akvNuspecPath
+ value: tools/specs/add-ons/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.nuspec
diff --git a/eng/pipelines/libraries/build-variables.yml b/eng/pipelines/libraries/build-variables.yml
new file mode 100644
index 0000000000..1c26f26a69
--- /dev/null
+++ b/eng/pipelines/libraries/build-variables.yml
@@ -0,0 +1,10 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+
+variables:
+ - template: common-variables.yml@self
+ - template: akv-variables.yml@self
+ - template: mds-variables.yml@self
diff --git a/eng/pipelines/libraries/common-variables.yml b/eng/pipelines/libraries/common-variables.yml
new file mode 100644
index 0000000000..718633691b
--- /dev/null
+++ b/eng/pipelines/libraries/common-variables.yml
@@ -0,0 +1,27 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+
+variables:
+ - group: ESRP Federated Creds (AME)
+ # ESRPConnectedServiceName
+ # ESRPClientId
+ # AppRegistrationClientId
+ # AppRegistrationTenantId
+ # AuthAKVName
+ # AuthSignCertName
+
+ - name: Configuration
+ value: Release
+ - name: CommitHead
+ value: '' # the value will be extracted from the repo's head
+ - name: REPOROOT
+ value: $(Build.SourcesDirectory)
+ - name: softwareFolder
+ value: $(REPOROOT)/software
+ - name: symbolsFolder
+ value: $(REPOROOT)/symbols
+ - name: artifactDirectory
+ value: '$(REPOROOT)/packages'
diff --git a/eng/pipelines/libraries/mds-validation-variables.yml b/eng/pipelines/libraries/mds-validation-variables.yml
new file mode 100644
index 0000000000..68bf6cad01
--- /dev/null
+++ b/eng/pipelines/libraries/mds-validation-variables.yml
@@ -0,0 +1,34 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+
+variables:
+ - template: common-variables.yml@self
+ - template: mds-variables.yml@self
+
+ - name: TempFolderName # extract the nuget package here
+ value: temp
+ - name: extractedNugetPath
+ value: $(Build.SourcesDirectory)\$(TempFolderName)\Microsoft.Data.SqlClient.$(NugetPackageVersion)
+ - name: expectedFolderNames
+ value: lib,ref,runtimes
+ - name: expectedDotnetVersions
+ value: net462,net6.0,netstandard2.0,netstandard2.1
+ - name: Database
+ value: Northwind
+ - name: platform
+ value: AnyCPU
+ - name: TargetNetFxVersion
+ value: net48
+ - name: TargetNetCoreVersion
+ value: net6.0
+ - name: SQLTarget
+ value: localhost
+ - name: encrypt
+ value: false
+ - name: SQL_NP_CONN_STRING
+ value: Data Source=np:$(SQLTarget);Initial Catalog=$(Database);Integrated Security=true;Encrypt=$(ENCRYPT);TrustServerCertificate=true;
+ - name: SQL_TCP_CONN_STRING
+ value: Data Source=tcp:$(SQLTarget);Initial Catalog=$(Database);Integrated Security=true;Encrypt=$(ENCRYPT);TrustServerCertificate=true;
diff --git a/eng/pipelines/libraries/mds-variables.yml b/eng/pipelines/libraries/mds-variables.yml
new file mode 100644
index 0000000000..8d5e37ab83
--- /dev/null
+++ b/eng/pipelines/libraries/mds-variables.yml
@@ -0,0 +1,24 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+
+variables:
+ - group: Release Variables
+
+ - name: Major
+ value: 5
+ - name: Minor
+ value: 1
+ - name: Patch
+ value: 7
+ - name: Packaging.EnableSBOMSigning
+ value: true
+
+ - name: NugetPackageVersion
+ value: $(Major).$(Minor).$(Patch)
+ - name: AssemblyFileVersion
+ value: '$(Major).$(Minor)$(Patch).$(Build.BuildNumber)'
+ - name: nuspecPath
+ value: '$(REPOROOT)/tools/specs/Microsoft.Data.SqlClient.nuspec'
diff --git a/eng/pipelines/libraries/variables.yml b/eng/pipelines/libraries/variables.yml
new file mode 100644
index 0000000000..57894459d3
--- /dev/null
+++ b/eng/pipelines/libraries/variables.yml
@@ -0,0 +1,17 @@
+#################################################################################
+# Licensed to the .NET Foundation under one or more agreements. #
+# The .NET Foundation licenses this file to you under the MIT license. #
+# See the LICENSE file in the project root for more information. #
+#################################################################################
+
+variables:
+ - template: build-variables.yml@self
+ # onebranch template variables
+ - name: ob_outputDirectory
+ value: '$(artifactDirectory)' # this directory is uploaded to pipeline artifacts, reddog and cloudvault. More info at https://aka.ms/obpipelines/artifacts
+ - name: ob_sdl_binskim_break
+ value: true # https://aka.ms/obpipelines/sdl
+ - name: Packaging.EnableSBOMSigning
+ value: true
+ - name: WindowsContainerImage
+ value: 'onebranch.azurecr.io/windows/ltsc2022/vse2022:latest' # Docker image which is used to build the project https://aka.ms/obpipelines/containers
diff --git a/release-notes/5.1/5.1.0-preview1.md b/release-notes/5.1/5.1.0-preview1.md
index 222f10f7d5..9bee9f1288 100644
--- a/release-notes/5.1/5.1.0-preview1.md
+++ b/release-notes/5.1/5.1.0-preview1.md
@@ -4,6 +4,11 @@
This update brings the below changes over the previous release:
+### Contributors
+Thanks to the following public contributors. Their efforts toward this project are very much appreciated.
+- [Wraith2](https://github.com/Wraith2)
+- [sorensenmatias](https://github.com/sorensenmatias)
+
### Fixed
- Fixed `ReadAsync()` behavior to register Cancellation token action before streaming results. [#1781](https://github.com/dotnet/SqlClient/pull/1781)
diff --git a/release-notes/5.1/5.1.0-preview2.md b/release-notes/5.1/5.1.0-preview2.md
index 93b58078a0..5bd4a240b0 100644
--- a/release-notes/5.1/5.1.0-preview2.md
+++ b/release-notes/5.1/5.1.0-preview2.md
@@ -4,6 +4,12 @@
This update brings the below changes over the previous release:
+### Contributors
+Thanks to the following public contributors. Their efforts toward this project are very much appreciated.
+- [Wraith2](https://github.com/Wraith2)
+- [ErikEJ](https://github.com/ErikEJ)
+- [panoskj](https://github.com/panoskj)
+
### Breaking changes over preview release v5.1.0-preview1
- Add support for .NET 6.0 and Dropped support for .NET Core 3.1. [#1704](https://github.com/dotnet/SqlClient/pull/1704) [#1823](https://github.com/dotnet/SqlClient/pull/1823)
@@ -36,7 +42,7 @@ The default value of the `ServerCertificate` connection setting is an empty stri
## Target Platform Support
-- .NET Framework 4.6.2+ (Windows x86, Windows x64)
+- .NET Framework 4.6.2+ (Windows ARM64, Windows x86, Windows x64)
- .NET 6.0+ (Windows x86, Windows x64, Windows ARM64, Windows ARM, Linux, macOS)
- .NET Standard 2.0+ (Windows x86, Windows x64, Windows ARM64, Windows ARM, Linux, macOS)
diff --git a/release-notes/5.1/5.1.0.md b/release-notes/5.1/5.1.0.md
index 015b8966b9..2833f371f0 100644
--- a/release-notes/5.1/5.1.0.md
+++ b/release-notes/5.1/5.1.0.md
@@ -4,6 +4,15 @@
This update includes the following changes over the 5.0 release:
+### Contributors
+Thanks to the following public contributors. Their efforts toward this project are very much appreciated.
+- [Wraith2](https://github.com/Wraith2)
+- [ErikEJ](https://github.com/ErikEJ)
+- [roji](https://github.com/roji)
+- [panoskj](https://github.com/panoskj)
+- [teo-tsirpanis](https://github.com/teo-tsirpanis)
+- [sorensenmatias](https://github.com/sorensenmatias)
+
### Breaking changes
- Dropped support for .NET Core 3.1. [#1704](https://github.com/dotnet/SqlClient/pull/1704) [#1823](https://github.com/dotnet/SqlClient/pull/1823)
@@ -50,7 +59,7 @@ The default value of the `ServerCertificate` connection setting is an empty stri
## Target Platform Support
-- .NET Framework 4.6.2+ (Windows x86, Windows x64)
+- .NET Framework 4.6.2+ (Windows ARM64, Windows x86, Windows x64)
- .NET 6.0+ (Windows x86, Windows x64, Windows ARM64, Windows ARM, Linux, macOS)
- .NET Standard 2.0+ (Windows x86, Windows x64, Windows ARM64, Windows ARM, Linux, macOS)
@@ -70,7 +79,7 @@ The default value of the `ServerCertificate` connection setting is an empty stri
#### .NET
-- Microsoft.Data.SqlClient.SNI 5.1.0
+- Microsoft.Data.SqlClient.SNI.runtime 5.1.0
- Azure.Identity 1.7.0
- Microsoft.Identity.Client 4.47.2
- Microsoft.IdentityModel.JsonWebTokens 6.24.0
@@ -86,7 +95,7 @@ The default value of the `ServerCertificate` connection setting is an empty stri
#### .NET Standard
-- Microsoft.Data.SqlClient.SNI 5.1.0
+- Microsoft.Data.SqlClient.SNI.runtime 5.1.0
- Azure.Identity 1.7.0
- Microsoft.Identity.Client 4.47.2
- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
diff --git a/release-notes/5.1/5.1.1.md b/release-notes/5.1/5.1.1.md
new file mode 100644
index 0000000000..fea3f68033
--- /dev/null
+++ b/release-notes/5.1/5.1.1.md
@@ -0,0 +1,70 @@
+# Release Notes
+
+## Microsoft.Data.SqlClient 5.1.1 released 28 March 2023
+
+This update includes the following changes over the previous release:
+
+### Contributors
+Thanks to the following public contributors. Their efforts toward this project are very much appreciated.
+
+### Fixed
+
+- Fixed an incorrect exception when a symmetric key fails to decrypt a column using Always Encrypted. [#1968](https://github.com/dotnet/SqlClient/pull/1968)
+- Fixed `TransactionScope` connection issue when `Enlist` is `enabled`, `Pooling` is `disabled`, and `Network Connection Type` is set to `Redirect`. [#1967](https://github.com/dotnet/SqlClient/pull/1967)
+- Fixed throttling of token requests by calling `AcquireTokenSilent`. [#1966](https://github.com/dotnet/SqlClient/pull/1966)
+- Fixed TDS RPC error on large queries in `SqlCommand.ExecuteReaderAsync`. [#1965](https://github.com/dotnet/SqlClient/pull/1965)
+- Fixed `NullReferenceException` in `GetBytesAsync`. [#1964](https://github.com/dotnet/SqlClient/pull/1964)
+
+## Target Platform Support
+
+- .NET Framework 4.6.2+ (Windows ARM64, Windows x86, Windows x64)
+- .NET 6.0+ (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
+
+- Microsoft.Data.SqlClient.SNI 5.1.0
+- Azure.Identity 1.7.0
+- Microsoft.Identity.Client 4.47.2
+- Microsoft.IdentityModel.JsonWebTokens 6.24.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
+- System.Buffers 4.5.1
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Runtime.InteropServices.RuntimeInformation 4.3.0
+- System.Text.Encoding.Web 6.0.0
+
+#### .NET
+
+- Microsoft.Data.SqlClient.SNI.runtime 5.1.0
+- Azure.Identity 1.7.0
+- Microsoft.Identity.Client 4.47.2
+- Microsoft.IdentityModel.JsonWebTokens 6.24.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
+- Microsoft.SqlServer.Server 1.0.0
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Diagnostics.DiagnosticSource 6.0.0
+- System.Runtime.Caching 6.0.0
+- System.Text.Encoding.CodePages 6.0.0
+- System.Text.Encodings.Web 6.0.0
+- System.Security.Cryptography.Cng 5.0.0
+- System.Security.Principal.Windows 5.0.0
+
+#### .NET Standard
+
+- Microsoft.Data.SqlClient.SNI.runtime 5.1.0
+- Azure.Identity 1.7.0
+- Microsoft.Identity.Client 4.47.2
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
+- Microsoft.IdentityModel.JsonWebTokens 6.24.0
+- Microsoft.SqlServer.Server 1.0.0
+- Microsoft.Win32.Registry 5.0.0
+- System.Buffers 4.5.1
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Runtime.Caching 6.0.0
+- System.Text.Encoding.CodePages 6.0.0
+- System.Text.Encodings.Web 6.0.0
+- System.Runtime.Loader 4.3.0
+- System.Security.Cryptography.Cng 5.0.0
+- System.Security.Principal.Windows 5.0.0
diff --git a/release-notes/5.1/5.1.2.md b/release-notes/5.1/5.1.2.md
new file mode 100644
index 0000000000..20a71f34ab
--- /dev/null
+++ b/release-notes/5.1/5.1.2.md
@@ -0,0 +1,78 @@
+# Release Notes
+
+## Microsoft.Data.SqlClient 5.1.2 released 26 October 2023
+
+This update includes the following changes over the previous release:
+
+### Contributors
+Thanks to the following public contributors. Their efforts toward this project are very much appreciated.
+- [emidah](https://github.com/emidah)
+
+### Fixed
+
+- Fixed access violation when using SQL Express user instance. [#2101](https://github.com/dotnet/SqlClient/pull/2101)
+- Fixed Always Encrypted secure enclave retry logic for async queries. [#1988](https://github.com/dotnet/SqlClient/pull/1988)
+- Fixed LocalDb and managed SNI by improving the error messages and avoid falling back to the local service. [#2129](https://github.com/dotnet/SqlClient/pull/2129)
+- Fixed .NET and .NET Standard file version. [2093](https://github.com/dotnet/SqlClient/pull/2093)
+- Fixed non-string values and `SqlConnectionStringBuilder` property indexer issue. [#2018](https://github.com/dotnet/SqlClient/pull/2018)
+- Fixed `SqlConnectionEncryptOption` type conversion by introducing the `SqlConnectionEncryptOptionConverter` attribute when using **appsettings.json** files. [#2057](https://github.com/dotnet/SqlClient/pull/2057)
+- Fixed Transient fault handling issue with `OpenAsync`. [#1983](https://github.com/dotnet/SqlClient/pull/1983)
+- Fixed activity correlator to continue use of same GUID for connection activity. [#1997](https://github.com/dotnet/SqlClient/pull/1997)
+
+### Changed
+
+- Updated `Microsoft.Data.SqlClient.SNI` (.NET Framework dependency) and `Microsoft.Data.SqlClient.SNI.runtime` (.NET Core/Standard dependency) version to `5.1.1`. [#2123](https://github.com/dotnet/SqlClient/pull/2123)
+
+## Target Platform Support
+
+- .NET Framework 4.6.2+ (Windows ARM64, Windows x86, Windows x64)
+- .NET 6.0+ (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
+
+- Microsoft.Data.SqlClient.SNI 5.1.1
+- Azure.Identity 1.7.0
+- Microsoft.Identity.Client 4.47.2
+- Microsoft.IdentityModel.JsonWebTokens 6.24.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
+- System.Buffers 4.5.1
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Runtime.InteropServices.RuntimeInformation 4.3.0
+- System.Text.Encoding.Web 6.0.0
+
+#### .NET
+
+- Microsoft.Data.SqlClient.SNI.runtime 5.1.1
+- Azure.Identity 1.7.0
+- Microsoft.Identity.Client 4.47.2
+- Microsoft.IdentityModel.JsonWebTokens 6.24.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
+- Microsoft.SqlServer.Server 1.0.0
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Diagnostics.DiagnosticSource 6.0.0
+- System.Runtime.Caching 6.0.0
+- System.Text.Encoding.CodePages 6.0.0
+- System.Text.Encodings.Web 6.0.0
+- System.Security.Cryptography.Cng 5.0.0
+- System.Security.Principal.Windows 5.0.0
+
+#### .NET Standard
+
+- Microsoft.Data.SqlClient.SNI.runtime 5.1.1
+- Azure.Identity 1.7.0
+- Microsoft.Identity.Client 4.47.2
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
+- Microsoft.IdentityModel.JsonWebTokens 6.24.0
+- Microsoft.SqlServer.Server 1.0.0
+- Microsoft.Win32.Registry 5.0.0
+- System.Buffers 4.5.1
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Runtime.Caching 6.0.0
+- System.Text.Encoding.CodePages 6.0.0
+- System.Text.Encodings.Web 6.0.0
+- System.Runtime.Loader 4.3.0
+- System.Security.Cryptography.Cng 5.0.0
+- System.Security.Principal.Windows 5.0.0
diff --git a/release-notes/5.1/5.1.3.md b/release-notes/5.1/5.1.3.md
new file mode 100644
index 0000000000..f96e347212
--- /dev/null
+++ b/release-notes/5.1/5.1.3.md
@@ -0,0 +1,67 @@
+# Release Notes
+
+## Microsoft.Data.SqlClient 5.1.3 released 9 January 2024
+
+This update includes the following changes over the previous release:
+
+### Contributors
+Thanks to the following public contributors. Their efforts toward this project are very much appreciated.
+
+### Fixed
+
+- Fixed encryption downgrade issue. [CVE-2024-0056](https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-0056)
+- Fixed certificate chain validation logic flow.
+
+## Target Platform Support
+
+- .NET Framework 4.6.2+ (Windows ARM64, Windows x86, Windows x64)
+- .NET 6.0+ (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
+
+- Microsoft.Data.SqlClient.SNI 5.1.1
+- Azure.Identity 1.7.0
+- Microsoft.Identity.Client 4.47.2
+- Microsoft.IdentityModel.JsonWebTokens 6.24.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
+- System.Buffers 4.5.1
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Runtime.InteropServices.RuntimeInformation 4.3.0
+- System.Text.Encoding.Web 6.0.0
+
+#### .NET
+
+- Microsoft.Data.SqlClient.SNI.runtime 5.1.1
+- Azure.Identity 1.7.0
+- Microsoft.Identity.Client 4.47.2
+- Microsoft.IdentityModel.JsonWebTokens 6.24.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
+- Microsoft.SqlServer.Server 1.0.0
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Diagnostics.DiagnosticSource 6.0.0
+- System.Runtime.Caching 6.0.0
+- System.Text.Encoding.CodePages 6.0.0
+- System.Text.Encodings.Web 6.0.0
+- System.Security.Cryptography.Cng 5.0.0
+- System.Security.Principal.Windows 5.0.0
+
+#### .NET Standard
+
+- Microsoft.Data.SqlClient.SNI.runtime 5.1.1
+- Azure.Identity 1.7.0
+- Microsoft.Identity.Client 4.47.2
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
+- Microsoft.IdentityModel.JsonWebTokens 6.24.0
+- Microsoft.SqlServer.Server 1.0.0
+- Microsoft.Win32.Registry 5.0.0
+- System.Buffers 4.5.1
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Runtime.Caching 6.0.0
+- System.Text.Encoding.CodePages 6.0.0
+- System.Text.Encodings.Web 6.0.0
+- System.Runtime.Loader 4.3.0
+- System.Security.Cryptography.Cng 5.0.0
+- System.Security.Principal.Windows 5.0.0
diff --git a/release-notes/5.1/5.1.4.md b/release-notes/5.1/5.1.4.md
new file mode 100644
index 0000000000..62c325750e
--- /dev/null
+++ b/release-notes/5.1/5.1.4.md
@@ -0,0 +1,70 @@
+# Release Notes
+
+## Microsoft.Data.SqlClient 5.1.4 released 9 January 2024
+
+This update includes the following changes over the previous release:
+
+### Contributors
+Thanks to the following public contributors. Their efforts toward this project are very much appreciated.
+
+### Fixed
+
+- Fixed a deadlock problem for distributed transactions when on .NET.
+
+### Changed
+
+- Upgraded `Azure.Identity` dependency version to [1.10.3](https://www.nuget.org/packages/Azure.Identity/1.10.3) to address [CVE-2023-36414](https://github.com/advisories/GHSA-5mfx-4wcx-rv27).
+
+## Target Platform Support
+
+- .NET Framework 4.6.2+ (Windows ARM64, Windows x86, Windows x64)
+- .NET 6.0+ (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
+
+- Microsoft.Data.SqlClient.SNI 5.1.1
+- Azure.Identity 1.10.3
+- Microsoft.Identity.Client 4.56.2
+- Microsoft.IdentityModel.JsonWebTokens 6.24.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
+- System.Buffers 4.5.1
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Runtime.InteropServices.RuntimeInformation 4.3.0
+- System.Text.Encoding.Web 6.0.0
+
+#### .NET
+
+- Microsoft.Data.SqlClient.SNI.runtime 5.1.1
+- Azure.Identity 1.10.3
+- Microsoft.Identity.Client 4.56.2
+- Microsoft.IdentityModel.JsonWebTokens 6.24.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
+- Microsoft.SqlServer.Server 1.0.0
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Diagnostics.DiagnosticSource 6.0.0
+- System.Runtime.Caching 6.0.0
+- System.Text.Encoding.CodePages 6.0.0
+- System.Text.Encodings.Web 6.0.0
+- System.Security.Cryptography.Cng 5.0.0
+- System.Security.Principal.Windows 5.0.0
+
+#### .NET Standard
+
+- Microsoft.Data.SqlClient.SNI.runtime 5.1.1
+- Azure.Identity 1.10.3
+- Microsoft.Identity.Client 4.56.2
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0
+- Microsoft.IdentityModel.JsonWebTokens 6.24.0
+- Microsoft.SqlServer.Server 1.0.0
+- Microsoft.Win32.Registry 5.0.0
+- System.Buffers 4.5.1
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Runtime.Caching 6.0.0
+- System.Text.Encoding.CodePages 6.0.0
+- System.Text.Encodings.Web 6.0.0
+- System.Runtime.Loader 4.3.0
+- System.Security.Cryptography.Cng 5.0.0
+- System.Security.Principal.Windows 5.0.0
diff --git a/release-notes/5.1/5.1.5.md b/release-notes/5.1/5.1.5.md
new file mode 100644
index 0000000000..540061f8f1
--- /dev/null
+++ b/release-notes/5.1/5.1.5.md
@@ -0,0 +1,72 @@
+# Release Notes
+
+## Microsoft.Data.SqlClient 5.1.5 released 29 January 2024
+
+This update includes the following changes over the previous release:
+
+### Contributors
+Thanks to the following public contributors. Their efforts toward this project are very much appreciated.
+- [ErikEJ](https://github.com/ErikEJ)
+
+### Fixed
+
+- Fixed connection to unsubscribe from transaction completion events before returning it to the connection pool [#2321](https://github.com/dotnet/SqlClient/pull/2321)
+- Fixed InvalidCastException when reading an Always Encrypted date or time column [#2324](https://github.com/dotnet/SqlClient/pull/2324)
+
+### Changed
+
+- Changed Microsoft.IdentityModel.JsonWebTokens and Microsoft.IdentityModel.Protocols.OpenIdConnect version 6.24.0 to 6.35.0 [#2320](https://github.com/dotnet/SqlClient/pull/2320) to address [CVE-2024-21319](https://www.cve.org/CVERecord?id=CVE-2024-21319)
+
+## Target Platform Support
+
+- .NET Framework 4.6.2+ (Windows ARM64, Windows x86, Windows x64)
+- .NET 6.0+ (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
+
+- Microsoft.Data.SqlClient.SNI 5.1.1
+- Azure.Identity 1.10.3
+- Microsoft.Identity.Client 4.56.2
+- Microsoft.IdentityModel.JsonWebTokens 6.35.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.35.0
+- System.Buffers 4.5.1
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Runtime.InteropServices.RuntimeInformation 4.3.0
+- System.Text.Encoding.Web 6.0.0
+
+#### .NET
+
+- Microsoft.Data.SqlClient.SNI.runtime 5.1.1
+- Azure.Identity 1.10.3
+- Microsoft.Identity.Client 4.56.2
+- Microsoft.IdentityModel.JsonWebTokens 6.35.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.35.0
+- Microsoft.SqlServer.Server 1.0.0
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Diagnostics.DiagnosticSource 6.0.0
+- System.Runtime.Caching 6.0.0
+- System.Text.Encoding.CodePages 6.0.0
+- System.Text.Encodings.Web 6.0.0
+- System.Security.Cryptography.Cng 5.0.0
+- System.Security.Principal.Windows 5.0.0
+
+#### .NET Standard
+
+- Microsoft.Data.SqlClient.SNI.runtime 5.1.1
+- Azure.Identity 1.10.3
+- Microsoft.Identity.Client 4.56.2
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.35.0
+- Microsoft.IdentityModel.JsonWebTokens 6.35.0
+- Microsoft.SqlServer.Server 1.0.0
+- Microsoft.Win32.Registry 5.0.0
+- System.Buffers 4.5.1
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Runtime.Caching 6.0.0
+- System.Text.Encoding.CodePages 6.0.0
+- System.Text.Encodings.Web 6.0.0
+- System.Runtime.Loader 4.3.0
+- System.Security.Cryptography.Cng 5.0.0
+- System.Security.Principal.Windows 5.0.0
diff --git a/release-notes/5.1/5.1.6.md b/release-notes/5.1/5.1.6.md
new file mode 100644
index 0000000000..3c6cb9ebe6
--- /dev/null
+++ b/release-notes/5.1/5.1.6.md
@@ -0,0 +1,75 @@
+# Release Notes
+
+## Microsoft.Data.SqlClient 5.1.6 released 27 August 2024
+
+This update includes the following changes over the previous release:
+
+### Contributors
+Thanks to the following public contributors. Their efforts toward this project are very much appreciated.
+
+### Fixed
+
+- Fixed Transient fault handling issue with `OpenAsync`. [#1983](https://github.com/dotnet/SqlClient/pull/1983) [#2508](https://github.com/dotnet/SqlClient/pull/2508)
+- Fixed `AcquireTokenAsync` timeout handling for edge cases in `ActiveDirectoryAuthenticationProvider`. [#2706](https://github.com/dotnet/SqlClient/pull/2706)
+- Fixed pending data with `SqlDataReader` against an encrypted column. [#2618](https://github.com/dotnet/SqlClient/pull/2618) [#2818](https://github.com/dotnet/SqlClient/pull/2818)
+
+### Changed
+
+- Upgraded `Azure.Identity` version from 1.11.3 to 1.11.4 [#2649] (https://github.com/dotnet/SqlClient/pull/2649) [#2529] (https://github.com/dotnet/SqlClient/pull/2529) to address [CVE-2024-35255](https://github.com/advisories/GHSA-m5vv-6r4h-3vj9).
+- Upgraded `Microsoft.Identity.Client` version from 4.60.0 to 4.61.3 [#2649] (https://github.com/dotnet/SqlClient/pull/2649) [#2529] (https://github.com/dotnet/SqlClient/pull/2529) to address [CVE-2024-35255](https://github.com/advisories/GHSA-m5vv-6r4h-3vj9).
+- Added caching to `TokenCredential` objects to take advantage of token caching. [#2776](https://github.com/dotnet/SqlClient/pull/2776)
+- Code health improvements: [#2490] (https://github.com/dotnet/SqlClient/pull/2490)
+
+## Target Platform Support
+
+- .NET Framework 4.6.2+ (Windows ARM64, Windows x86, Windows x64)
+- .NET 6.0+ (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
+
+- Microsoft.Data.SqlClient.SNI 5.1.1
+- Azure.Identity 1.11.4
+- Microsoft.Identity.Client 4.61.3
+- Microsoft.IdentityModel.JsonWebTokens 6.35.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.35.0
+- System.Buffers 4.5.1
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Runtime.InteropServices.RuntimeInformation 4.3.0
+- System.Text.Encodings.Web 6.0.0
+
+#### .NET
+
+- Microsoft.Data.SqlClient.SNI.runtime 5.1.1
+- Azure.Identity 1.11.4
+- Microsoft.Identity.Client 4.61.3
+- Microsoft.IdentityModel.JsonWebTokens 6.35.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.35.0
+- Microsoft.SqlServer.Server 1.0.0
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Diagnostics.DiagnosticSource 6.0.0
+- System.Runtime.Caching 6.0.0
+- System.Text.Encoding.CodePages 6.0.0
+- System.Text.Encodings.Web 6.0.0
+- System.Security.Cryptography.Cng 5.0.0
+- System.Security.Principal.Windows 5.0.0
+
+#### .NET Standard
+
+- Microsoft.Data.SqlClient.SNI.runtime 5.1.1
+- Azure.Identity 1.11.4
+- Microsoft.Identity.Client 4.61.3
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.35.0
+- Microsoft.IdentityModel.JsonWebTokens 6.35.0
+- Microsoft.SqlServer.Server 1.0.0
+- Microsoft.Win32.Registry 5.0.0
+- System.Buffers 4.5.1
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Runtime.Caching 6.0.0
+- System.Text.Encoding.CodePages 6.0.0
+- System.Text.Encodings.Web 6.0.0
+- System.Runtime.Loader 4.3.0
+- System.Security.Cryptography.Cng 5.0.0
+- System.Security.Principal.Windows 5.0.0
diff --git a/release-notes/5.1/5.1.7.md b/release-notes/5.1/5.1.7.md
new file mode 100644
index 0000000000..f8716c7b21
--- /dev/null
+++ b/release-notes/5.1/5.1.7.md
@@ -0,0 +1,76 @@
+# Release Notes
+
+## Microsoft.Data.SqlClient 5.1.7 - April 25, 2025
+
+This update brings the following changes since the 5.1.6 release:
+
+### Fixed
+
+- Fixed possible `NullPointerException` during socket receive (PR [#3285](https://github.com/dotnet/SqlClient/pull/3285))
+- Fixed inconsistencies between source and reference projects (PR [#3180](https://github.com/dotnet/SqlClient/pull/3180))
+
+### Changed
+
+- Updated the following dependencies:
+ - [Microsoft.Data.SqlClient.SNI](https://www.nuget.org/packages/Microsoft.Data.SqlClient.SNI/5.1.2) 5.1.1 to 5.1.2 for .NET Framework on Windows (PR [#3294](https://github.com/dotnet/SqlClient/pull/3294))
+ - [Microsoft.Data.SqlClient.SNI.runtime](https://www.nuget.org/packages/Microsoft.Data.SqlClient.SNI.runtime/5.1.2) 5.1.1 to 5.1.2 for .NET on Windows (PR [#3294](https://github.com/dotnet/SqlClient/pull/3294))
+ - [Microsoft.Extensions.Caching.Memory](https://www.nuget.org/packages/Microsoft.Extensions.Caching.Memory/6.0.3) 6.0.1 to 6.0.3 - Avoid [CVE-2024-43483](https://github.com/advisories/GHSA-qj66-m88j-hmgj) (PR [#3068](https://github.com/dotnet/SqlClient/pull/3068))
+ - [Microsoft.Extensions.Hosting](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/6.0.1) 6.0.0 to 6.0.1 - Avoid transitive dependency on vulnerable [System.Text.Json](https://www.nuget.org/packages/System.Text.Json/6.0.0) 6.0.0 (PR [#3207](https://github.com/dotnet/SqlClient/pull/3207))
+ - [System.Private.Uri](https://www.nuget.org/packages/System.Private.Uri) 4.3.2 - Avoid transitive [CVE-2019-0820](https://msrc.microsoft.com/update-guide/en-US/advisory/CVE-2019-0820) (PR [#3077](https://github.com/dotnet/SqlClient/pull/3077))
+ - [System.Text.Encodings.Web](https://www.nuget.org/packages/System.Text.Encodings.Web/6.0.1) 6.0.0 to 6.0.1 - Avoid transitive downgrade for .NET Framework targets (PR [#3279](https://github.com/dotnet/SqlClient/pull/3279))
+ - [System.Text.Json](https://www.nuget.org/packages/System.Text.Json/6.0.11) 6.0.11 - Avoid transitive dependencies on older vulnerable versions for .NET Framework targets (PR [#3279](https://github.com/dotnet/SqlClient/pull/3279))
+
+## Target Platform Support
+
+- .NET Framework 4.6.2+ (Windows x86, Windows x64)
+- .NET 6.0+ (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
+
+- Azure.Identity 1.11.4
+- Microsoft.Data.SqlClient.SNI 5.1.2
+- Microsoft.Identity.Client 4.61.3
+- Microsoft.IdentityModel.JsonWebTokens 6.35.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.35.0
+- System.Buffers 4.5.1
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Runtime.InteropServices.RuntimeInformation 4.3.0
+- System.Text.Encoding.Web 6.0.1
+- System.Text.Json 6.0.11
+
+### .NET
+
+- Azure.Identity 1.11.4
+- Microsoft.Data.SqlClient.SNI 5.1.2
+- Microsoft.Identity.Client 4.61.3
+- Microsoft.IdentityModel.JsonWebTokens 6.35.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.35.0
+- Microsoft.SqlServer.Server 1.0.0
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Diagnostics.DiagnosticSource 6.0.1
+- System.Runtime.Caching 6.0.0
+- System.Text.Encoding.CodePages 6.0.0
+- System.Text.Encodings.Web 6.0.1
+- System.Security.Cryptography.Cng 5.0.0
+- System.Security.Principal.Windows 5.0.0
+
+### .NET Standard
+
+- Azure.Identity 1.11.4
+- Microsoft.Data.SqlClient.SNI 5.1.2
+- Microsoft.Identity.Client 4.61.3
+- Microsoft.IdentityModel.JsonWebTokens 6.35.0
+- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.35.0
+- Microsoft.SqlServer.Server 1.0.0
+- Microsoft.Win32.Registry 5.0.0
+- System.Buffers 4.5.1
+- System.Configuration.ConfigurationManager 6.0.1
+- System.Runtime.Caching 6.0.0
+- System.Text.Encoding.CodePages 6.0.0
+- System.Text.Encodings.Web 6.0.1
+- System.Runtime.Loader 4.3.0
+- System.Security.Cryptography.Cng 5.0.0
+- System.Security.Principal.Windows 5.0.0
diff --git a/release-notes/5.1/5.1.md b/release-notes/5.1/5.1.md
deleted file mode 100644
index 6f6687b5d5..0000000000
--- a/release-notes/5.1/5.1.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# Microsoft.Data.SqlClient 5.1 Releases
-
-The following Microsoft.Data.SqlClient 5.1 stable releases have been shipped:
-
-| Release Date | Version | Notes |
-| :-- | :-- | :--: |
-| 2023/01/19 | 5.1.0 | [release notes](5.1.0.md) |
-
-The following Microsoft.Data.SqlClient 5.1 preview releases have been shipped:
-
-| Release Date | Version | Notes |
-| :-- | :-- | :--: |
-| 2022/11/10 | 5.1.0-preview2.22314.2 | [release notes](5.1.0-preview2.md) |
-| 2022/10/19 | 5.1.0-preview1.22279.3 | [release notes](5.1.0-preview1.md) |
diff --git a/release-notes/5.1/README.md b/release-notes/5.1/README.md
index 6f6687b5d5..27ed889b2a 100644
--- a/release-notes/5.1/README.md
+++ b/release-notes/5.1/README.md
@@ -4,6 +4,13 @@ The following Microsoft.Data.SqlClient 5.1 stable releases have been shipped:
| Release Date | Version | Notes |
| :-- | :-- | :--: |
+| 2025/04/25 | 5.1.7 | [release notes](5.1.7.md) |
+| 2024/08/27 | 5.1.6 | [release notes](5.1.6.md) |
+| 2024/01/29 | 5.1.5 | [release notes](5.1.5.md) |
+| 2024/01/09 | 5.1.4 | [release notes](5.1.4.md) |
+| 2024/01/09 | 5.1.3 | [release notes](5.1.3.md) |
+| 2023/10/26 | 5.1.2 | [release notes](5.1.2.md) |
+| 2023/03/28 | 5.1.1 | [release notes](5.1.1.md) |
| 2023/01/19 | 5.1.0 | [release notes](5.1.0.md) |
The following Microsoft.Data.SqlClient 5.1 preview releases have been shipped:
diff --git a/release-notes/README.md b/release-notes/README.md
index ba76fe8433..2fbfc1de70 100644
--- a/release-notes/README.md
+++ b/release-notes/README.md
@@ -1,6 +1,6 @@
# Microsoft.Data.SqlClient Release Notes
-The latest stable release is [Microsoft.Data.SqlClient 5.0](5.0).
+The latest stable release is [Microsoft.Data.SqlClient 5.1](5.1).
## Release Information
@@ -8,8 +8,8 @@ The latest stable release is [Microsoft.Data.SqlClient 5.0](5.0).
- [Microsoft.Data.SqlClient 5.0](5.0)
- [Microsoft.Data.SqlClient 4.1](4.1)
- [Microsoft.Data.SqlClient 4.0](4.0)
-- [Microsoft.Data.SqlClient 3.0](3.0)
- [Microsoft.Data.SqlClient 3.1](3.1)
+- [Microsoft.Data.SqlClient 3.0](3.0)
- [Microsoft.Data.SqlClient 2.1](2.1)
- [Microsoft.Data.SqlClient 2.0](2.0)
- [Microsoft.Data.SqlClient 1.1](1.1)
@@ -17,10 +17,11 @@ The latest stable release is [Microsoft.Data.SqlClient 5.0](5.0).
# Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider Release Notes
-The latest stable release is [Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider 3.0](add-ons/AzureKeyVaultProvider/3.0).
+The latest stable release is [Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider 5.1](add-ons/AzureKeyVaultProvider/5.1).
## Release Information
+- [Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider 5.1](add-ons/AzureKeyVaultProvider/5.1)
- [Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider 3.0](add-ons/AzureKeyVaultProvider/3.0)
- [Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider 2.0](add-ons/AzureKeyVaultProvider/2.0)
- [Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider 1.2](add-ons/AzureKeyVaultProvider/1.2)
diff --git a/release-notes/add-ons/AzureKeyVaultProvider/5.1/5.1.0.md b/release-notes/add-ons/AzureKeyVaultProvider/5.1/5.1.0.md
new file mode 100644
index 0000000000..159a1072d5
--- /dev/null
+++ b/release-notes/add-ons/AzureKeyVaultProvider/5.1/5.1.0.md
@@ -0,0 +1,72 @@
+# Release Notes
+
+## General Availability of Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider
+
+_**5.1.0 released 01 February 2024**_
+
+This library contains the implementation of `Microsoft.Data.SqlClient.SqlColumnEncryptionKeyStoreProvider` for accessing Azure Key Vault, and the provider class is named `SqlColumnEncryptionAzureKeyVaultProvider`.
+
+### Changed
+
+- Changed Microsoft.Data.SqlClient version 3.0.0 to 5.1.5 [#2330](https://github.com/dotnet/SqlClient/pull/2330)
+- Changed Azure.Core version 1.6.0 to 1.35.0 [#2330](https://github.com/dotnet/SqlClient/pull/2330)
+- Changed Azure.Security.KeyVault.Keys 4.0.3 to 4.5.0 [#2330](https://github.com/dotnet/SqlClient/pull/2330)
+- Changed Microsoft.Extensions.Caching.Memory 5.0.0 to 8.0.0 for .Net 8.0 and 6.0.1 for other Target frameworks [#2330](https://github.com/dotnet/SqlClient/pull/2330)
+
+### Working with SQLColumnEncryptionAzureKeyVaultProvider
+
+`SqlColumnEncryptionAzureKeyVaultProvider` **v5.1** is implemented against `Microsoft.Data.SqlClient` **v5.1** and supports .NET Framework 4.6.2+, .NET Core 6.0+, and .NET Standard 2.0+. The provider name identifier for this library is "**AZURE_KEY_VAULT**" and it is not registered in the driver by default. Client applications may initialize this provider by providing an `Azure.Core.TokenCredential` and registering it with the driver using any of the below APIs:
+
+- [SqlConnection.RegisterColumnEncryptionKeyStoreProviders](https://docs.microsoft.com/dotnet/api/microsoft.data.sqlclient.sqlconnection.registercolumnencryptionkeystoreproviders?view=sqlclient-dotnet-5.1)
+- [SqlConnection.RegisterColumnEncryptionKeyStoreProvidersOnConnection](https://docs.microsoft.com/dotnet/api/microsoft.data.sqlclient.sqlconnection.registercolumnencryptionkeystoreprovidersonconnection?view=sqlclient-dotnet-5.1) (Added in version 3.0.0)
+- [SqlCommand.RegisterColumnEncryptionKeyStoreProvidersOnCommand](https://docs.microsoft.com/dotnet/api/microsoft.data.sqlclient.sqlcommand.registercolumnencryptionkeystoreprovidersoncommand?view=sqlclient-dotnet-5.1) (Added in version 3.0.0)
+
+Once the provider is registered, it can be used to perform Always Encrypted operations by creating a Column Master Key using the Azure Key Vault Key Identifier URL.
+
+The linked C# samples below demonstrate using Always Encrypted with secure enclaves with Azure Key Vault:
+
+- Legacy API support (Always Encrypted): [AzureKeyVaultProviderExample.cs](https://github.com/dotnet/SqlClient/blob/main/doc/samples/AzureKeyVaultProviderLegacyExample_2_0.cs)
+- New API support (Always Encrypted): [AzureKeyVaultProviderExample.cs](https://github.com/dotnet/SqlClient/blob/main/doc/samples/AzureKeyVaultProviderExample_2_0.cs)
+- Legacy API support (Always Encrypted with secure enclaves): [AzureKeyVaultProviderExample.cs](https://github.com/dotnet/SqlClient/blob/main/doc/samples/doc\samples\AzureKeyVaultProviderWithEnclaveProviderExample.cs)
+- New API support (Always Encrypted with secure enclaves): [AzureKeyVaultProviderExample.cs](https://github.com/dotnet/SqlClient/blob/main/doc/samples/doc\samples\AzureKeyVaultProviderWithEnclaveProviderExample_2_0.cs)
+- Column Encryption Key cache scope example: [AzureKeyVaultProvider_ColumnEncryptionKeyCacheScope.cs](https://github.com/dotnet/SqlClient/blob/main/doc/samples/AzureKeyVaultProvider_ColumnEncryptionKeyCacheScope.cs)
+- Registering custom key store provider - Connection Precedence: [RegisterCustomKeyStoreProvider_ConnectionPrecedence.cs](https://github.com/dotnet/SqlClient/blob/main/doc/samples/RegisterCustomKeyStoreProvider_ConnectionPrecedence.cs)
+- Registering custom key store provider - Command Precedence: [RegisterCustomKeyStoreProvider_CommandPrecedence.cs](https://github.com/dotnet/SqlClient/blob/main/doc/samples/RegisterCustomKeyStoreProvider_CommandPrecedence.cs)
+
+For further details, refer to [Using the Azure Key Vault provider](https://docs.microsoft.com/sql/connect/ado-net/sql/sqlclient-support-always-encrypted#using-the-azure-key-vault-provider)
+
+## Target Platform Support
+
+- .NET Framework 4.6.2+
+- .NET Core 6.0+ (Windows x86, Windows x64, Linux, macOS)
+- .NET Standard 2.0+
+
+### Dependencies
+
+#### .NET Framework
+
+- Azure.Core 1.35.0
+- Azure.Security.KeyVault.Keys 4.5.0
+- Microsoft.Data.SqlClient 5.1.5
+- Microsoft.Extensions.Caching.Memory 6.0.1
+
+##### .NET 6
+
+- Azure.Core 1.35.0
+- Azure.Security.KeyVault.Keys 4.5.0
+- Microsoft.Data.SqlClient 5.1.5
+- Microsoft.Extensions.Caching.Memory 6.0.1
+
+#### .NET 8
+
+- Azure.Core 1.35.0
+- Azure.Security.KeyVault.Keys 4.5.0
+- Microsoft.Data.SqlClient 5.1.5
+- Microsoft.Extensions.Caching.Memory 8.0.0
+
+#### .NET Standard
+
+- Azure.Core 1.35.0
+- Azure.Security.KeyVault.Keys 4.5.0
+- Microsoft.Data.SqlClient 5.1.5
+- Microsoft.Extensions.Caching.Memory 6.0.1
diff --git a/release-notes/add-ons/AzureKeyVaultProvider/5.1/README.md b/release-notes/add-ons/AzureKeyVaultProvider/5.1/README.md
new file mode 100644
index 0000000000..55d9d38bc4
--- /dev/null
+++ b/release-notes/add-ons/AzureKeyVaultProvider/5.1/README.md
@@ -0,0 +1,7 @@
+# Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider 5.1 Releases
+
+The following Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider 5.1 stable releases have been shipped:
+
+| Release Date | Description | Notes |
+| :-- | :-- | :--: |
+| 2024/02/01 | 5.1.0 | [release notes](5.1.0.md) |
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index afcf503118..be2fe1f22a 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -61,11 +61,40 @@
$(NuGetRoot)nuget.exe
true
+ $(WarningsNotAsErrors);NU1901;NU1902;NU1903;NU1904;NU1905
false
$(DefineConstants);ENCLAVE_SIMULATOR
+
+
+
+
+ false
+
+
+ all
+
+
+
+
+ portable
+ true
+ false
+ true
+ true
+ false
+
+
+ true
+
@@ -74,4 +103,6 @@
+
+
diff --git a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj b/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj
index 3f2267451e..ca570955ca 100644
--- a/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj
+++ b/src/Microsoft.Data.SqlClient/add-ons/AzureKeyVaultProvider/Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider.csproj
@@ -15,6 +15,14 @@
false
MIT
true
+
+
+
+ true
+ $(SigningKeyPath)
+
+
+ $(SigningKeyPath)
@@ -22,7 +30,6 @@
-
diff --git a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj
index 41e1263abc..912d68f5de 100644
--- a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj
+++ b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj
@@ -3,6 +3,9 @@
false
net6.0;netstandard2.0;netstandard2.1
netstandard2.1
+ $(OS)
+ true
+ true
$(ObjFolder)$(Configuration)\$(AssemblyName)\ref\
$(BinFolder)$(Configuration)\$(AssemblyName)\ref\
$(OutputPath)\$(TargetFramework)\Microsoft.Data.SqlClient.xml
@@ -12,17 +15,53 @@
netstandard
AnyCPU;x64;x86
+
+ true
+ $(SigningKeyPath)
+ $(SigningKeyPath)
+
+
+ $(SigningKeyPath)
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj
index bc755d3486..f06bc9df7b 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj
@@ -19,6 +19,14 @@
true
Core $(BaseProduct)
+
+ true
+ $(SigningKeyPath)
+ $(SigningKeyPath)
+
+
+ $(SigningKeyPath)
+
portable
true
@@ -328,6 +336,9 @@
Microsoft\Data\SqlClient\SqlConnectionEncryptOption.cs
+
+ Microsoft\Data\SqlClient\SqlConnectionEncryptOptionConverter.cs
+
Microsoft\Data\SqlClient\SqlConnectionPoolGroupProviderInfo.cs
@@ -956,7 +967,7 @@
-
+
@@ -969,7 +980,6 @@
-
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs
index 8fc8df24e0..9f4d5d2e08 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs
@@ -16,6 +16,7 @@ internal abstract partial class DbConnectionInternal
{
private static int _objectTypeCount;
internal readonly int _objectID = Interlocked.Increment(ref _objectTypeCount);
+ private TransactionCompletedEventHandler _transactionCompletedEventHandler = null;
private bool _isInStasis;
@@ -437,15 +438,19 @@ internal void DetachTransaction(Transaction transaction, bool isExplicitlyReleas
// potentially a multi-threaded event, so lock the connection to make sure we don't enlist in a new
// transaction between compare and assignment. No need to short circuit outside of lock, since failed comparisons should
// be the exception, not the rule.
- lock (this)
+ // locking on anything other than the transaction object would lead to a thread deadlock with sys.Transaction.TransactionCompleted event.
+ lock (transaction)
{
// Detach if detach-on-end behavior, or if outer connection was closed
- DbConnection owner = (DbConnection)Owner;
- if (isExplicitlyReleasing || UnbindOnTransactionCompletion || null == owner)
+ DbConnection owner = Owner;
+ if (isExplicitlyReleasing || UnbindOnTransactionCompletion || owner is null)
{
Transaction currentEnlistedTransaction = _enlistedTransaction;
if (currentEnlistedTransaction != null && transaction.Equals(currentEnlistedTransaction))
{
+ // We need to remove the transaction completed event handler to cease listening for the transaction to end.
+ currentEnlistedTransaction.TransactionCompleted -= _transactionCompletedEventHandler;
+
EnlistedTransaction = null;
if (IsTxRootWaitingForTxEnd)
@@ -479,7 +484,8 @@ void TransactionCompletedEvent(object sender, TransactionEventArgs e)
private void TransactionOutcomeEnlist(Transaction transaction)
{
- transaction.TransactionCompleted += new TransactionCompletedEventHandler(TransactionCompletedEvent);
+ _transactionCompletedEventHandler ??= new TransactionCompletedEventHandler(TransactionCompletedEvent);
+ transaction.TransactionCompleted += _transactionCompletedEventHandler;
}
internal void SetInStasis()
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/LocalDB.Windows.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/LocalDB.Windows.cs
index 68eaa25486..a81fb89dfb 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/LocalDB.Windows.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/LocalDB.Windows.cs
@@ -50,8 +50,14 @@ private string GetConnectionString(string localDbInstance)
{
StringBuilder localDBConnectionString = new StringBuilder(MAX_LOCAL_DB_CONNECTION_STRING_SIZE + 1);
int sizeOfbuffer = localDBConnectionString.Capacity;
- localDBStartInstanceFunc(localDbInstance, 0, localDBConnectionString, ref sizeOfbuffer);
- return localDBConnectionString.ToString();
+ int result = localDBStartInstanceFunc(localDbInstance, 0, localDBConnectionString, ref sizeOfbuffer);
+ if (result != TdsEnums.SNI_SUCCESS)
+ {
+ SNILoadHandle.SingletonInstance.LastError = new SNIError(SNIProviders.INVALID_PROV, 0, SNICommon.LocalDBErrorCode, Strings.SNI_ERROR_50);
+ SqlClientEventSource.Log.TrySNITraceEvent(nameof(LocalDB), EventType.ERR, "Unsuccessful 'LocalDBStartInstance' method call with {0} result to start '{1}' localDb instance", args0: result, args1: localDbInstance);
+ localDBConnectionString = null;
+ }
+ return localDBConnectionString?.ToString();
}
internal enum LocalDBErrorState
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNICommon.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNICommon.cs
index b92746098f..08272596d8 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNICommon.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNICommon.cs
@@ -21,16 +21,18 @@ namespace Microsoft.Data.SqlClient.SNI
///
internal enum SNIProviders
{
- HTTP_PROV, // HTTP Provider
- NP_PROV, // Named Pipes Provider
- SESSION_PROV, // Session Provider
- SIGN_PROV, // Sign Provider
- SM_PROV, // Shared Memory Provider
- SMUX_PROV, // SMUX Provider
- SSL_PROV, // SSL Provider
- TCP_PROV, // TCP Provider
- MAX_PROVS, // Number of providers
- INVALID_PROV // SQL Network Interfaces
+ HTTP_PROV = 0, // HTTP Provider
+ NP_PROV = 1, // Named Pipes Provider
+ SESSION_PROV = 2, // Session Provider
+ SIGN_PROV = 3, // Sign Provider
+ SM_PROV = 4, // Shared Memory Provider
+ SMUX_PROV = 5, // SMUX Provider
+ SSL_PROV = 6, // SSL Provider
+ TCP_PROV = 7, // TCP Provider
+ VIA_PROV = 8, // Virtual Interface Architecture Provider
+ CTAIP_PROV = 9,
+ MAX_PROVS = 10, // Number of providers
+ INVALID_PROV = 11 // SQL Network Interfaces
}
///
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIProxy.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIProxy.cs
index ac4d3599dd..834050b4bb 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIProxy.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIProxy.cs
@@ -190,7 +190,7 @@ internal static SNIHandle CreateConnectionHandle(
case DataSource.Protocol.TCP:
sniHandle = CreateTcpHandle(details, timerExpire, parallel, ipPreference, cachedFQDN, ref pendingDNSInfo,
tlsFirst, hostNameInCertificate, serverCertificateFilename);
- break;
+ break;
case DataSource.Protocol.NP:
sniHandle = CreateNpHandle(details, timerExpire, parallel, tlsFirst);
break;
@@ -392,7 +392,7 @@ private static string GetLocalDBDataSource(string fullServerName, out bool error
Debug.Assert(!string.IsNullOrWhiteSpace(localDBInstance), "Local DB Instance name cannot be empty.");
localDBConnectionString = LocalDB.GetLocalDBConnectionString(localDBInstance);
- if (fullServerName == null)
+ if (fullServerName == null || string.IsNullOrEmpty(localDBConnectionString))
{
// The Last error is set in LocalDB.GetLocalDBConnectionString. We don't need to set Last here.
error = true;
@@ -522,7 +522,18 @@ internal static string GetLocalDBInstance(string dataSource, out bool error)
ReadOnlySpan input = dataSource.AsSpan().TrimStart();
error = false;
// NetStandard 2.0 does not support passing a string to ReadOnlySpan
- if (input.StartsWith(LocalDbHost.AsSpan().Trim(), StringComparison.InvariantCultureIgnoreCase))
+ int index = input.IndexOf(LocalDbHost.AsSpan().Trim(), StringComparison.InvariantCultureIgnoreCase);
+ if (input.StartsWith(LocalDbHost_NP.AsSpan().Trim(), StringComparison.InvariantCultureIgnoreCase))
+ {
+ instanceName = input.Trim().ToString();
+ }
+ else if (index > 0)
+ {
+ SNILoadHandle.SingletonInstance.LastError = new SNIError(SNIProviders.INVALID_PROV, 0, SNICommon.ErrorLocatingServerInstance, Strings.SNI_ERROR_26);
+ SqlClientEventSource.Log.TrySNITraceEvent(nameof(SNIProxy), EventType.ERR, "Incompatible use of prefix with LocalDb: '{0}'", dataSource);
+ error = true;
+ }
+ else if (index == 0)
{
// When netcoreapp support for netcoreapp2.1 is dropped these slice calls could be converted to System.Range\System.Index
// Such ad input = input[1..];
@@ -541,10 +552,6 @@ internal static string GetLocalDBInstance(string dataSource, out bool error)
error = true;
}
}
- else if (input.StartsWith(LocalDbHost_NP.AsSpan().Trim(), StringComparison.InvariantCultureIgnoreCase))
- {
- instanceName = input.Trim().ToString();
- }
return instanceName;
}
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNITcpHandle.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNITcpHandle.cs
index 103af2ed2d..b8e38978b9 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNITcpHandle.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNITcpHandle.cs
@@ -765,17 +765,29 @@ public override uint Send(SNIPacket packet)
}
///
- /// Receive a packet synchronously
+ /// Receives a packet synchronously.
///
- /// SNI packet
- /// Timeout in Milliseconds
- /// SNI error code
+ /// The received SNI packet.
+ ///
+ /// Timeout in milliseconds:
+ /// - If greater than 0, sets the socket's receive timeout to the specified value.
+ /// - If equal to -1, represents an infinite timeout (socket timeout is set to 0).
+ /// - If less than -1 or equal to 0, results in a timeout error.
+ ///
+ /// SNI error code indicating the result of the operation.
public override uint Receive(out SNIPacket packet, int timeoutInMilliseconds)
{
SNIPacket errorPacket;
lock (this)
{
packet = null;
+
+ if (_socket == null)
+ {
+ SqlClientEventSource.Log.TrySNITraceEvent(nameof(SNITCPHandle), EventType.ERR, "Connection Id {0}, Socket is null.", args0: _connectionId);
+ return ReportTcpSNIError(0, SNICommon.ConnOpenFailedError, Strings.SNI_ERROR_10);
+ }
+
try
{
if (timeoutInMilliseconds > 0)
@@ -784,8 +796,7 @@ public override uint Receive(out SNIPacket packet, int timeoutInMilliseconds)
}
else if (timeoutInMilliseconds == -1)
{
- // SqlClient internally represents infinite timeout by -1, and for TcpClient this is translated to a timeout of 0
- _socket.ReceiveTimeout = 0;
+ _socket.ReceiveTimeout = Timeout.Infinite;
}
else
{
@@ -840,7 +851,9 @@ public override uint Receive(out SNIPacket packet, int timeoutInMilliseconds)
}
finally
{
- _socket.ReceiveTimeout = 0;
+ // Reset the socket timeout to Timeout.Infinite after the receive operation is done
+ // to avoid blocking the thread in case of a timeout error.
+ _socket.ReceiveTimeout = Timeout.Infinite;
}
}
}
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SSRP.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SSRP.cs
index e51175059a..49d68b0120 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SSRP.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SSRP.cs
@@ -48,8 +48,14 @@ internal static int GetPortByInstanceName(string browserHostName, string instanc
}
catch (SocketException se)
{
+ // A SocketException is possible for an instance name that doesn't exist.
+ // If there are multiple IP addresses and one of them fails with a SocketException but
+ // others simply don't respond because the instance name is invalid, we want to return
+ // the same error as if the response was empty. The higher error suits all scenarios.
+ // But log it, just in case there is a different, underlying issue that support needs
+ // to troubleshoot.
SqlClientEventSource.Log.TrySNITraceEvent(nameof(SSRP), EventType.ERR, "SocketException Message = {0}", args0: se?.Message);
- throw new Exception(SQLMessage.SqlServerBrowserNotAccessible(), se);
+ throw;
}
const byte SvrResp = 0x05;
@@ -321,9 +327,37 @@ private static SsrpResult SendUDPRequest(IPEndPoint endPoint, byte[] requestPack
}
}
}
+ catch (AggregateException ae)
+ {
+ if (ae.InnerExceptions.Count > 0)
+ {
+ // Log all errors
+ foreach (Exception e in ae.InnerExceptions)
+ {
+ // Favor SocketException for returned error
+ if (e is SocketException)
+ {
+ result.Error = e;
+ }
+ SqlClientEventSource.Log.TrySNITraceEvent(nameof(SSRP), EventType.INFO,
+ "SendUDPRequest ({0}) resulted in exception: {1}", args0: endPoint.ToString(), args1: e.Message);
+ }
+
+ // Return first error if we didn't find a SocketException
+ result.Error = result.Error == null ? ae.InnerExceptions[0] : result.Error;
+ }
+ else
+ {
+ result.Error = ae;
+ SqlClientEventSource.Log.TrySNITraceEvent(nameof(SSRP), EventType.INFO,
+ "SendUDPRequest ({0}) resulted in exception: {1}", args0: endPoint.ToString(), args1: ae.Message);
+ }
+ }
catch (Exception e)
{
result.Error = e;
+ SqlClientEventSource.Log.TrySNITraceEvent(nameof(SSRP), EventType.INFO,
+ "SendUDPRequest ({0}) resulted in exception: {1}", args0: endPoint.ToString(), args1: e.Message);
}
return result;
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.NetCoreApp.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.NetCoreApp.cs
index cca04fc323..fd81db557d 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.NetCoreApp.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.NetCoreApp.cs
@@ -15,8 +15,8 @@ internal abstract partial class SqlColumnEncryptionEnclaveProvider
/// The information the provider uses to attest the enclave and generate a symmetric key for the session. The format of this information is specific to the enclave attestation protocol.
/// A Diffie-Hellman algorithm object encapsulating a client-side key pair.
/// The set of parameters required for enclave session.
- /// The set of extra data needed for attestating the enclave.
- /// The length of the extra data needed for attestating the enclave.
+ /// The set of extra data needed for attesting the enclave.
+ /// The length of the extra data needed for attesting the enclave.
/// The requested enclave session or null if the provider does not implement session caching.
/// A counter that the enclave provider is expected to increment each time SqlClient retrieves the session from the cache. The purpose of this field is to prevent replay attacks.
internal abstract void CreateEnclaveSession(byte[] enclaveAttestationInfo, ECDiffieHellman clientDiffieHellmanKey, EnclaveSessionParameters enclaveSessionParameters, byte[] customData, int customDataLength,
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.cs
index e374d43665..9223702509 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.cs
@@ -8,7 +8,7 @@ namespace Microsoft.Data.SqlClient
internal abstract partial class SqlColumnEncryptionEnclaveProvider
{
///
- internal abstract void GetEnclaveSession(EnclaveSessionParameters enclaveSessionParameters, bool generateCustomData, out SqlEnclaveSession sqlEnclaveSession, out long counter, out byte[] customData, out int customDataLength);
+ internal abstract void GetEnclaveSession(EnclaveSessionParameters enclaveSessionParameters, bool generateCustomData, bool isRetry, out SqlEnclaveSession sqlEnclaveSession, out long counter, out byte[] customData, out int customDataLength);
///
internal abstract SqlEnclaveAttestationParameters GetAttestationParameters(string attestationUrl, byte[] customData, int customDataLength);
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs
index b576ef3510..f3b26e7899 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlCommand.cs
@@ -137,6 +137,11 @@ protected override void AfterCleared(SqlCommand owner)
/// Internal flag for testing purposes that forces all queries to internally end async calls.
///
private static bool _forceInternalEndQuery = false;
+
+ ///
+ /// Internal flag for testing purposes that forces one RetryableEnclaveQueryExecutionException during GenerateEnclavePackage
+ ///
+ private static bool _forceRetryableEnclaveQueryExecutionExceptionDuringGenerateEnclavePackage = false;
#endif
private static readonly SqlDiagnosticListener s_diagnosticListener = new SqlDiagnosticListener(SqlClientDiagnosticListenerExtensions.DiagnosticListenerName);
@@ -2221,7 +2226,7 @@ private IAsyncResult BeginExecuteReaderInternal(CommandBehavior behavior, AsyncC
// back into pool when we should not.
}
- bool usedCache;
+ bool usedCache = false;
Task writeTask = null;
try
{
@@ -2238,7 +2243,10 @@ private IAsyncResult BeginExecuteReaderInternal(CommandBehavior behavior, AsyncC
// For async, RunExecuteReader will never put the stateObj back into the pool, so do so now.
ReliablePutStateObject();
- throw;
+ if (inRetry || e is not EnclaveDelegate.RetryableEnclaveQueryExecutionException)
+ {
+ throw;
+ }
}
if (writeTask != null)
@@ -2439,12 +2447,7 @@ long firstAttemptStart
// Remove the entry from the cache since it was inconsistent.
SqlQueryMetadataCache.GetInstance().InvalidateCacheEntry(this);
- if (ShouldUseEnclaveBasedWorkflow && this.enclavePackage != null)
- {
- EnclaveSessionParameters enclaveSessionParameters = new EnclaveSessionParameters(this._activeConnection.DataSource, this._activeConnection.EnclaveAttestationUrl, this._activeConnection.Database);
- EnclaveDelegate.Instance.InvalidateEnclaveSession(this._activeConnection.AttestationProtocol, this._activeConnection.Parser.EnclaveType,
- enclaveSessionParameters, this.enclavePackage.EnclaveSession);
- }
+ InvalidateEnclaveSession();
try
{
@@ -2480,6 +2483,26 @@ long firstAttemptStart
}, TaskScheduler.Default);
}
+ private void InvalidateEnclaveSession()
+ {
+ if (ShouldUseEnclaveBasedWorkflow && this.enclavePackage != null)
+ {
+ EnclaveDelegate.Instance.InvalidateEnclaveSession(
+ this._activeConnection.AttestationProtocol,
+ this._activeConnection.Parser.EnclaveType,
+ GetEnclaveSessionParameters(),
+ this.enclavePackage.EnclaveSession);
+ }
+ }
+
+ private EnclaveSessionParameters GetEnclaveSessionParameters()
+ {
+ return new EnclaveSessionParameters(
+ this._activeConnection.DataSource,
+ this._activeConnection.EnclaveAttestationUrl,
+ this._activeConnection.Database);
+ }
+
private void BeginExecuteReaderInternalReadStage(TaskCompletionSource
@@ -422,6 +430,9 @@
Microsoft\Data\SqlClient\SqlConnectionEncryptOption.cs
+
+ Microsoft\Data\SqlClient\SqlConnectionEncryptOptionConverter.cs
+
Microsoft\Data\SqlClient\SqlConnectionPoolGroupProviderInfo.cs
@@ -705,30 +716,20 @@
-
-
- $(SystemTextEncodingsWebVersion)
-
$(MicrosoftDataSqlClientSniVersion)
All
runtime; build; native; contentfiles; analyzers; buildtransitive
-
- $(AzureIdentityVersion)
-
-
- $(MicrosoftIdentityClientVersion)
-
-
- $(MicrosoftIdentityModelProtocolsOpenIdConnectVersion)
-
-
- $(MicrosoftIdentityModelJsonWebTokensVersion)
-
-
- $(SystemBuffersVersion)
-
+
+
+
+
+
+
+
+
+
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs
index a79eb68411..06b1e04712 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/ProviderBase/DbConnectionInternal.cs
@@ -18,11 +18,10 @@ namespace Microsoft.Data.ProviderBase
using SysTx = System.Transactions;
internal abstract class DbConnectionInternal
- { // V1.1.3300
-
-
+ {
private static int _objectTypeCount;
internal readonly int _objectID = Interlocked.Increment(ref _objectTypeCount);
+ private SysTx.TransactionCompletedEventHandler _transactionCompletedEventHandler = null;
internal static readonly StateChangeEventArgs StateChangeClosed = new StateChangeEventArgs(ConnectionState.Open, ConnectionState.Closed);
internal static readonly StateChangeEventArgs StateChangeOpen = new StateChangeEventArgs(ConnectionState.Closed, ConnectionState.Open);
@@ -900,15 +899,18 @@ internal void DetachTransaction(SysTx.Transaction transaction, bool isExplicitly
// potentially a multi-threaded event, so lock the connection to make sure we don't enlist in a new
// transaction between compare and assignment. No need to short circuit outside of lock, since failed comparisons should
// be the exception, not the rule.
- lock (this)
+ // locking on anything other than the transaction object would lead to a thread deadlock with sys.Transaction.TransactionCompleted event.
+ lock (transaction)
{
// Detach if detach-on-end behavior, or if outer connection was closed
- DbConnection owner = (DbConnection)Owner;
- if (isExplicitlyReleasing || UnbindOnTransactionCompletion || null == owner)
+ DbConnection owner = Owner;
+ if (isExplicitlyReleasing || UnbindOnTransactionCompletion || owner is null)
{
SysTx.Transaction currentEnlistedTransaction = _enlistedTransaction;
if (currentEnlistedTransaction != null && transaction.Equals(currentEnlistedTransaction))
{
+ // We need to remove the transaction completed event handler to cease listening for the transaction to end.
+ currentEnlistedTransaction.TransactionCompleted -= _transactionCompletedEventHandler;
EnlistedTransaction = null;
@@ -947,7 +949,8 @@ void TransactionCompletedEvent(object sender, SysTx.TransactionEventArgs e)
[SecurityPermission(SecurityAction.Assert, Flags = SecurityPermissionFlag.UnmanagedCode)]
private void TransactionOutcomeEnlist(SysTx.Transaction transaction)
{
- transaction.TransactionCompleted += new SysTx.TransactionCompletedEventHandler(TransactionCompletedEvent);
+ _transactionCompletedEventHandler ??= new SysTx.TransactionCompletedEventHandler(TransactionCompletedEvent);
+ transaction.TransactionCompleted += _transactionCompletedEventHandler;
}
internal void SetInStasis()
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.cs
index 9017b84717..de26b79232 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.cs
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlColumnEncryptionEnclaveProvider.cs
@@ -11,7 +11,7 @@ internal abstract class SqlColumnEncryptionEnclaveProvider
{
///
- internal abstract void GetEnclaveSession(EnclaveSessionParameters enclaveSessionParameters, bool generateCustomData, out SqlEnclaveSession sqlEnclaveSession, out long counter, out byte[] customData, out int customDataLength);
+ internal abstract void GetEnclaveSession(EnclaveSessionParameters enclaveSessionParameters, bool generateCustomData, bool isRetry, out SqlEnclaveSession sqlEnclaveSession, out long counter, out byte[] customData, out int customDataLength);
///
internal abstract SqlEnclaveAttestationParameters GetAttestationParameters(string attestationUrl, byte[] customData, int customDataLength);
diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs
index fdfa0772ea..6922be9735 100644
--- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs
+++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlCommand.cs
@@ -83,6 +83,11 @@ public sealed class SqlCommand : DbCommand, ICloneable
/// Internal flag for testing purposes that forces all queries to internally end async calls.
///
private static bool _forceInternalEndQuery = false;
+
+ ///
+ /// Internal flag for testing purposes that forces one RetryableEnclaveQueryExecutionException during GenerateEnclavePackage
+ ///
+ private static bool _forceRetryableEnclaveQueryExecutionExceptionDuringGenerateEnclavePackage = false;
#endif
internal static readonly Action