Bug #89855 MySql.Data.EntityFrameworkCore 6.10.6 throws exceptions with EF Core 2.1
Submitted: 28 Feb 2018 17:06 Modified: 6 Aug 2018 14:55
Reporter: Adam Venezia Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version: OS:Microsoft Windows (Windows 10)
Assigned to: CPU Architecture:x86
Tags: .Net Core, Entity Framework Core

[28 Feb 2018 17:06] Adam Venezia
Description:
Microsoft announced EF Core 2.1 Preview 1 on Feb 27, 2018. The article is here: https://blogs.msdn.microsoft.com/dotnet/2018/02/27/announcing-entity-framework-core-2-1-pr...

Mentioned is
"Note that although there are a few features, such as value conversions, that require an updated database provider, existing providers developed for EF Core 2.0 should be compatible with EF Core 2.1. If there is any incompatibility, that is a bug we want to hear about!"

Upon reporting to them, I was asked to report to Oracle as well.

In short, MySQL.Data.EntityFrameworkCore, running on .Net Core 2.0, does not function correctly while using Microsoft.EntityFrameworkCore.Relational 2.1.0-preview1-final, despite claims that 2.0 conformant providers should work on it.

There are at least 2 issues I've ran into.
System.MissingMethodException: 'Method not found: 'Void Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommandBuilderFactory..ctor(Microsoft.EntityFrameworkCore.Diagnostics.IDiagnosticsLogger`1<Command>, Microsoft.EntityFrameworkCore.Storage.IRelationalTypeMapper)'.'

and

System.NotImplementedException: 'The 'MySQLNumberTypeMapping' does not support value conversions. Support for value conversions typically requires changes in the database provider.'

Original report for the EF Team is here:
https://github.com/aspnet/EntityFrameworkCore/issues/11078
I originally reported about a third party provider, but later on Oracle's provider was brought up so I mentioned its exceptions as well.

How to repeat:
Create a new .Net Core 2.0 console app. Enable the latest C# language version so that async main is valid for the compiler. Use the following packages:

<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.1.0-preview1-final" />
<PackageReference Include="MySql.Data.EntityFrameworkCore" Version="6.10.6" />

Use the following code:

using Microsoft.EntityFrameworkCore;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    public class ProjectDbContext : DbContext
    {
        public ProjectDbContext(DbContextOptions<ProjectDbContext> options)
            : base(options) { }

        public DbSet<Item> Items { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            modelBuilder.Entity<Item>()
                .HasKey(i => i.Id);
            modelBuilder.Entity<Item>()
                .Property(p => p.Label)
                .HasColumnType("text");
        }
    }

    public enum ItemType
    {
        ItemA,
        ItemB
    }

    public class Item
    {
        public int Id { get; set; }

        // NOTE: If this property is part of the model, the exception will be System.NotImplementedException due to 'MySQLNumberTypeMapping' issues.
        // Otherwise, System.MissingMethodException for using internal code that changed.
        public ItemType Type { get; set; }

        public string Label { get; set; }
    }

    // Console application
    class Program
    {
        static async Task Main(string[] args)
        {
            DbContextOptionsBuilder<ProjectDbContext> builder = new DbContextOptionsBuilder<ProjectDbContext>();
            builder.UseMySQL("Your connection string.");
            using (ProjectDbContext _dbContext = new ProjectDbContext(builder.Options))
            {
                await _dbContext.Items.ToListAsync();
            }
        }
    }
}

END CODE

Upon running the code, you'll get the exceptions described, depending on if you have an enum or not in the model.

Suggested fix:
Please provide functionality and compatibility with EF Core 2.1. The preview period can be a good time to get ahead of the curve rather than wait for the RTW and be missing functionality or be broken for a period of time. EF Core team members particularly suggest not calling EF Core's internal code because it is prone to changing due to it being intended to be used internally only.
[21 Jun 2018 7:23] Malcolm Tester
It's been almost 4 months and I don't see any action on it.  Probably because it's set to S4 (Feature Request).

THIS IS NOT A FEATURE REQUEST, IT IS A CRITICAL BUG.

Unable to use .NET Core 2.1 with the (currently) latest Connector/NET (8.0.11)

.NET Core 2.0 does work with 8.0.11.
[21 Jun 2018 14:54] Adam Venezia
A commenter was describing how at this point, with the RTW release of EF Core 2.1, it is impossible to move forward with EF Core using Oracle's MySQL.Data.EntityFrameworkCore provider, and more consideration should be given. Thus the up in severity.
[9 Jul 2018 8:08] deniz aydın
If there are any enhancements about this bug, please inform for poor ones.  Thanks.
[10 Jul 2018 8:59] robin J
please fix this bug, it prevent my project upgrade to .net core 2.1, thanks very much.
[12 Jul 2018 6:26] Alan S
6 months after this was reported and it is still not fixed. Disappointing...
[12 Jul 2018 6:29] BRENO MACHADO
Really disappointing.

I'm just waiting for the correction of this problem to upgrade my project to .Net Core 2.1.0
[12 Jul 2018 8:40] Semyon Pivovarov
I can recommend you to switch to Pomelo.EntityFrameworkCore.MySql provider.
It works fine with .NET Core 2.1.1 in our project.
[12 Jul 2018 8:40] Semyon Pivovarov
I can recommend you to switch to Pomelo.EntityFrameworkCore.MySql provider.
It works fine with .NET Core 2.1.1 in our project.
[12 Jul 2018 17:34] NOT_FOUND NOT_FOUND
This affects us too and we are contemplating moving to SQL Server for good. No way we will switch to Oracle.
[12 Jul 2018 18:01] T T
Can't run MySQL on EF Core 2.1 at all!!! Frustrated!!!

Already 6 months! Is this Critical bug a blind spot for Oracle technical team INCAPABLE to fix? or has Oracle's customer service DEGRADED to such terrible stage?
[6 Aug 2018 10:04] Tester Tester
Please fix this! It affects a lot of implementations that cannot upgrade to > .NET Core 2.1. This is URGENT!
[6 Aug 2018 14:53] Roberto Ezequiel Garcia Ballesteros
Hi,

I'm afraid that internally EF Core 2.1 has some changes in signatures, classes and interfaces that breaks compatibility with 2.0. For this reason, only EF Core v2.0 is supported at the moment.

We are very sorry for this inconvenience.
[8 Aug 2018 15:11] bali mu
When will it be fixed?
[9 Aug 2018 8:15] deniz aydın
Has the solution to this bug been canceled?
[14 Aug 2018 1:17] Douglas Smith
Is anyone working to address this problem?
[14 Aug 2018 1:19] Malcolm Tester
You say you cannot fix the issue because it's a problem in the .NET Core and how it was changed.  However, Pomelo was able to fix their version pretty swiftly.  I've since changed to that, using .NET Core 2.1, and have had no issues.

Are there plans to update this, or not? If so, when?
[17 Aug 2018 8:13] deniz aydın
seems obvious, they ve given up the solution, just can not admit
[25 Sep 2018 2:06] Ted OY
This is a critical bug, we cannot upgrade to .net core 2.1
[4 Oct 2018 12:22] Jay Bats
I created an account especially to implore you guys to make more haste with this bug.

I wholeheartedly agree with Ted's comment from September 25th that this is a critical bug, which is indeed preventing us from upgrading to .NET Core 2.1.

Is it really acceptable to you that we are unable to use enums in EF entity classes in the year 2018?

Please increase this bug's severity to the highest priority. This has gone on long enough. We've got businesses to run and we've been waiting for way too many months. It's an absolute outrage.

The very least you could do is give us a response so that we know where we stand.
[4 Oct 2018 18:52] Ben Carlson
Hello,

Currently only EF Core v2.0 is supported. EF Core 2.1 is not supported. This is a community product and support for community version is solely at the discretion of Oracle. We encourage you to upgrade to our enterprise version and enterprise support for your needs.

We are very sorry for this inconvenience.
[4 Oct 2018 19:56] Jay Bats
I have to become an Enterprise customer when my startup is just getting started and the business hasn't generated any revenue yet?

If Oracle wants me to become an Enterprise customer, then they'd better make sure their community products work very well and are kept up to date.

You've got yourself an existing fanbase here, which is disappointed with the current state of affairs. Doesn't this mean anything to Oracle? Is Oracle simply going to cut off support at EF Core 2.0 without notification? We're just supposed to wait with no info?

Your fanbase might as well switch to MsSQL then.
[5 Oct 2018 13:15] Jay Bats
@Ben Carlson

How would upgrading to the enterprise edition fix this problem for me?

I can only assume the enterprise edition *does* support .net core 2.1.

So that means the fix *is* available. All you need to do is paste it into the community edition source, but you're not going to?

Bit strange/disappointing that something that has always worked now all of a sudden stops working.
[10 Oct 2018 11:20] Jay Bats
I think the mysql community fanbase has, at the very least, the right to know where it stands.

Can we have an update as to whether or not this bug is ever going to be fixed or not?

If so, when?
[20 Feb 21:07] Luke Coulton
Also sad that this isn't working properly for EF Core 2.1
[1 May 23:15] Luis Havey Triana Vega
Yo uso Pomelo.EntityFrameworkCore.MySql and .NET Core 2.2

For ORACLE they have a big problem solving their own BUGS