gpt4 book ai didi

.net - Mono 的内部 LazyIinternalConnection 错误

转载 作者:行者123 更新时间:2023-11-29 14:16:02 25 4
gpt4 key购买 nike

我的 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 只是跳过此配置并再次给出上述未处理的异常。 :(

你们有什么想法吗?我是不是忘记了什么?

最佳答案

这不是 Mono 支持的场景。您不应该使用 Mono 运行 Microsoft 实现特定的运行时库,例如 System.Data.Entity.dll。

Entity Framework 最近已开源(版本 6.0),并且与最新的 Mono 版本捆绑在一起。 Mono 不支持早期版本的 Entity Framework 。

关于.net - Mono 的内部 LazyIinternalConnection 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12652692/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com