Bug #103459 Mysql.Data 8.0.20 - Entity framework
Submitted: 23 Apr 16:29 Modified: 14 Aug 12:56
Reporter: Developer Cero Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:8.0.20 OS:Microsoft Windows (16299.1087)
Assigned to: MySQL Verification Team CPU Architecture:Other (x64 Intel)
Tags: Visual Studio 2019 16.9.4

[23 Apr 16:29] Developer Cero
Description:
With EF 6.1.3 + MySQL 8.0.23 + MySql Net Connector 8.0.20 + MySql for Visual Studio 1.2.9 + VS 2019 Commnunity 16.9.3 I donĀ“t have any problems.

But after upgraded (automatic) to VS 2019 Commnunity 16.9.4, nothing work: when importing custom mySql funcion than returns an integer, generate the error:

Severity	Code	Description	Project	File	Line	Suppression State
Warning		Error 6046: Unable to generate function import return type of the store function 'getCodes'. The store function will be ignored and the function import will not be generated.	DalLayer4	C:\.....\repos\ConApp4\DalLayer4\Model1.edmx	1	

How to repeat:

BEFORE:

Install VS2019 Community 2019 16.9.3 (favorite), otherwise version 16.9.4 (last version today)
Install MySQL 8.0.23 Community
Install MySQL Connector NET 8.0.20
Install MySQL for Visual Studio 1.2.9 

At MySQL create Database Demo with a function that returns integer:

CREATE FUNCTION `getCodes`(CodeType int) RETURNS tinyint
    DETERMINISTIC
BEGIN
	
	declare OnOff tinyint default 0;
	return (OnOff);

END

1) NOTE: If you have VS2019 Community 2019 16.9.3 follows the steps and verify thats import funtion from MySql Server Community 8.0.23 is OK, then test the same proyects with Visual Studio Community 2019 16.9.4.

2) Create N-TIER solution with .NET Framework 4.5.2:

2.1) OPTIONAL: Create a Console Application ConApp4 a .NET Framework 4.5.2.

2.2) Create a Library Project DalLayer4 a .NET Framework 4.5.2. Add App.config file. Be sure to have open connection to MySQL 8.0.23 database at Server Explorer. Then run the MySQL Application Configuration Tool from Solution Explorer and configure to EF 6. 

NOTE If this tool not add Nuget Packages add these:

EntityFramework v6.1.3 by Microsoft
MySql.Data v8.0.20 by Oracle
MySql.Data.EntityFramework v8.0.20 by Oracle

NOTE: If this tool not configure the App.config file, copy:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
  </startup>
  <system.data>
    <DbProviderFactories>
      <remove invariant="MySql.Data.MySqlClient" />
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.0.20, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>
  </system.data>
  <entityFramework>
    <defaultConnectionFactory type="MySql.Data.EntityFramework.MySqlConnectionFactory, MySql.Data.EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.20, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>

3) In Proyect DalLayer4: Add new ADO.NET Entity Data Model with name Model1

4) Select EF Designer from database

5) Select the connection to MySQL database, and select option "Save connection settings in App.config as"

6) Select the function getCodes and finish the wizard.

At this point the error is generated.

I have also tried: 

8) with the same versions 8.0.20 NUGET packages of MySQL + EF 6.2.0.

9) with Install MySQL Connector NET 8.0.24 (last version today). In this case MySQL Application Configuration Tool added the NuGet Packages:

EntityFramework v6.1.3 by Microsoft
MySql.Data v8.0.24 by Oracle
MySql.Data.EntityFramework v8.0.24 by Oracle
   
At App.config the tool only changed the number versions of MySQL to 8.0.24.

9.1) with the same versions 8.0.24 NUGET packages of MySQL + EF 6.2.0. 

9.2) with the same versions 8.0.24 NUGET packages of MySQL + EF 6.4.4 (last version today).

I have also observed that in the Dallayer4.csproch file refers to EF 6.1.3 no to 6.4.4. Change to 6.4.4 does not take any different effect. 

What is the solution?
[14 Jul 12:56] MySQL Verification Team
Hello,

Thank you for the bug report.
Please upgrade to latest version and report us back if the issue still exists in latest version along with a dummy project manifesting the problem.

May be related to Bug #101236

Regards,
Ashwini Patil
[15 Aug 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".