System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: b0778fcc041fdca4a8e0b477351b074d48bc6494
Title: AccessViolationException on ExecuteReader
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Native_Assembly Resolution: Core_Bug
Last Modified: 2019-02-09 00:52:58
Version Found In: 1.0.109.2
User Comments:
anonymous added on 2019-02-03 18:13:12:
1. create table with command:

CREATE TABLE "t_LacCell_txt_cd3fbc38d1484699afbd8f9febc3fa58" ("analysis_result_id" integer primary key autoincrement, "Lac" text, "Cell" text);

2. create index with command:

CREATE INDEX "t_LacCell_txt_cd3fbc38d1484699afbd8f9febc3fa58_Lac_Cell__lower" on "t_LacCell_txt_cd3fbc38d1484699afbd8f9febc3fa58" (lower("Lac"), lower("Cell"))

3. select
    SQLiteConnectionStringBuilder connectionStringBuilder = new SQLiteConnectionStringBuilder()
    {
        DataSource = @"test.sqlite"
    };

    SQLiteConnection connection = new SQLiteConnection(connectionStringBuilder.ConnectionString);
    connection.Open();

    SQLiteCommand command = connection.CreateCommand();
    command.CommandText = @"
            select * 
            from (""t_LacCell_txt_cd3fbc38d1484699afbd8f9febc3fa58"") 
            where 
                (lower(""Lac"") is null and 10002 is null or lower(""Lac"") = 10002) 
                and 
                (lower(""Cell"") is null and 6378 is null or lower(""Cell"") = 6378);";

    using (SQLiteDataReader reader = command.ExecuteReader())
    {

    }
            
4. AccessViolationException on command.ExecuteReader

Exception thrown: read access violation.
p was nullptr.

call stack:
    SQLite.Interop.dll!sqlite3VdbeCursorMoveto(VdbeCursor * * pp, int * piCol) Line 78081	C
    SQLite.Interop.dll!sqlite3VdbeExec(Vdbe * p) Line 84375	C
    SQLite.Interop.dll!sqlite3Step(Vdbe * p) Line 80303	C
    SQLite.Interop.dll!sqlite3_step(sqlite3_stmt * pStmt) Line 80366	C
    [Managed to Native Transition]	
    System.Data.SQLite.dll!System.Data.SQLite.SQLite3.Step(System.Data.SQLite.SQLiteStatement stmt) Line 1142	C#
    System.Data.SQLite.dll!System.Data.SQLite.SQLiteDataReader.NextResult() Line 1924	C#
    System.Data.SQLite.dll!System.Data.SQLite.SQLiteDataReader.SQLiteDataReader(System.Data.SQLite.SQLiteCommand cmd, System.Data.CommandBehavior behave) Line 124	C#
    System.Data.SQLite.dll!System.Data.SQLite.SQLiteCommand.ExecuteReader(System.Data.CommandBehavior behavior) Line 943	C#
    ConsoleApp4.exe!ConsoleApp4.Program.Main(string[] args) Line 33	C#
    [Native to Managed Transition]	
    mscoreei.dll!00007ff955c17b2d()	Unknown
    mscoree.dll!00007ff955cba57c()	Unknown
    kernel32.dll!00007ff9865f81f4()	Unknown
    ntdll.dll!00007ff986c6a251()	Unknown

mistachkin added on 2019-02-08 03:53:05: (text/x-fossil-plain)
See [https://www.sqlite.org/src/info/4e8e4857d32d401f]

mistachkin added on 2019-02-09 00:52:58: (text/x-fossil-plain)
This issue has been fixed (upstream) in version 3.27.1 of the SQLite core library,
which is now on trunk.