title: Problem with Connecting to AWS RDS MySQL Database with Xamarin Forms App (C#, Android Emulator)
body: <p>Hi stackoverflow community,</p>
  <p>I am trying my hands on some Xamarin Forms to code my own app. Together with that I want to expand my knowledge about AWS RDS.
  While Coding a Database class in C# that should return a value from my Database as a DisplayAlert() (on Android Emulator) I ran into an exception.&quot;System.TypeInitializationException: 'The type initializer for 'MySql.Data.MySqlClient.MySqlConfiguration' threw an exception.'&quot;
  It worked on Windows Forms.</p>
  <p>My Code:</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Text;
  using MySql.Data.MySqlClient;
  
  namespace StudyWithMe
  {
      class DB
      {
          public static MySqlConnection dbConnection;
          static string host = &quot;awsEndpoint&quot;;
          static string id = &quot;myuserid&quot;;
          static string pwd = &quot;mypassword&quot;;
          static string database = &quot;mydatabase&quot;;
          static string port = &quot;3306&quot;;
  
          public string getSalt(string email)
          {
              OpenSql();
              string query = &quot;SELECT salt&quot;;
              query += &quot; FROM Authentication WHERE email = '&quot; + email + &quot;';&quot;;
              string salt = ExecuteQuery(query).Tables[0].Rows[0][0].ToString();
              Close();
              return salt;
          }
  
          private static void OpenSql()
          {
              try
              {
                  string connectionString = string.Format(&quot;Server = {0};port={4}; Database = {1}; Uid = {2}; Pwd = {3};&quot;, host, database, id, pwd, port);
                  MySqlConnection dbConnection = new MySqlConnection(connectionString);
                  dbConnection.Open();
              }
              catch (Exception e)
              {
  
                  throw new Exception(&quot;error&quot; + e.Message.ToString());
              }
          }
          private void Close()
          {
  
              if (dbConnection != null)
              {
                  dbConnection.Close();
                  dbConnection.Dispose();
                  dbConnection = null;
              }
  
          }
  
          private static DataSet ExecuteQuery(string sqlString)
          {
              if (dbConnection.State == ConnectionState.Open)
              {
                  DataSet ds = new DataSet();
                  try
                  {
  
                      MySqlDataAdapter da = new MySqlDataAdapter(sqlString, dbConnection);
                      da.Fill(ds);
  
                  }
                  catch (Exception ee)
                  {
                      throw new Exception(&quot;SQL:&quot; + sqlString + &quot;/n&quot; + ee.Message.ToString());
                  }
                  return ds;
              }
              return null;
          }
  
      }
  }```
  
  Thanks for your help!
  PS: I did install the NuGet package MySql.Data
  </code></pre>