Bug #104910 MySqlConnectionStringBuilder.TryGetValue always returns false
Submitted: 10 Sep 2021 20:03 Modified: 31 May 2022 16:22
Reporter: Bradley Grainger (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:8.0.26 OS:Windows (10)
Assigned to: CPU Architecture:Any

[10 Sep 2021 20:03] Bradley Grainger
Description:
DbConnectionStringBuilder "lets developers safely retrieve a value from a DbConnectionStringBuilder without needing to first call the ContainsKey method" (https://docs.microsoft.com/en-us/dotnet/api/system.data.common.dbconnectionstringbuilder.t...).

The MySQL Connector/NET implementation of TryGetValue always returns false.

How to repeat:
Run the following C# code:

var csb = new MySqlConnectionStringBuilder { MinimumPoolSize = 1 };

// getting properties by string does work
var contains = csb.ContainsKey("Minimum Pool Size"); // returns true
var size = csb["Minimum Pool Size"]; // returns 1

// returns false (and sets value to null); expected 'true' and '1'
csb.TryGetValue("Minimum Pool Size", out var value);
[14 Sep 2021 10:25] MySQL Verification Team
Hello Bradley Grainger,

Thank you for the bug report.
Verified as described.

Regards,
Ashwini Patil
[31 May 2022 16:22] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL Connector/NET 8.0.30 release, and here's the proposed changelog entry from the documentation team:

Connector/NET now implements the MySqlConnectionStringBuilder.TryGetValue
method.

Thank you for the bug report.