NickCraver / StackExchange.Exceptional

Error handler used for the Stack Exchange network
https://nickcraver.com/StackExchange.Exceptional/
Apache License 2.0
862 stars 170 forks source link

Could not load type MySqlConnection from assembly MySqlConnector #198

Closed kellielellie1 closed 3 years ago

kellielellie1 commented 3 years ago

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

johnboker commented 3 years ago

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

johnboker commented 3 years ago

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.

johnboker commented 3 years ago

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.

https://github.com/NickCraver/StackExchange.Exceptional/pull/199

NickCraver commented 3 years ago

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!