Page 1 of 1

Suddenly getting TypeLoadException

Posted: Tue 24 Sep 2019 21:35
by jesus.martinez
Using any version of .NET Core -- previews 8, 9, RC, and GA (released yesterday)-- is suddenly not working with dotConnect for Oracle.

We have tried dotConnect 9.7 and 9.8.
BOTH versions have worked fine before. This error is completely new. Nothing has changed on our end.

Startup.cs (injecting the context)

Code: Select all

  public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext<TheContext>(_ => _.UseOracle(Configuration.GetConnectionString("connectionString")));

            services.AddControllers();
        }
TheContext.cs

Code: Select all

public class TheContext : DbContext
    { 

        public TheContext (DbContextOptions<TheContext> options) : base(options)
        { }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            base.OnConfiguring(optionsBuilder);
        }
    }
ERROR

Code: Select all

TypeLoadException: Method 'get_Info' in type 'Devart.Data.Oracle.Entity.OracleOptionsExtension' from assembly 'Devart.Data.Oracle.Entity.EFCore, Version=9.8.838.0, Culture=neutral, PublicKeyToken=09af7300eec23701' does not have an implementation.
WebApplication2.Startup.<ConfigureServices>b__4_0(DbContextOptionsBuilder _)

Re: Suddenly getting TypeLoadException

Posted: Wed 25 Sep 2019 19:46
by jesus.martinez
To anyone with this issue, here is the root cause and solution:

Cause
The Nuget Devart.Data.Oracle.EFCore package does NOT version lock its Microsoft.EntityFrameworkCore dependency, it simply dictates >= 2.2.4.

As a result, any package updates that replace EF Core and replace it with any version of EF Core 3.0 will break dotConnect.

Solution
You MUST use Entity Framework Core 2.2, regardless if you're using .NET Core 3.0. This is specified absolutely nowhere in the documentation.

I hope that DevArt is more careful about how they specify their package dependencies in the future.

Re: Suddenly getting TypeLoadException

Posted: Thu 26 Sep 2019 20:05
by Shalex
We will investigate the question and notify you about the result.

Re: Suddenly getting TypeLoadException

Posted: Fri 25 Oct 2019 10:30
by Shalex
The lock for Microsoft.EntityFrameworkCore dependency is added to the NuGet package Devart.Data.Oracle.EFCore: viewtopic.php?f=1&t=39475.