SQLite WInRT 3.10.1 - System.AccessViolationException

Jan 22, 2016 at 8:26 AM
Edited Jan 23, 2016 at 3:50 AM
I am using SQLite WInRT 3.10.1 in my Windows Store App.

A Dispatch Timer keeps updating & reading the sqlite using SQLiteAsyncConnection.
Also, upon clicking a button & successful server communication, sqlite is updated using SQLiteConnection.

So, SQLite is updated/read in parallel and also with 2 different SQLiteAsyncConnection & SQLiteConnection connections.

Under this scenario, the following System.AccessViolationException is thrown:

EXCEPTION 1:

Exception Info: System.AccessViolationException
Stack:
at SQLite.SQLite3.Changes(IntPtr)
at SQLite.SQLiteCommand.ExecuteNonQuery()
at SQLite.SQLiteConnection.Execute(System.String, System.Object[])
at SQLite.SQLiteAsyncConnection+<>c__DisplayClass1d.<ExecuteAsync>b__1c()
at System.Threading.Tasks.Task1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InnerInvoke()
at System.Threading.Tasks.Task.Execute()
at System.Threading.Tasks.Task.ExecutionContextCallback(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.ExecuteEntry(Boolean)
at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()


EXCEPTION 2:

Exception Info: System.AccessViolationException
Stack:
at SQLite.SQLite3.Prepare2(IntPtr, Byte[], Int32, IntPtr ByRef, IntPtr)
at SQLite.SQLite3.Prepare2(IntPtr, System.String)
at SQLite.SQLiteCommand.Prepare()
at SQLite.SQLiteCommand.ExecuteNonQuery()
at SQLite.SQLiteConnection.Execute(System.String, System.Object[])
at SQLite.SQLiteAsyncConnection+<>c__DisplayClass1d.<ExecuteAsync>b__1c()
at System.Threading.Tasks.Task
1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InnerInvoke()
at System.Threading.Tasks.Task.Execute()
at System.Threading.Tasks.Task.ExecutionContextCallback(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.ExecuteEntry(Boolean)
at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

How to resolve this ?

Grateful Thanks in Advance..