Bug #110791 OpenAsync(CancellationToken) doesn't throw for cancelled token
Submitted: 24 Apr 18:51 Modified: 2 May 5:56
Reporter: Bradley Grainger (OCA) Email Updates:
Status: Verified Impact on me:
Category:Connector / NET Severity:S3 (Non-critical)
Version:8.0.33 OS:Windows (10)
Assigned to: CPU Architecture:Any

[24 Apr 18:51] Bradley Grainger
If MySqlConnection.OpenAsync(CancellationToken) is called with a cancelled CancellationToken, and if there is a ready connection in the pool, the pooled connection is returned. The expectation is that any method called with a cancelled CancellationToken will throw a TaskCanceledException.

This was fixed in 8.0.30 for bug #106243 but now regressed in 8.0.33.

How to repeat:
Run the following C# code. Expectation is that an exception is thrown from the last line, but it is not.

using var connection = new MySqlConnection("...");

using var cts = new CancellationTokenSource();
await connection.OpenAsync(cts.Token);
[2 May 5:56] MySQL Verification Team
Hello Bradley Grainger,

Thank you for the bug report.
Verified as described.

Ashwini Patil