Suddenly getting TypeLoadException

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
jesus.martinez
Posts: 2
Joined: Tue 24 Sep 2019 18:27

Suddenly getting TypeLoadException

Post by jesus.martinez » Tue 24 Sep 2019 21:35

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 _)

jesus.martinez
Posts: 2
Joined: Tue 24 Sep 2019 18:27

Re: Suddenly getting TypeLoadException

Post by jesus.martinez » Wed 25 Sep 2019 19:46

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.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Suddenly getting TypeLoadException

Post by Shalex » Thu 26 Sep 2019 20:05

We will investigate the question and notify you about the result.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Suddenly getting TypeLoadException

Post by Shalex » Fri 25 Oct 2019 10:30

The lock for Microsoft.EntityFrameworkCore dependency is added to the NuGet package Devart.Data.Oracle.EFCore: viewtopic.php?f=1&t=39475.

Post Reply