MySQL & UWP - Unable to perform a query

I'm working on UWP (Fall Creators Update) and I'm getting two exceptions upon trying ExecuteReader().

This is my code:

 MySqlConnection conn = Util.GetConnection("Server=localhost;Port=3306;Database=sample;Uid=root;Pwd=;CharSet=utf8;SslMode=None;");
 conn.Open();
 string Command = "SELECT id, role FROM tblUsers WHERE username = @user AND password = @pass";

 MySqlCommand cmd = new MySqlCommand(Command, conn);
 cmd.CommandType = CommandType.Text;

 // handle username and password
 cmd.Parameters.AddWithValue("@user", UserName);
 cmd.Parameters.AddWithValue("@pass", Password);

 cmd.Prepare();

 MySqlDataReader reader = cmd.ExecuteReader(); // <-- throws an exception.

 reader.Read();

 ...

Checked the query itself and the connection string, they're all fine. The exceptions I'm getting are:

Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.ni.dll
Exception thrown: 'System.ArgumentOutOfRangeException' in System.Private.CoreLib.ni.dll
  • I saw here that I might need to CreateCommand() but I still get the exceptions.
  • It was suggested here to include a charset declaration in the connection string. I had that from the beginning, didn't affect the outcome.