Skip to content

Commit 54e8fae

Browse files
committed
Merge branch 'main' of https://github.com/dotnet/SqlClient into tokenCache
2 parents dc81fcb + a7405de commit 54e8fae

File tree

69 files changed

+2948
-519
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2948
-519
lines changed

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66

7+
## [Stable release 5.2.1] - 2024-05-31
8+
9+
This update brings the below changes over the previous release:
10+
11+
### Changed
12+
13+
- 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)
14+
- Upgraded `Microsoft.Identity.Client` version from 4.56.0 to 4.60.3 [#2492](https://github.com/dotnet/SqlClient/pull/2492)
15+
- Code Health improvements: [#2467](https://github.com/dotnet/SqlClient/pull/2467)
16+
17+
### Fixed
18+
19+
- Fixed connection errors on Linux when Data Source property contains both named instance and port [#2436](https://github.com/dotnet/SqlClient/pull/2436)
20+
- Fixed `SqlConnection.FireInfoMessageEventOnUserErrors` when set to true throws an exception [#2505](https://github.com/dotnet/SqlClient/pull/2505)
21+
- 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)
22+
- 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)
23+
- Fixed `SqlConnection.Clone()` to include `AccessTokenCallback` [#2527](https://github.com/dotnet/SqlClient/pull/2527)
24+
725
## [Stable release 5.2.0] - 2024-02-28
826

927
### Added

build.proj

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
<Import Project="$(ToolsDir)targets\add-ons\GenerateAKVProviderNugetPackage.targets" />
77

88
<PropertyGroup>
9+
<!-- SourceLink variable-->
10+
<DisableSourceLink>false</DisableSourceLink>
11+
912
<RestoreConfigFile>src\NuGet.config</RestoreConfigFile>
1013
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
1114
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>

doc/samples/SqlConnection_AccessTokenCallback.cs

+11-4
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,21 @@ static void Main()
1414

1515
private static void OpenSqlConnection()
1616
{
17+
const string defaultScopeSuffix = "/.default";
1718
string connectionString = GetConnectionString();
18-
using (SqlConnection connection = new SqlConnection("Data Source=contoso.database.windows.net;Initial Catalog=AdventureWorks;")
19+
DefaultAzureCredential credential = new();
20+
21+
using (SqlConnection connection = new(connectionString)
1922
{
2023
AccessTokenCallback = async (authParams, cancellationToken) =>
2124
{
22-
var cred = new DefaultAzureCredential();
23-
string scope = authParams.Resource.EndsWith(s_defaultScopeSuffix) ? authParams.Resource : authParams.Resource + s_defaultScopeSuffix;
24-
var token = await cred.GetTokenAsync(new TokenRequestContext(new[] { scope }), cancellationToken);
25+
string scope = authParams.Resource.EndsWith(defaultScopeSuffix)
26+
? authParams.Resource
27+
: $"{authParams.Resource}{defaultScopeSuffix}";
28+
AccessToken token = await credential.GetTokenAsync(
29+
new TokenRequestContext([scope]),
30+
cancellationToken);
31+
2532
return new SqlAuthenticationToken(token.Token, token.ExpiresOn);
2633
}
2734
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,312 @@
1+
<?xml version="1.0"?>
2+
<docs>
3+
<members name="SqlClientDiagnostic">
4+
<OperationId>
5+
<summary>A guid value used to correlate before, after and error events.</summary>
6+
</OperationId>
7+
<Operation>
8+
<summary>The name of the operation.</summary>
9+
</Operation>
10+
<Timestamp>
11+
<summary>The timestamp of the event.</summary>
12+
</Timestamp>
13+
<Item1>
14+
<summary>
15+
Gets the element at the specified index in the read-only list.
16+
</summary>
17+
<param name="index">The zero-based index of the element to get.</param>
18+
<returns>The element at the specified index in the read-only list.</returns>
19+
<exception cref="IndexOutOfRangeException"></exception>
20+
</Item1>
21+
<Count>
22+
<summary>Gets the number of elements in the collection.</summary>
23+
<returns>The number of elements in the collection.</returns>
24+
</Count>
25+
<GetEnumerator>
26+
<summary>Returns an enumerator that iterates through the collection.</summary>
27+
<returns>An enumerator that can be used to iterate through the collection.</returns>
28+
</GetEnumerator>
29+
</members>
30+
<members name="SqlClientCommandBefore">
31+
<SqlClientCommandBefore>
32+
<summary>Contains diagnostic information emitted before a command is executed.</summary>
33+
</SqlClientCommandBefore>
34+
<Name>
35+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
36+
</Name>
37+
<ConnectionId>
38+
<summary>A nullable guid uniquely identifying the connection that the xommand is being executed on.</summary>
39+
</ConnectionId>
40+
<TransactionId>
41+
<summary>A nullable long uniquely identifying the transaction that the command enrolled in if it is enrolled in one.</summary>
42+
</TransactionId>
43+
<Command>
44+
<summary>The command object that is executing.</summary>
45+
</Command>
46+
</members>
47+
<members name="SqlClientCommandAfter">
48+
<SqlClientCommandAfter>
49+
<summary>Contains diagnostic information emitted after a command is successfully executed.</summary>
50+
</SqlClientCommandAfter>
51+
<Name>
52+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
53+
</Name>
54+
<ConnectionId>
55+
<summary>A nullable guid uniquely identifying the connection that the command is being executed on.</summary>
56+
</ConnectionId>
57+
<TransactionId>
58+
<summary>A nullable long uniquely identifying the transaction that the command is enrolled in if it is enrolled in one, or null.</summary>
59+
</TransactionId>
60+
<Command>
61+
<summary>The command object that is executing.</summary>
62+
</Command>
63+
<Statistics>
64+
<summary>An IDictionary of statistic information about the event that has completed.</summary>
65+
</Statistics>
66+
</members>
67+
<members name="SqlClientCommandError">
68+
<SqlClientCommandError>
69+
<summary>Contains diagnostic information emitted after a command execution fails with an exception.</summary>
70+
</SqlClientCommandError>
71+
<Name>
72+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
73+
</Name>
74+
<ConnectionId>
75+
<summary>A nullable guid uniquely identifying the connection that the command is being executed on.</summary>
76+
</ConnectionId>
77+
<TransactionId>
78+
<summary>A nullable long uniquely identifying the transaction that the command is enrolled in if it is enrolled in one, or null.</summary>
79+
</TransactionId>
80+
<Command>
81+
<summary>The command object that is executing.</summary>
82+
</Command>
83+
<Exception>
84+
<summary>The exception object that caused the command execution to fail.</summary>
85+
</Exception>
86+
</members>
87+
<members name="SqlClientConnectionOpenBefore">
88+
<SqlClientConnectionOpenBefore>
89+
<summary>Contains diagnostic information emitted before a connection is opened.</summary>
90+
</SqlClientConnectionOpenBefore>
91+
<Name>
92+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
93+
</Name>
94+
<Connection>
95+
<summary>The connection object that is being opened.</summary>
96+
</Connection>
97+
<ClientVersion>
98+
<summary>The version of the SqlClient library.</summary>
99+
</ClientVersion>
100+
</members>
101+
<members name="SqlClientConnectionOpenAfter">
102+
<SqlClientConnectionOpenAfter>
103+
<summary>Contains diagnostic information emitted after a connection has been successfully opened.</summary>
104+
</SqlClientConnectionOpenAfter>
105+
<Name>
106+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
107+
</Name>
108+
<Connection>
109+
<summary>The connection object that has been opened.</summary>
110+
</Connection>
111+
<ClientVersion>
112+
<summary>The version of the SqlClient library.</summary>
113+
</ClientVersion>
114+
<ConnectionId>
115+
<summary>The unique guid assigned to the connection.</summary>
116+
</ConnectionId>
117+
<Statistics>
118+
<summary>An IDictionary of statistic information about the event that has completed.</summary>
119+
</Statistics>
120+
</members>
121+
<members name="SqlClientConnectionOpenError">
122+
<SqlClientConnectionOpenError>
123+
<summary>Contains diagnostic information emitted after a connection open fails with an exception.</summary>
124+
</SqlClientConnectionOpenError>
125+
<Name>
126+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
127+
</Name>
128+
<Connection>
129+
<summary>The connection object that has been opened.</summary>
130+
</Connection>
131+
<ClientVersion>
132+
<summary>The version of the SqlClient library.</summary>
133+
</ClientVersion>
134+
<ConnectionId>
135+
<summary>The unique guid assigned to the connection.</summary>
136+
</ConnectionId>
137+
<Exception>
138+
<summary>The exception object that caused the command execution to fail.</summary>
139+
</Exception>
140+
</members>
141+
<members name="SqlClientConnectionCloseBefore">
142+
<SqlClientConnectionCloseBefore>
143+
<summary>Contains diagnostic information emitted before a connection is closed.</summary>
144+
</SqlClientConnectionCloseBefore>
145+
<Name>
146+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
147+
</Name>
148+
<Connection>
149+
<summary>The connection object that is being closed.</summary>
150+
</Connection>
151+
<ConnectionId>
152+
<summary>The unique guid assigned to the connection.</summary>
153+
</ConnectionId>
154+
<Statistics>
155+
<summary>An IDictionary of statistic information about the connection.</summary>
156+
</Statistics>
157+
</members>
158+
<members name="SqlClientConnectionCloseAfter">
159+
<SqlClientConnectionCloseAfter>
160+
<summary>Contains diagnostic information emitted after a connection has been successfully closed.</summary>
161+
</SqlClientConnectionCloseAfter>
162+
<Name>
163+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
164+
</Name>
165+
<Connection>
166+
<summary>The connection object that has been closed.</summary>
167+
</Connection>
168+
<ConnectionId>
169+
<summary>The unique guid assigned to the connection.</summary>
170+
</ConnectionId>
171+
<Statistics>
172+
<summary>An IDictionary of statistic information about the connection.</summary>
173+
</Statistics>
174+
</members>
175+
<members name="SqlClientConnectionCloseError">
176+
<SqlClientConnectionCloseError>
177+
<summary>Contains diagnostic information emitted after a connection close fails with an exception.</summary>
178+
</SqlClientConnectionCloseError>
179+
<Name>
180+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
181+
</Name>
182+
<Connection>
183+
<summary>The connection object that has been closed.</summary>
184+
</Connection>
185+
<ConnectionId>
186+
<summary>The unique guid assigned to the connection.</summary>
187+
</ConnectionId>
188+
<Statistics>
189+
<summary>An IDictionary of statistic information about the connection.</summary>
190+
</Statistics>
191+
<Exception>
192+
<summary>The exception object that caused the command execution to fail.</summary>
193+
</Exception>
194+
</members>
195+
<members name="SqlClientTransactionCommitBefore">
196+
<SqlClientTransactionCommitBefore>
197+
<summary>Contains diagnostic information emitted before a transaction is opened.</summary>
198+
</SqlClientTransactionCommitBefore>
199+
<Name>
200+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
201+
</Name>
202+
<Connection>
203+
<summary>The connection object that the transaction belongs to.</summary>
204+
</Connection>
205+
<IsolationLevel>
206+
<summary>The IsolationLevel of the transaction.</summary>
207+
</IsolationLevel>
208+
<TransactionId>
209+
<summary>A nullable long uniquely identifying the transaction that the command is enrolled in if it is enrolled in one, or null.</summary>
210+
</TransactionId>
211+
</members>
212+
<members name="SqlClientTransactionCommitAfter">
213+
<SqlClientTransactionCommitAfter>
214+
<summary>Contains diagnostic information emitted after a transaction is successfully committed.</summary>
215+
</SqlClientTransactionCommitAfter>
216+
<Name>
217+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
218+
</Name>
219+
<Connection>
220+
<summary>The connection object that the transaction belongs to.</summary>
221+
</Connection>
222+
<IsolationLevel>
223+
<summary>The IsolationLevel of the transaction.</summary>
224+
</IsolationLevel>
225+
<TransactionId>
226+
<summary>A nullable long uniquely identifying the transaction that the command is enrolled in if it is enrolled in one, or null.</summary>
227+
</TransactionId>
228+
</members>
229+
<members name="SqlClientTransactionCommitError">
230+
<SqlClientTransactionCommitError>
231+
<summary>Contains diagnostic information emitted after a transaction commit fails with an exception.</summary>
232+
</SqlClientTransactionCommitError>
233+
<Name>
234+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
235+
</Name>
236+
<Connection>
237+
<summary>The connection object that the transaction belongs to.</summary>
238+
</Connection>
239+
<IsolationLevel>
240+
<summary>The IsolationLevel of the transaction.</summary>
241+
</IsolationLevel>
242+
<TransactionId>
243+
<summary>A nullable long uniquely identifying the transaction that the command is enrolled in if it is enrolled in one, or null.</summary>
244+
</TransactionId>
245+
<Exception>
246+
<summary>The exception object that caused the command execution to fail.</summary>
247+
</Exception>
248+
</members>
249+
<members name="SqlClientTransactionRollbackBefore">
250+
<SqlClientTransactionRollbackBefore>
251+
<summary>Contains diagnostic information emitted before a transaction rollback is rolled back.</summary>
252+
</SqlClientTransactionRollbackBefore>
253+
<Name>
254+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
255+
</Name>
256+
<Connection>
257+
<summary>The connection object that the transaction belongs to.</summary>
258+
</Connection>
259+
<IsolationLevel>
260+
<summary>The IsolationLevel of the transaction.</summary>
261+
</IsolationLevel>
262+
<TransactionId>
263+
<summary>A nullable long uniquely identifying the transaction that the command is enrolled in if it is enrolled in one, or null.</summary>
264+
</TransactionId>
265+
<TransactionName>
266+
<summary>The name of the transaction which is being rolled back.</summary>
267+
</TransactionName>
268+
</members>
269+
<members name="SqlClientTransactionRollbackAfter">
270+
<SqlClientTransactionRollbackAfter>
271+
<summary>Contains diagnostic information emitted after a transaction is rolled back successfully.</summary>
272+
</SqlClientTransactionRollbackAfter>
273+
<Name>
274+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
275+
</Name>
276+
<Connection>
277+
<summary>The connection object that the transaction belongs to.</summary>
278+
</Connection>
279+
<IsolationLevel>
280+
<summary>The IsolationLevel of the transaction.</summary>
281+
</IsolationLevel>
282+
<TransactionId>
283+
<summary>A nullable long uniquely identifying the transaction, or null.</summary>
284+
</TransactionId>
285+
<TransactionName>
286+
<summary>The name of the transaction which is being rolled back.</summary>
287+
</TransactionName>
288+
</members>
289+
<members name="SqlClientTransactionRollbackError">
290+
<SqlClientTransactionRollbackError>
291+
<summary>Contains diagnostic information emitted after a transaction roll back failes with an exception.</summary>
292+
</SqlClientTransactionRollbackError>
293+
<Name>
294+
<summary>The name of the event that needs to be enabled for the event to be raised.</summary>
295+
</Name>
296+
<Connection>
297+
<summary>The connection object that the transaction belongs to.</summary>
298+
</Connection>
299+
<IsolationLevel>
300+
<summary>The IsolationLevel of the transaction.</summary>
301+
</IsolationLevel>
302+
<TransactionId>
303+
<summary>A nullable long uniquely identifying the transaction , or null.</summary>
304+
</TransactionId>
305+
<TransactionName>
306+
<summary>The name of the transaction which is being rolled back.</summary>
307+
</TransactionName>
308+
<Exception>
309+
<summary>The exception object that caused the command execution to fail.</summary>
310+
</Exception>
311+
</members>
312+
</docs>

release-notes/5.1/5.1.0.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The default value of the `ServerCertificate` connection setting is an empty stri
7979

8080
#### .NET
8181

82-
- Microsoft.Data.SqlClient.SNI 5.1.0
82+
- Microsoft.Data.SqlClient.SNI.runtime 5.1.0
8383
- Azure.Identity 1.7.0
8484
- Microsoft.Identity.Client 4.47.2
8585
- Microsoft.IdentityModel.JsonWebTokens 6.24.0
@@ -95,7 +95,7 @@ The default value of the `ServerCertificate` connection setting is an empty stri
9595

9696
#### .NET Standard
9797

98-
- Microsoft.Data.SqlClient.SNI 5.1.0
98+
- Microsoft.Data.SqlClient.SNI.runtime 5.1.0
9999
- Azure.Identity 1.7.0
100100
- Microsoft.Identity.Client 4.47.2
101101
- Microsoft.IdentityModel.Protocols.OpenIdConnect 6.24.0

0 commit comments

Comments
 (0)