Bug #119211 'SSL Mode=None' removed without notice
Submitted: 22 Oct 15:54
Reporter: Bradley Grainger (OCA) Email Updates:
Status: Open Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:9.5.0 OS:Windows (11)
Assigned to: CPU Architecture:Any

[22 Oct 15:54] Bradley Grainger
Description:
Execute the following C# code:

var connection = new MySqlConnection("SSL Mode=None");

With MySql.Data 9.4.0, the code succeeds.

With MySql.Data 9.5.0, the following exception is thrown:

ArgumentException: Requested value 'None' was not found.	
   at System.Enum.TryParseByName[TStorage](RuntimeType enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, TStorage& result)
   at System.Enum.TryParseByValueOrName[TUnderlying,TStorage](RuntimeType enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, TUnderlying& result)
   at System.Enum.TryParse(Type enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, Object& result)
   at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
   at MySql.Data.MySqlClient.MySqlBaseConnectionStringBuilder.<>c.<.cctor>b__1_2(MySqlBaseConnectionStringBuilder msb, MySqlConnectionStringOption sender, Object value)
   at MySql.Data.MySqlClient.MySqlConnectionStringBuilder.set_Item(String keyword, Object value)
   at System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value)
   at MySql.Data.MySqlClient.MySqlConnectionStringBuilder..ctor(String connectionString, Boolean isAnalyzed)
   at MySql.Data.MySqlClient.MySqlConnection.set_ConnectionString(String value)
   at MySql.Data.MySqlClient.MySqlConnection..ctor(String connectionString)

MySqlSslMode.None was marked as deprecated in 8.0.29 (https://dev.mysql.com/doc/relnotes/connector-net/en/news-8-0-29.html):

> The SslMode=none connection-option value is deprecated (marked obsolete) and is replaced with the SslMode=disabled connection-option value.

The option was removed from the source code in 9.5.0: https://github.com/mysql/mysql-connector-net/commit/4f8695844646cc3073b1e80037eeee12491838...

The 9.5.0 release notes (https://dev.mysql.com/doc/relnotes/connector-net/en/news-9-5-0.html) only mention:

> Removed the misspelled option, Prefered, from MySqlSslMode. (WL #17115)

How to repeat:
Execute the following C# code:

var connection = new MySqlConnection("SSL Mode=None");

Suggested fix:
Add an announcement to the 9.5.0 release notes at https://dev.mysql.com/doc/relnotes/connector-net/en/news-9-5-0.html:

* Removed the deprecated option, None, from MySqlSslMode.