I've been using visual studio 2019 and was following a tutorial on how to set up an online database. In the first step of making the connection, I got an error saying:
System.TypeInitializationException: The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception.
this error has been solved in previous versions of visual studio but I haven't found anything about it in visual studio 2019.
This is the tutorial I was following: https://youtu.be/FOZ8HNJMXXg
I've been searching around for this error and found people having the exact same error in much earlier versions of visual studio. their solution was to turn on "SQL Server Debugging" (See this answer https://stackoverflow.com/a/20788018/11327572 )
I've looked for the option but couldn't find it anywhere. I've also searched for the error in visual studio 2019 but couldn't find anything on it.
MySqlConnection con = new MySqlConnection("server=db4free.net;port=3306;database=***;User Id=***;Password=***!;charset=utf8");
try
{
if (con.State == ConnectionState.Closed)
{
con.Open(); //this is the line the break comes up on.
Log.Debug("MySQL connected", con.ToString());
}
con.Close();
}catch(MySqlException ex)
{
Log.Debug("MySQL error", ex.ToString());
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…