N
N
NixGuy2014-07-11 14:20:52
Mono
NixGuy, 2014-07-11 14:20:52

Entity Framework and Mono: how to solve "Could not load type 'System.Data.Entity.Internal.LazyInternalConnection'" issue?

I'm trying to run an application that uses the Entity Framework. For tests, I wrote a simple console application that reads all records from one table in the MySql database. The test application was written in Visual Studio 2012. On Windows, this application works fine, but under Linux (Ubuntu Server 14.04) the following error occurs:

Could not load signature of System.Data.Entity.Internal.InternalConnection:CreateObjectContextFromConnectionModel due to: Could not load file or assembly or one of its dependencies.
Could not load signature of System.Data.Entity.Internal.IInternalConnection:CreateObjectContextFromConnectionModel due to: Could not load file or assembly or one of its dependencies.

Unhandled Exception:
System.TypeLoadException: Could not load type 'System.Data.Entity.Internal.LazyInternalConnection' from assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
  at Entity5Test.pepyakaEntities..ctor () [0x00000] in <filename unknown>:0
  at Entity5Test.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'System.Data.Entity.Internal.LazyInternalConnection' from assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
  at Entity5Test.pepyakaEntities..ctor () [0x00000] in <filename unknown>:0
  at Entity5Test.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

Mono version :
Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4ubuntu2)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  x86
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen

app.config :
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0"/>
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
  <connectionStrings>
    <add name="Entities" connectionString="metadata=res://*/DataContext.csdl|res://*/DataContext.ssdl|res://*/DataContext.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=localhost;user id=***;password=***;database=***&quot;" providerName="System.Data.EntityClient"/>
  </connectionStrings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
  </startup>
</configuration>

If someone faced a similar problem, I would be grateful for help in solving it.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question