Bug #104540 Mysql.Data 8.0.27 - Entity framework
Submitted: 4 Aug 2021 17:16 Modified: 29 Aug 2022 6:56
Reporter: Matasci Sacha Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:8.0.27 OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any

[4 Aug 2021 17:16] Matasci Sacha
Description:
After updating to mysql.data 8.0.26 the schema is replicated.
In mysql.data 8.0.20 worked well. I can't upgrade to 8.0.26 because it was a bug with the stored procedure.

Exception: 'MySql.Data.MySqlClient.MySqlException' in MySql.Data.dll
Table 'dbname.user.table' doesn't exist

See bug #101236 and @#103411

How to repeat:
// Initialize the connection string builder for the underlying provider.
var sqlBuilder = new MySqlConnectionStringBuilder
{
    Server = "servername",
    Database = "dbname",
    UserID = "user",
    Password = "password",
    PersistSecurityInfo = true,
    SslMode = MySqlSslMode.None 
};

// Initialize the EntityConnectionStringBuilder.
var entityBuilder = new EntityConnectionStringBuilder
{
    Provider = "MySql.Data.MySqlClient",
    ProviderConnectionString = sqlBuilder.ToString(),
    Metadata = @"res://*/LocalizationService.Database.DBModel.csdl|res://*/LocalizationService.Database.DBModel.ssdl|res://*/LocalizationService.Database.DBModel.msl"
};

_entityconnessione = new EntityConnection(entityBuilder.ToString());

This is the connection string generated...
metadata=res://*/Database.DBModel.csdl|res://*/Database.DBModel.ssdl|res://*/Database.DBModel.msl;provider=MySql.Data.MySqlClient;provider connection string="server=server;database=dbname;user id=user;password=password;port=3306;sslmode=None;persistsecurityinfo=True"

This is the exception
MySql.Data.MySqlClient.MySqlException: 'Table 'dbname.user.table' doesn't exist'
[11 Aug 2021 13:11] MySQL Verification Team
Hello Matasci Sacha,

Thank you for the bug report.
Could you please provide a complete test project so that we can replicate the exact same issue since this has different approaches and it seems that we are not in the same page.

Regards,
Ashwini Patil
[11 Aug 2021 16:21] Matasci Sacha
The problem, is the same like other bugs report. It was unsolved since version 8.0.21
[18 Sep 2021 13:07] Dean Turnbull
I concur with Matasci's report, I have also updated his last bug report on this. For me it seems to be isolated to VIEWS only.

The view name in the query statement is being replicated resulting in;

   DATABASE.DATABASE.VIEW

   instead of just

   DATABASE.VIEW 

   or 

   VIEW

This results in a SQL statement of 

   select .... from DATABASE.DATABASE.VIEW where .... 
 
   which is obviously wrong as it should be

   select .... from DATABASE.VIEW where ....

Changing the value in the XML (similar to another users report in the last bug) as follows resolves the issue;

   <EntitySet Name="VIEW" EntityType="Self.VIEW" store:Type="Views" store:Schema="DATABASE">

   changed to

   <EntitySet Name="VIEW" EntityType="Self.VIEW" store:Type="Views" store:Schema="">

This bug exists in 8.0.26
[4 Dec 2021 12:42] Matasci Sacha
Hi,
the bug still exists on version 8.0.27....
It is planned to solve it?
It is from version 8.0.21 that exist it....

Thank you for an answer.
[6 Dec 2021 5:38] Kai Neumann
Information for the developers: 
The bug 101236 has a better discription of the problem than this (104540) but it was unfortunately closed.
[29 Jul 2022 6:56] MySQL Verification Team
Hello,

Thank you for the feedback. 
We believe that this issue has been resolved in consequence of another fix. Please try latest version 8.0.30. Thanks.

Regards,
Ashwini Patil
[30 Aug 2022 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".
[30 Mar 2023 7:01] Kai Neumann
Hi,

the bug still exists (or exists again?) on version 8.0.32.1....

So we still have to remain on 8.0.21 

I would be happy if the problem were finally solved once and for all
[30 Mar 2023 7:48] Kai Neumann
Additional info: In our case, the problem occurs in the Database First environment.
[30 Mar 2023 11:03] Kai Neumann
It seems that #101236 is not a copy of #104540:

#104540: Table 'dbname.user.table' does not exist.
(additional user name between schema and table name)

#101236 : table 'sport_reservation.sport_reservation.tbl_dictionaries' does not exist
(double naming of the schema before the table name)

The problem that is currently still open concerns the double naming of the schema in a Database First environmen
[30 Mar 2023 11:08] Krish KM
Note to the developers. It's worth checking MySQL for Visual Studio. Previously you said this was fixed, but it was never fixed or the source of the bug is unknown to you. The problem may well be in MySql for VS as it's dealing with EntityFramework files.
[31 Mar 2023 7:01] Kai Neumann
Note for all those affected: We were able to solve the problem in our case. 
We have a "database first" situation and the schema now was named twice when accessing the tables.

The MySQL Connector v8.0.22 seems to make a cut internally when handling the schema. Since our project-internal structures were created with an older version of the MySQL-Connector, the following adjustments had to be made manually, so that a newer version of the MySQL-Connector with the EF was operational again:

1. in the *.xsd file(s) the entries

      DbObjectName="schema.table"  

   had to be replaced by 

      DbObjectName="table"  

   
2. the headers of the poco files also had to be changed from

      <Table("schema.table")>

   to

      <Table("table")>
   
   (Attention, syntax is VB.Net, not C#).
   
  
Furthermore, a wrong version number was entered in the App.config.
We had manually 

     <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">

changed to 

     <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.32.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">

After that, the error "Unable to determine the provider name for provider factory of type 'MySql.Data.MySqlClient.MySqlClientFactory'. Make sure that the ADO.NET provider is installed or registered in the application config." also was gone.

For the purpose of completeness, I would like to mention that we also installed Connector 8.0.32.1 on the system itself. Whether this has had an effect is something I can not say.

Last but not least, I also recommend to do a "nuget-update -reinstall".
In case of doubt, this will smooth out even more outdated configuration content.

I hope this will help
[31 Mar 2023 7:31] Kai Neumann
sorry, ther was a bug:

We had to change 

      <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.32.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

to

      <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.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

in the App.config
[31 Mar 2023 7:32] Kai Neumann
Sorry, of course the other way round.
[31 Mar 2023 8:02] Krish KM
For us, editing the edmx file did work. However, the next time we refresh the model (add or remove new table) EF will complain all the replaced tables/views were unable to parse. so in the end, we had to add the schema name back before editing the EF and remove once edited. Painful!!
[15 Apr 2023 5:30] Pablo Mazza
This is still a problem in 8.0.32.1

It's extremely painful to keep editing manually the emdx file before and after each update.

Is there any plan to resolve this?