Search code examples
c#entity-frameworkentity-framework-6

MissingMethodException when migrating from Ef 6.2 to 6.4.4


For a .net framework 4.8 project, when I update the EF reference from 6.2 to 6.4.4 the application throw an error

System.MissingMethodException: Unable find 'Void System.Data.Entity.Infrastructure.LocalDbConnectionFactory..ctor()'.

in

public class AppContext : DbContext
  {
    public AppContext() : base() <--- the debugger stop on this line

Web.config have these lines

  <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>

.......

  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb"/>
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
    </providers>
  </entityFramework>

No changes has been made in code or in config file, only a package update via Package Manager.

What's that?


Solution

  • In my case the Global Cache was broken in some mode.

    gacutil -u EntityFramework
    

    solved my problem.