System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Ticket Hash: 83530ed1b85a7a15ef08683c3282f74d394acb9a
Title: SQLite EF6: DbSet<T>.SqlQuery() does not work
Status: Closed Type: Incident
Severity: Important Priority: Blocker
Subsystem: LINQ Resolution: External_Bug
Last Modified: 2020-03-05 01:01:49
Version Found In: (Nuget) 1.0.110.0
User Comments:
anonymous added on 2019-04-02 10:03:53:
Using SQlite with EF6, the DbSet function "SqlQuery()" gives an IndexOutOfRangeException when the result is enumerated.

This seems to happen whenever explicit column names are part of the query.
Using "select * from table" does not error but "select col1, col2 from table" does, and so does "select t.* from table t".

This is problematic since any query that uses a join will have the error (ie "select t1.* from table1 t1 join table2 t2 on t1.id = t2.id where t2.col2 = 'search value'")

I have created an example project on GitHub at [https://github.com/Gravemind2401/SQLiteTest]

anonymous added on 2019-04-02 11:16:37:
After further investigation it looks like with more complex table structures even "select * from table" will give an error.

mistachkin added on 2019-10-19 03:36:52:

The stack trace appears to be:

   at System.Data.Entity.Core.Query.InternalTrees.ColumnMapFactory.CreateEntityTypeElementColumnMap(DbDataReader storeDataReader, EdmType edmType, EntitySet entitySet, ColumnMap[] propertyColumnMaps, Dictionary`2 renameList)
   at System.Data.Entity.Core.Query.InternalTrees.ColumnMapFactory.CreateColumnMapFromReaderAndType(DbDataReader storeDataReader, EdmType edmType, EntitySet entitySet, Dictionary`2 renameList)
   at System.Data.Entity.Core.Objects.ObjectContext.InternalTranslate[TElement](DbDataReader reader, String entitySetName, MergeOption mergeOption, Boolean streaming, EntitySet&amp;amp; entitySet, TypeUsage&amp;amp; edmType)
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQueryInternal[TElement](String commandText, String entitySetName, ExecutionOptions executionOptions, Object[] parameters)
   at System.Data.Entity.Core.Objects.ObjectContext.&amp;lt;&amp;gt;c__DisplayClass69`1.&amp;lt;ExecuteStoreQueryReliably&amp;gt;b__68()
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
   at System.Data.Entity.Core.Objects.ObjectContext.&amp;lt;&amp;gt;c__DisplayClass69`1.&amp;lt;ExecuteStoreQueryReliably&amp;gt;b__67()
   at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQueryReliably[TElement](String commandText, String entitySetName, ExecutionOptions executionOptions, Object[] parameters)
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteStoreQuery[TElement](String commandText, String entitySetName, ExecutionOptions executionOptions, Object[] parameters)
   at System.Data.Entity.Internal.Linq.InternalSet`1.&amp;lt;&amp;gt;c__DisplayClass11.&amp;lt;ExecuteSqlQuery&amp;gt;b__10()
   at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at SQLiteTest.Program.Main(String[] args) in .\SQLiteTest-master\SQLiteTest\Program.cs:line 73</ExceptionString></Exception></TraceRecord>


mistachkin added on 2019-10-19 03:37:49:
The exception appears to be coming from deep within the EntityFramework code.  I
suspect this may not be an issue with System.Data.SQLite, per se.