Misleading error when using with MariaDB 10.6 (EvolveException: Connection to this DBMS is not supported.)
leepfrog-ger opened this issue · comments
Thanks for this great library!
I spend a few hours troubleshooting a specific issue that came up when updating my DB server from Maria DB 10.4 to 10.6. To save others some time that may run into the same issue, here is my analysis.
While - to my understanding - ultimately the issue lies within the defaults chosen by MariaDB 10.6 and incompatibilities of the .NET Framework the error handling could be optimized to be a bit more specific to allow people to find the issue quicker.
Issue: After updating the Evole.Migrate()
method failed with the following Exception/Stacktrace:
Evolve.EvolveException: Connection to this DBMS is not supported.
at Evolve.WrappedConnectionEx.GetDatabaseServerType(WrappedConnection wrappedConnection)
at Evolve.Evolve..ctor(DbConnection dbConnection, Action`1 logDelegate)
After debugging Evolve itself it turned out that in GetDatabaseServerType all try/catch blocks failed and so finally EvolveException(DBMSNotSupported)
is thrown.
This was especially strange because
- the commands (e.g.
SHOW VARIABLES LIKE '%version%';
) execute fine and return the correct results from a MySQL client - the MariaDB query logs show that the queries are successfully executed when sent by Evolve
Digging deeper I could see that the cause for this is that an EvolveSqlException
is thrown in the Execute method with the not very helpful message of The given key '28265' was not present in the dictionary.
.
The underlying issue is an NotSupportedException thrown in MySql.Data.MySqlClient: Character set 'utf8mb3' is not supported by .Net Framework.
Apparently MariaDB 10.6 defaults to utf8mb3 for internal databases, so that the results from SHOW VARIABLES LIKE '%version%';
are utf8mb3 and thus not understood by the MySqlClient libaray.
Some further references I found regarding this:
- https://stackoverflow.com/questions/68645324/system-notsupportedexception-character-set-utf8mb3-is-not-supported-by-net-f
- https://jira.mariadb.org/browse/MDEV-26105?attachmentViewMode=list
- Pryaxis/TShock#2350
I did not find any way around that except for restoring to my MariaDB 10.4 backup and only upgrade to 10.5 which worked fine.
I understand that the actual issue is outside of the influence of Evolve, however maybe there is an option for a refiend error message or exception handling for similar cases (e.g. pass the inner exceptions from the MySQL Provider), because the generic Exceptions thats thrown when just using the Nuget Package did not help to get to the bottom of this.
Hi @leepfrog-ger and thanks for this very detailled issue.
- Do you have any news concerning this issue ?
- Are you again limited to MariaDB 10.5 ?
- What .NET driver lib do you use to connect to your database ? (
MySql.Data
orMySqlConnector
) Have you tried both ?
Hi @lecaillon,
thanks for your followup. For now I've decided to stick with MariaDB 10.5 as I don't have any requirements for the newer version, so right now everything is working fine.
I've only tried with MySql.Data
because I did not want to change more than necessary in my application, but given that the other links indicate that it is a .net limitation I'm not sure whether that would help.
I'm closing the issue. Feel free to re-open it or create a new one when you have any update