Bug #89338 ADO.NET Entity Data Model Wizard closes after data source selection
Submitted: 21 Jan 2018 12:18 Modified: 5 Sep 2018 15:05
Reporter: Laurents Meyer (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:6.10.5 OS:Windows
Assigned to: CPU Architecture:Any
Tags: ADO.NET, database first, EF6, entity framework, wizard

[21 Jan 2018 12:18] Laurents Meyer
Description:
After selecting the MySQL data source in the Entity Data Model wizard in visual studio and clicking on "Next", the wizard just closes.

How to repeat:
Install Connector/Net 6.10.5
Install MySQL for Visual Studio 1.2.7
Create a vanilla classic desktop console project in Visual Studio 2017.
Add the MySql.Data.Entity 6.10.5 nuget package with dependencies.
Add new project item: ADO.Net Entity Data Model
Choose "EF Designer from database"
Specify a connection and click "Next"

The wizard closes.

Suggested fix:
There can be two causes. They can come together, though each of them is enough to close the wizard.

1. Wrong Namespace reference in MySqlClientFactory (needs to be "MySql.Data.Entity.EF6" instead of "MySql.Data.Entity"). Also,  the AllowPartiallyTrustedCallers-Attribute in MySql.Data project has to be removed for the object creation to work using reflection.

2. Obsolete MySql.Data.dll and MySql.Data.Entity.dll files in the Visual Studio "Common7\IDE\PrivateAssemblies" directory. These files take precedence over the installed ones (GAC etc.). Deleting these two private assemblies fixes wizard closing issues as well (only if 1. is already fixed).

I will provide a fix for 1. via Github.
[21 Jan 2018 12:52] Laurents Meyer
Obsolete files in the private assemblies directory of Visual Studio had the version 6.9.8 in my case. They were definitely relics of a previously installed version of MySQL for Visual Studio or Connector/Net and are not present after installing the current release for the first time and thus no issue in this case.

I have send a pull request for 1. on Github.
[22 Jan 2018 2:01] Laurents Meyer
It seems that the 6.9.8 assemblies in the Private Assemblies directory are not a relic of a previous installation, but are in fact part of the current MySQL for Visual Studio 1.2.7 installation.

So the installer should include the fixed (1.) assemblies, or the bug will not be solved.
Is it even necessary to install the assemblies into the Private Assemblies directory? Shouldn't Visual Studio be able to use the assemblies from the GAC? Having a second copy of those assemblies in another location smells like trouble in first place.
[22 Jan 2018 5:49] Chiranjeevi Battula
Hello Laurents Meyer,

Thank you for the bug report.
Verified this behavior on Visual Studio 2017 (C#.Net) and Connector/NET 6.10.5 version.

Thanks,
Chiranjeevi.
[22 Jan 2018 16:07] Laurents Meyer
The via Github provided fix for 1. can be found here:
https://github.com/mysql/mysql-connector-net/pull/19
[23 Jan 2018 19:15] OCA Admin
Contribution submitted via Github - Bug #89338: ADO.NET Entity Data Model Wizard closes after data source selection 
(*) Contribution by Laurents Meyer (Github lauxjpn, mysql-connector-net/pull/19#issuecomment-359267329): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: git_patch_164173302.txt (text/plain), 4.32 KiB.

[1 Feb 2018 4:57] Bradley Grainger
A number of Stack Overflow posts are reporting this problem:
https://stackoverflow.com/questions/48472450/cant-create-an-entity-framework-in-visual-stu...
https://stackoverflow.com/questions/48546456/i-cant-create-model-in-vs2017-from-mysql/
[19 Mar 2018 12:53] Chiranjeevi Battula
http://bugs.mysql.com/bug.php?id=90114 marked as duplicate of this one.
[19 Mar 2018 15:19] Laurents Meyer
Why has the fix not been released yet? I have provided the code and solution two months ago!

Database first is one of the three main methods of database and application development for the entity framework and it is still broken in the current release.

This issue should be handled with the highest possible priority (which is why it has a severity of critical).

What's the status and ETA on being released?
[10 Apr 2018 16:03] Christine Cole
Fixed as of the upcoming MySQL Connector/NET 6.10.7 release, and here's the changelog entry:

The ADO.NET Entity Data Model wizard within Visual Studio closed
unexpectedly without producing the data model. Thanks to Laurents Meyer
for the patch.

Thank you for the bug report.
[31 Aug 2018 20:14] Xin Zhang
I still have this issue for 8.0.12. The patch seems not merged to latest code or got overrides ?
https://github.com/mysql/mysql-connector-net/blob/6.9/Source/MySql.Data/MySqlClientFactory...
https://github.com/mysql/mysql-connector-net/blob/6.9/Source/MySql.Data/Properties/Assembl...
https://github.com/mysql/mysql-connector-net/blob/6.9/Source/MySql.Data.EntityFramework6/P...
[5 Sep 2018 15:05] Laurents Meyer
@Xin Zhang
Your provided links are for the 6.9 releases, but this issue was resolved for the 6.0-branch with version 6.10.7.
It is possible though, that this was never merged with the 8.0-branch.

@Oracle
@Chiranjeevi Battula
@Christine Cole
What is the procedure to apply a fix from an older branch to a newer one (8.0 and maybe 7.0)?
Is it possible for somebody to cherry-pick the changes, or is it necessary to file a new bug report for each affected branch, and supply each bug report with its own fix-commit and a reference to this report?
[18 Oct 2018 19:51] Charles Peppler
I believe I have installed all the lastest versions (updated VS 2017, Community edition just now, nuGet packages), and I am having this problem.

Microsoft Visual Studio Community 2017 
Version 15.8.7
VisualStudio.15.Release/15.8.7+28010.2046
Microsoft .NET Framework
Version 4.7.03056

Installed Version: Community

C# Tools   2.9.0-beta8-63208-01
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GitHub.VisualStudio   2.5.8.5165
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

MySQL for Visual Studio   1.2.8
Data design and management tools for MySQL. Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.

NuGet Package Manager   4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

ResourcePackage Extension   1.0
ResourcePackage Visual Studio Extension Detailed Info

ResourcePackage Extension   1.0
ResourcePackage Visual Studio Extension Detailed Info

SQL Server Data Tools   15.1.61808.07020
Microsoft SQL Server Data Tools

Visual Basic Tools   2.9.0-beta8-63208-01
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
[3 May 2019 0:01] Tim Huntley
This still happens for me in VS 2017 & 2019, with the following installed -

MySQL for Visual Studio 1.2.8
Connector/NET 8.0.16

I'm pulling my hair out. I've been trying to update a project on and off for 6 months now with no luck. It doesn't look great and my client is about to pull the plug on MySQL altogether.

I'd like to have a crack at sorting this bug out myself. Any tips on how I get involved, where I get the source code from, how to configure the build and debug environs etc? Thanks.
[4 Jun 2019 22:03] ciprian gabriel
I managed to solve the wizard crash problem in VS 2019 by downgrading everything to 6.8.8
Mysql.Data - 6.8.8
Mysql.Data.Entity - 6.8.8

and I installed mysql connector 6.8.8

mysql for VS is version 1.2.8

also need to make sure if a higher version of mysql.data was installed yuou removed from everywhere. In my case, although I uninstalled in webconfig on dependency assembly was still present.
and of course make sure the web config is as per all other comments.
[12 Mar 2021 14:08] Arman Khody
Yes, the only version that works from the whole collection, is 6.8.8
The rest are useless.
This version works with VS2015/VS2017.

But Today I was able to find another working version, which is 6.10.7
This is the setup:
MySQL Connector Net 6.10.7
MySQl for Visual Studio 1.2.8
MySql Nugets: Mysql.Data.6.10.7/MySql.Data.Entity6.10.7/MySQL.Web6.10.7

Tested All 8.0.x versions and the all crash. They are all unable to re-create or update the model.

I have to make my model using 6 versions and then update to 8.0.23
[12 Mar 2021 14:14] Arman Khody
By the way, 6.10.7 is unable to update the model from Database. It can only create the model.

Tested other later versions like 6.10.9 and they didn't work.
[12 Mar 2021 14:14] Arman Khody
By the way, 6.10.7 is unable to update the model from Database. It can only create the model.

Tested other later versions like 6.10.9 and they didn't work.