Skip to content

Commit

Permalink
Merge in 'main' changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SqlClient Azure DevOps committed Jun 12, 2024
2 parents 1dfd483 + d4b2bb3 commit 55f48c5
Show file tree
Hide file tree
Showing 154 changed files with 6,402 additions and 6,181 deletions.
3 changes: 2 additions & 1 deletion BUILDGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This project should be built with Visual Studio 2019+ for the best compatibility

- **Visual Studio 2019** with imported components: [VS19Components](/tools/vsconfig/VS19Components.vsconfig)

- **Powershell**: To build SqlClient on Linux, powershell is needed as well. Follow the distro specific instructions at [Install Powershell on Linux](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-linux?view=powershell-7.4)

Once the environment is setup properly, execute the desired set of commands below from the _root_ folder to perform the respective operations:

## Building the driver
Expand Down Expand Up @@ -165,7 +167,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;` <br/> 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;` <br/> OR <br/> `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.|
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ 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/)

## [Stable release 5.2.1] - 2024-05-31

This update brings the below changes over the previous release:

### Changed

- Upgraded `Azure.Identity` version from 1.10.3 to 1.11.3 [#2492](https://github.com/dotnet/SqlClient/pull/2492), [#2528](https://github.com/dotnet/SqlClient/pull/2528)
- Upgraded `Microsoft.Identity.Client` version from 4.56.0 to 4.60.3 [#2492](https://github.com/dotnet/SqlClient/pull/2492)
- Code Health improvements: [#2467](https://github.com/dotnet/SqlClient/pull/2467)

### Fixed

- Fixed connection errors on Linux when Data Source property contains both named instance and port [#2436](https://github.com/dotnet/SqlClient/pull/2436)
- Fixed `SqlConnection.FireInfoMessageEventOnUserErrors` when set to true throws an exception [#2505](https://github.com/dotnet/SqlClient/pull/2505)
- Fixed exception when using `DATETIMEOFFSET(n)` in a TVP if `n` is 1, 2, 3, or 4 [#2506](https://github.com/dotnet/SqlClient/pull/2506)
- Reverted PR [#1983](https://github.com/dotnet/SqlClient/pull/1938) which caused connection failure delays when using `OpenAsync` [#2507](https://github.com/dotnet/SqlClient/pull/2507)
- Fixed `SqlConnection.Clone()` to include `AccessTokenCallback` [#2527](https://github.com/dotnet/SqlClient/pull/2527)

## [Stable release 5.2.0] - 2024-02-28

### Added
Expand Down
3 changes: 3 additions & 0 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<Import Project="$(ToolsDir)targets\add-ons\GenerateAKVProviderNugetPackage.targets" />

<PropertyGroup>
<!-- SourceLink variable-->
<DisableSourceLink>false</DisableSourceLink>

<RestoreConfigFile>src\NuGet.config</RestoreConfigFile>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
Expand Down
15 changes: 11 additions & 4 deletions doc/samples/SqlConnection_AccessTokenCallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,21 @@ static void Main()

private static void OpenSqlConnection()
{
const string defaultScopeSuffix = "/.default";
string connectionString = GetConnectionString();
using (SqlConnection connection = new SqlConnection("Data Source=contoso.database.windows.net;Initial Catalog=AdventureWorks;")
DefaultAzureCredential credential = new();

using (SqlConnection connection = new(connectionString)
{
AccessTokenCallback = async (authParams, cancellationToken) =>
{
var cred = new DefaultAzureCredential();
string scope = authParams.Resource.EndsWith(s_defaultScopeSuffix) ? authParams.Resource : authParams.Resource + s_defaultScopeSuffix;
var token = await cred.GetTokenAsync(new TokenRequestContext(new[] { scope }), cancellationToken);
string scope = authParams.Resource.EndsWith(defaultScopeSuffix)
? authParams.Resource
: $"{authParams.Resource}{defaultScopeSuffix}";
AccessToken token = await credential.GetTokenAsync(
new TokenRequestContext([scope]),
cancellationToken);

return new SqlAuthenticationToken(token.Token, token.ExpiresOn);
}
})
Expand Down
312 changes: 312 additions & 0 deletions doc/snippets/Microsoft.Data.SqlClient/SqlClientDiagnostic.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,312 @@
<?xml version="1.0"?>
<docs>
<members name="SqlClientDiagnostic">
<OperationId>
<summary>A guid value used to correlate before, after and error events.</summary>
</OperationId>
<Operation>
<summary>The name of the operation.</summary>
</Operation>
<Timestamp>
<summary>The timestamp of the event.</summary>
</Timestamp>
<Item1>
<summary>
Gets the element at the specified index in the read-only list.
</summary>
<param name="index">The zero-based index of the element to get.</param>
<returns>The element at the specified index in the read-only list.</returns>
<exception cref="IndexOutOfRangeException"></exception>
</Item1>
<Count>
<summary>Gets the number of elements in the collection.</summary>
<returns>The number of elements in the collection.</returns>
</Count>
<GetEnumerator>
<summary>Returns an enumerator that iterates through the collection.</summary>
<returns>An enumerator that can be used to iterate through the collection.</returns>
</GetEnumerator>
</members>
<members name="SqlClientCommandBefore">
<SqlClientCommandBefore>
<summary>Contains diagnostic information emitted before a command is executed.</summary>
</SqlClientCommandBefore>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<ConnectionId>
<summary>A nullable guid uniquely identifying the connection that the xommand is being executed on.</summary>
</ConnectionId>
<TransactionId>
<summary>A nullable long uniquely identifying the transaction that the command enrolled in if it is enrolled in one.</summary>
</TransactionId>
<Command>
<summary>The command object that is executing.</summary>
</Command>
</members>
<members name="SqlClientCommandAfter">
<SqlClientCommandAfter>
<summary>Contains diagnostic information emitted after a command is successfully executed.</summary>
</SqlClientCommandAfter>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<ConnectionId>
<summary>A nullable guid uniquely identifying the connection that the command is being executed on.</summary>
</ConnectionId>
<TransactionId>
<summary>A nullable long uniquely identifying the transaction that the command is enrolled in if it is enrolled in one, or null.</summary>
</TransactionId>
<Command>
<summary>The command object that is executing.</summary>
</Command>
<Statistics>
<summary>An IDictionary of statistic information about the event that has completed.</summary>
</Statistics>
</members>
<members name="SqlClientCommandError">
<SqlClientCommandError>
<summary>Contains diagnostic information emitted after a command execution fails with an exception.</summary>
</SqlClientCommandError>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<ConnectionId>
<summary>A nullable guid uniquely identifying the connection that the command is being executed on.</summary>
</ConnectionId>
<TransactionId>
<summary>A nullable long uniquely identifying the transaction that the command is enrolled in if it is enrolled in one, or null.</summary>
</TransactionId>
<Command>
<summary>The command object that is executing.</summary>
</Command>
<Exception>
<summary>The exception object that caused the command execution to fail.</summary>
</Exception>
</members>
<members name="SqlClientConnectionOpenBefore">
<SqlClientConnectionOpenBefore>
<summary>Contains diagnostic information emitted before a connection is opened.</summary>
</SqlClientConnectionOpenBefore>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<Connection>
<summary>The connection object that is being opened.</summary>
</Connection>
<ClientVersion>
<summary>The version of the SqlClient library.</summary>
</ClientVersion>
</members>
<members name="SqlClientConnectionOpenAfter">
<SqlClientConnectionOpenAfter>
<summary>Contains diagnostic information emitted after a connection has been successfully opened.</summary>
</SqlClientConnectionOpenAfter>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<Connection>
<summary>The connection object that has been opened.</summary>
</Connection>
<ClientVersion>
<summary>The version of the SqlClient library.</summary>
</ClientVersion>
<ConnectionId>
<summary>The unique guid assigned to the connection.</summary>
</ConnectionId>
<Statistics>
<summary>An IDictionary of statistic information about the event that has completed.</summary>
</Statistics>
</members>
<members name="SqlClientConnectionOpenError">
<SqlClientConnectionOpenError>
<summary>Contains diagnostic information emitted after a connection open fails with an exception.</summary>
</SqlClientConnectionOpenError>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<Connection>
<summary>The connection object that has been opened.</summary>
</Connection>
<ClientVersion>
<summary>The version of the SqlClient library.</summary>
</ClientVersion>
<ConnectionId>
<summary>The unique guid assigned to the connection.</summary>
</ConnectionId>
<Exception>
<summary>The exception object that caused the command execution to fail.</summary>
</Exception>
</members>
<members name="SqlClientConnectionCloseBefore">
<SqlClientConnectionCloseBefore>
<summary>Contains diagnostic information emitted before a connection is closed.</summary>
</SqlClientConnectionCloseBefore>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<Connection>
<summary>The connection object that is being closed.</summary>
</Connection>
<ConnectionId>
<summary>The unique guid assigned to the connection.</summary>
</ConnectionId>
<Statistics>
<summary>An IDictionary of statistic information about the connection.</summary>
</Statistics>
</members>
<members name="SqlClientConnectionCloseAfter">
<SqlClientConnectionCloseAfter>
<summary>Contains diagnostic information emitted after a connection has been successfully closed.</summary>
</SqlClientConnectionCloseAfter>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<Connection>
<summary>The connection object that has been closed.</summary>
</Connection>
<ConnectionId>
<summary>The unique guid assigned to the connection.</summary>
</ConnectionId>
<Statistics>
<summary>An IDictionary of statistic information about the connection.</summary>
</Statistics>
</members>
<members name="SqlClientConnectionCloseError">
<SqlClientConnectionCloseError>
<summary>Contains diagnostic information emitted after a connection close fails with an exception.</summary>
</SqlClientConnectionCloseError>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<Connection>
<summary>The connection object that has been closed.</summary>
</Connection>
<ConnectionId>
<summary>The unique guid assigned to the connection.</summary>
</ConnectionId>
<Statistics>
<summary>An IDictionary of statistic information about the connection.</summary>
</Statistics>
<Exception>
<summary>The exception object that caused the command execution to fail.</summary>
</Exception>
</members>
<members name="SqlClientTransactionCommitBefore">
<SqlClientTransactionCommitBefore>
<summary>Contains diagnostic information emitted before a transaction is opened.</summary>
</SqlClientTransactionCommitBefore>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<Connection>
<summary>The connection object that the transaction belongs to.</summary>
</Connection>
<IsolationLevel>
<summary>The IsolationLevel of the transaction.</summary>
</IsolationLevel>
<TransactionId>
<summary>A nullable long uniquely identifying the transaction that the command is enrolled in if it is enrolled in one, or null.</summary>
</TransactionId>
</members>
<members name="SqlClientTransactionCommitAfter">
<SqlClientTransactionCommitAfter>
<summary>Contains diagnostic information emitted after a transaction is successfully committed.</summary>
</SqlClientTransactionCommitAfter>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<Connection>
<summary>The connection object that the transaction belongs to.</summary>
</Connection>
<IsolationLevel>
<summary>The IsolationLevel of the transaction.</summary>
</IsolationLevel>
<TransactionId>
<summary>A nullable long uniquely identifying the transaction that the command is enrolled in if it is enrolled in one, or null.</summary>
</TransactionId>
</members>
<members name="SqlClientTransactionCommitError">
<SqlClientTransactionCommitError>
<summary>Contains diagnostic information emitted after a transaction commit fails with an exception.</summary>
</SqlClientTransactionCommitError>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<Connection>
<summary>The connection object that the transaction belongs to.</summary>
</Connection>
<IsolationLevel>
<summary>The IsolationLevel of the transaction.</summary>
</IsolationLevel>
<TransactionId>
<summary>A nullable long uniquely identifying the transaction that the command is enrolled in if it is enrolled in one, or null.</summary>
</TransactionId>
<Exception>
<summary>The exception object that caused the command execution to fail.</summary>
</Exception>
</members>
<members name="SqlClientTransactionRollbackBefore">
<SqlClientTransactionRollbackBefore>
<summary>Contains diagnostic information emitted before a transaction rollback is rolled back.</summary>
</SqlClientTransactionRollbackBefore>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<Connection>
<summary>The connection object that the transaction belongs to.</summary>
</Connection>
<IsolationLevel>
<summary>The IsolationLevel of the transaction.</summary>
</IsolationLevel>
<TransactionId>
<summary>A nullable long uniquely identifying the transaction that the command is enrolled in if it is enrolled in one, or null.</summary>
</TransactionId>
<TransactionName>
<summary>The name of the transaction which is being rolled back.</summary>
</TransactionName>
</members>
<members name="SqlClientTransactionRollbackAfter">
<SqlClientTransactionRollbackAfter>
<summary>Contains diagnostic information emitted after a transaction is rolled back successfully.</summary>
</SqlClientTransactionRollbackAfter>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<Connection>
<summary>The connection object that the transaction belongs to.</summary>
</Connection>
<IsolationLevel>
<summary>The IsolationLevel of the transaction.</summary>
</IsolationLevel>
<TransactionId>
<summary>A nullable long uniquely identifying the transaction, or null.</summary>
</TransactionId>
<TransactionName>
<summary>The name of the transaction which is being rolled back.</summary>
</TransactionName>
</members>
<members name="SqlClientTransactionRollbackError">
<SqlClientTransactionRollbackError>
<summary>Contains diagnostic information emitted after a transaction roll back failes with an exception.</summary>
</SqlClientTransactionRollbackError>
<Name>
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
</Name>
<Connection>
<summary>The connection object that the transaction belongs to.</summary>
</Connection>
<IsolationLevel>
<summary>The IsolationLevel of the transaction.</summary>
</IsolationLevel>
<TransactionId>
<summary>A nullable long uniquely identifying the transaction , or null.</summary>
</TransactionId>
<TransactionName>
<summary>The name of the transaction which is being rolled back.</summary>
</TransactionName>
<Exception>
<summary>The exception object that caused the command execution to fail.</summary>
</Exception>
</members>
</docs>
Loading

0 comments on commit 55f48c5

Please sign in to comment.