5

I have a MVC 5 app, that has MySQL database hosted in Azure. It was working all well, but today when I tried to type Update-Database and run it, I got the following error message:

System.Runtime.Serialization.SerializationException: Type is not resolved for member 'MySql.Data.MySqlClient.MySqlException,MySql.Data, Version=6.9.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'.
   at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
   at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
   at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force)
   at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
   at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Type is not resolved for member 'MySql.Data.MySqlClient.MySqlException,MySql.Data, Version=6.9.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d'.

What can be the problem, and how can I solve it?

2 Answers 2

9

I had this problem before:

1.- Install an update the mysql connector to the new version: http://dev.mysql.com/downloads/connector/net/

2.- Because you are trying to connect to a remote installation of MySQL you have to make sure that the port is open. You can try to connect to a local MySQL DB to verify this.

I hope this work for you too.

Sign up to request clarification or add additional context in comments.

Comments

3

Just in case someone else stumbled upon this "Type is not resolved for member" error:

This message is very misleading because it is shown for many issues that have nothing to do with what you may assume from this message.

Most of the time I was running into into this message it was some code within a mapped class throwing an exception while the Seed method was executing. Watch out for custom ToString() and GetHashCode() implementations.

The VS debugger is your best friend in this case. Just add the following code to your Seed() method:

   if (System.Diagnostics.Debugger.IsAttached == false)
      System.Diagnostics.Debugger.Launch();

Launch a second VS instance with your project before running the Update-Database command and you should see what is wrong.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.