0

MySQLBackup.net works fine on Windows applications, but not in Xamarin (tested with exact same code).

Is there any workaround or alternatives that I can use ? I'm really lost...

I want to backup my database from a Linux (Debian9) MariaDB server, so I found MySqlBackup.NET, but nothing can make it work with Xamarin.

There's my code to backup (works in windows console app):

                // Use MySqlBackup.Net to backup database
                using (var conn = new MySqlConnection("myconnstring"))
                {
                    conn.Open();

                    using (MySqlCommand cmd = new MySqlCommand())
                    {
                        conn.Open();

                        using (MySqlBackup mb = new MySqlBackup(cmd))
                        {
                            cmd.Connection = conn;
                            mb.ExportToFile(Constants.EXPORT_PATH + "/dolibarr_" + identifier + "dataBackup.sql");
                            conn.Close();
                        }
                    }
                }

Getting exception: The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception.

  • Often there's an InnerException or a "Caused By" exception in the stack trace - can you find that? – GregHNZ May 19 '19 at 07:07
  • You may try the new Nuget version of this library which includes .NET Strandard 2.0 that is expected to work in Xamarin. – mjb Oct 27 '19 at 13:48

1 Answers1

0

I am the author of this library. MySqlBackup.NET uses 3 types of connector. You may use the version which runs with MySqlConnector, this version has the best compatibility for cross platform.

https://www.nuget.org/packages/MySqlBackup.NET.MySqlConnector

adriancs
  • 1
  • 2