我有一个必须在单声道上运行的 MySql 数据库控制台应用程序的错误。在 microsoft 的 .NET 上它运行完美,但在 Mono 2.11.4 上它就无法工作。
我已经尝试将引用的大部分“复制本地”设置设置为“true”,但无济于事。
在应用程序开始时,我立即得到以下异常:
Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for System.Data.Entity.ModelConfiguration.Utilities.TypeExtensions ---> System.InvalidProgramException: Invalid IL c
ode in System.Data.Metadata.Edm.PrimitiveType:GetEdmPrimitiveTypes (): method body is empty.
at System.Data.Entity.ModelConfiguration.Utilities.TypeExtensions..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Data.Entity.Internal.DbSetDiscoveryService.GetSets () [0x00000] in <filename unknown>:0
at System.Data.Entity.Internal.DbSetDiscoveryService.InitializeSets () [0x00000] in <filename unknown>:0
at System.Data.Entity.DbContext.DiscoverAndInitializeSets () [0x00000] in <filename unknown>:0
at System.Data.Entity.DbContext.InitializeLazyInternalContext (IInternalConnection internalConnection, System.Data.Entity.Infrastructure.DbCompiledModel model) [0x00000] in <filename unknown>:0
at System.Data.Entity.DbContext..ctor (System.String nameOrConnectionString) [0x00000] in <filename unknown>:0
at oldforum2vanille.NewForum.vforumEntities1..ctor () [0x00000] in <filename unknown>:0
at oldforum2vanille.Program.ConvertDiscissionTopics (Int32 newforumid, System.String forumtitle) [0x00000] in <filename unknown>:0
at oldforum2vanille.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for System.Data.Entity.ModelConfiguration.Utilities.TypeExtensions ---> System.In
validProgramException: Invalid IL code in System.Data.Metadata.Edm.PrimitiveType:GetEdmPrimitiveTypes (): method body is empty.
at System.Data.Entity.ModelConfiguration.Utilities.TypeExtensions..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Data.Entity.Internal.DbSetDiscoveryService.GetSets () [0x00000] in <filename unknown>:0
at System.Data.Entity.Internal.DbSetDiscoveryService.InitializeSets () [0x00000] in <filename unknown>:0
at System.Data.Entity.DbContext.DiscoverAndInitializeSets () [0x00000] in <filename unknown>:0
at System.Data.Entity.DbContext.InitializeLazyInternalContext (IInternalConnection internalConnection, System.Data.Entity.Infrastructure.DbCompiledModel model) [0x00000] in <filename unknown>:0
at System.Data.Entity.DbContext..ctor (System.String nameOrConnectionString) [0x00000] in <filename unknown>:0
at oldforum2vanille.NewForum.vforumEntities1..ctor () [0x00000] in <filename unknown>:0
at oldforum2vanille.Program.ConvertDiscissionTopics (Int32 newforumid, System.String forumtitle) [0x00000] in <filename unknown>:0
at oldforum2vanille.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
我已经在http://alpascual.com/post/2011/05/27/Error-Unable-to-find-the-requested-Net-Framework-Data-Provider-It-may-not-尝试了一个建议的解决方案be-installed.aspx(因为他的错误信息大致相等)所以我将这些行添加到我的 app.config
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data" />
<add name="ADO.Net driver for MySQL" invariant="MySql.Data" description="ADO.Net driver for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data.MySqlClient, Version=6.6.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
在对配置进行了一些修改之后,由于这些行,Entity Framework 现在再次使用 MySql,但 Mono 只是跳过了此配置并再次给出了上述 Unhandled Exception。:(
大家有什么想法吗?我是不是忘记了什么?