Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 954
RiverRunner Avatar asked Aug 23 '16 20:08

RiverRunner


2 Answers

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.

like image 113
Lars Meldgård Avatar answered Sep 28 '22 15:09

Lars Meldgård


I had this problem today, following the tips here that it is a "version mismatch" is completely correct!

My important "discovery" is that they have renamed the package you need for EF6! As many people here has discovered (for example "Nofi"), downgrading to match versions fixes the problem. However, instead of downgrading the new versions, swap out the Mysql.Data.Entity package for the newer MySql.Data.EntityFramework! :)

short: use MySql.Data.EntityFramework, NOT Mysql.Data.Entity

like image 41
Magnus Ingwersen Avatar answered Sep 28 '22 16:09

Magnus Ingwersen