无法将[A] System.Data.SQLite.SQLiteConnection强制转换为[B] System.Data.SQLite.SQLiteConnection
|
我现在手上有一个heisenbug,我正在寻找有关它的帮助。
我有一个使用
System.data.sqlite
的Windows服务。在极少数情况下(显然仅在Windows Vista上,但这可能是红色鲱鱼),会发生以下异常:[A]System.Data.SQLite.SQLiteConnection cannot be cast to [B]System.Data.SQLite.SQLiteConnection...
不幸的是,我们无法在办公室重复此错误,并且对发生此错误的计算机的访问受到限制。我曾尝试弄乱GAC(使用gacutil
注册和注销不同版本和Providence的程序集),并且该应用程序似乎在我的开发机上运行良好。
是否知道我将如何尝试重现此情况,或者可能导致这种情况的情况是什么?您是否遇到了仅在Windows Vista上发生的此类错误?
这是我拥有的最完整的堆栈跟踪:
[A]System.Data.SQLite.SQLiteConnection cannot be cast to [B]System.Data.SQLite.SQLiteConnection.
Type A originates from \'System.Data.SQLite, Version=1.0.66.0. Culture=neutral, PublicKey Token=db937bc2d44ff139\'
in the context \'Default\' at location \'C:\\Program Files\\ultracorp\\System.... [yes, ellipses are the best I have right here, I know...]
Server stack trace:
at System.Data.SQLite.SQLiteCommand.set_DbConnection(DbConnection value)
at System.Data.Common.DbCommand.set_Connection(DbConnection value)
at System.Data.Common.Utils.CommandHelper.SetStoreProviderCommandState(EntityCommand entityCommand, EntityTransaction entityTransaction, DbCommand storeProviderCommand)
at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
at System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__1[TResult](IEnumerable`1 sequence)
at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
at System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
at UltraCorp.DataWrangler.Models.WidgetsTable.getWidget(WidgetsEntities dbConn)
at UltraCorp.DataWrangler.Models.WidgetsTable.getWidget()
at UltraCorp.DataWrangler.Models.WidgetsTable.getUser()
at UltraCorp.DataWrangler.Infrastructure.DataWranglerTray.getUser()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
编辑:在我的app.config中,我在几个地方有provider=System.Data.SQLite;
。请注意,没有强名或版本号。我怀疑可能发生的情况是,在某些情况下,包含数据模型的DLL被加载,并且当Entity Framework看到请求该提供程序时,它选择使用“ 5”。然后,稍后发生某些代码时,将根据引用规则加载不同的DLL。但是,此DLL具有与EF加载的版本不同的版本或强名称,因此是例外。
没有找到相关结果
已邀请:
2 个回复
死搭胯
,位于: https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki 我的SQLite Nuget软件包与我的设计器组件不匹配。
朗排谎纷瘟