NickCraver/StackExchange.Exceptional

Could not load type MySqlConnection from assembly MySqlConnector

kellielellie1 opened this issue · 4 comments

Trying out Exceptional, but unable to log to mysql.

Using:
2.2.17 StackExchange.Exceptional.AspNetCore
2.2.17 StackExchange.Exceptional.MySQL

Error:

System.TypeLoadException: Could not load type 'MySql.Data.MySqlClient.MySqlConnection' from assembly 'MySqlConnector, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d33d3e53aa5f8c92'.
at StackExchange.Exceptional.Stores.MySQLErrorStore.LogError(Error error)
at StackExchange.Exceptional.ErrorStore.TestAsync()

Also, is the documentation incorrect for the connection string parameters here? Looks like a SQL parameters.
https://nickcraver.com/StackExchange.Exceptional/Providers/MySQL

I started getting this error when I upgraded to dotnet 5.0. Not sure what's going on yet.

Probably the problem, https://stackoverflow.com/questions/64148098/usemysql-in-pomelo-throwing-exception

It's a version mismatch. MySqlConnector changed its namespace in version 1.0.0. Since this is a breaking change and Pomelo is SemVer2 compliant, Pomelo is still using MySqlConnector < 1.0.0 (currently 0.69.9).

Later versions of Pomelo (e.g. the current version 3.2.2) explicitly restrict the MySqlConnector version to below 1.0.0, so that using a MySqlConnection version >= 1.0.0 would lead to a compile time error instead of a runtime error.

So to fix the issue, use the latest version of MySqlConnector below 1.0.0.

On a side note, you should consider using EF Core 3.1.8 and Pomelo 3.2.2. There have been many bugfixes for Pomelo since version 3.0.1.

I'm using the most recent Pomelo that requires MySqlConnector >= 1.1.0

I'm not sure how to go about fixing this one. Might have to remove Exceptional until it gets fixed.

I created a pull request that upgrades MySqlConnector to version 1.2.0, not sure how it will affect others though. Not real confident it'll be merged.

#199

Closed via #199 :) I'll try and get a release up next week dogfooding on Stack Overflow first...though not this provider specifically). It's available on MyGet now!