AccessViolation - 尝试从C#程序中读取或写入Cassandra中SELECT的受保护内存

时间:2015-12-23 08:59:58

标签: c# solr cassandra

我有一个C#程序,它从一个Cassandra列族中读取行。对于每一行,它必须与另一个Cassandra列族中的其他行匹配,最后更新第一列族中的地图集合。 两个Cassandra柱系列都在Solr中。 程序崩溃抛出错误:

  

尝试读取或写入受保护的内存。这通常是一个   表明其他内存已损坏。

使用StackTrace:

at System.Data.Common.UnsafeNativeMethods.IColumnsInfo.GetColumnInfo(IntPtr& pcColumns, IntPtr& prgInfo, IntPtr& ppStringsBuffer)
   at System.Data.OleDb.OleDbDataReader.BuildSchemaTableInfo(Object handle, Boolean filterITypeInfo, Boolean filterChapters)
   at System.Data.OleDb.OleDbDataReader.BuildMetaInfo()
   at System.Data.OleDb.OleDbDataReader.NextResult()
   at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
   at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.OleDb.OleDbCommand.ExecuteReader()
   at Casample.MainApp.selectIndexLinesMain(OleDbConnection conn, ModelInd modelGel) in c:\Program Files (x86)\Intellisoft\CASO\Samples\C#\02_SimpleQuery.cs:line 118
   at Casample.MainApp.Main(String[] args) in c:\Program Files (x86)\Intellisoft\CASO\Samples\C#\MainApp.cs:line 45
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

当我在代码中执行此部分时抛出异常:

OleDbCommand cmd = conn.CreateCommand();

cmd.CommandText = "SELECT id,id2 FROM table2 WHERE  solr_query='{\"q\":\"firstname:\\\"" + model.firstname + "\\\" AND lastname = \\\"" + model.lastname+ "\\\" AND firstname2= \\\"" + model.firstname2 + "\\\" AND lastname2 = \\\"" + model.lastname2 + "\\\" AND -id2:" + model.id2 + "\"}';";

Console.Write(cmd.CommandText);
OleDbDataReader reader = cmd.ExecuteReader();

在ExecuteReader();

中抛出错误

如果我为两个不在Solr中的列族执行此程序,它将在不抛出异常的情况下工作。

0 个答案:

没有答案