Entity Framework's Entity Data Wizard Crashes When Connecting to MySQL Database

RiverRunner picture RiverRunner · Aug 23, 2016 · Viewed 20.4k times · Source

I am attempting to create an Entity Data Model using the wizard to reverse engineer an existing MySQL database. I get to the Choose Your Data Connection page of the wizard, select an existing MySQL connection and click Next, and the wizard crashes. Specifically, the dialog box just disappears without an error message or any trace. Every single time. Restarting VS or Windows does nothing.

I can connect to the database using Server Explorer and the same connection without problem, so I'm fairly confident it isn't a connection problem.

This is in Visual Studio 2015 with all updates installed, version 1.2.6 of MySQL for Visual Studio, EF 6.1.3, and MySql.Data and MySql.Data.Entity.EF6 versions 6.8.3.0. It is a Console application targeting the .NET Framework 4.6.1.

Google hasn't revealed anything useful yet. Another question here from yesterday is similar, but is crashing at a different point and that user can't connect using Server Explorer. So it seems to be a different situation.

There is nothing in the Windows logs that is of any help.

How can I solve this problem?

Answer

Lars Meldgård picture Lars Meldgård · Aug 25, 2016

It is caused by version mismatch.

On my system, I had MySQL Connector 6.9.6. Issuing the command in NuGet Package Manger Console:

Install-Package MySql.Data.Entity installs version 6.9.8 by default. Your connector must match the actual version of the NuGet Package. You can download an updated version of the connector from: https://www.mysql.com/products/connector/

Here select the "Ado.net driver for MySQL", and download the corresponding version (in this case 6.9.8). Reopen Visual Studio and now the wizard does not crash. No reboot required.