2
I created a connection class for my application in Xamarin, but every time I try to connect throws this exception:
"The type initializer for 'Mysql.Data.Mysqlclient.Replication.Replicationmanager' threw an Exception"
Follow the example code
private static MySqlConnection _conexao = new MySqlConnection();
public void Conectar()
{
_conexao.ConnectionString = string.Format("server={0};database={1};uid={2}; pwd={3}", Server, Database, Usuario, Senha);
try
{
_conexao.Open();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
Does anyone know what it might be? Past server information, database, user and password, are correct, I’ve checked.
Go on Project → Properties → Debug and check the option Enable Native code debbuging. Run the program again.
– stderr
In the source code, it looks like it’s that line exception.
– stderr
I couldn’t find this option in my VS, it doesn’t have a Debug tab.
– Junior Freitas