'System.NullReferenceException' occurred in SQLitePCLRaw.core.dll

Running into this error intermittently.


System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=SQLitePCLRaw.core
StackTrace:
at SQLitePCL.raw.sqlite3_finalize(sqlite3_stmt stmt)
at SQLitePCL.sqlite3_stmt.Finalize()


Above exception is preceded by this


SOURCE:
SQLitePCLRaw.provider.sqlcipher

STACK TRACE:
at SQLitePCL.SQLite3Provider_sqlcipher.NativeMethods.sqlite3_prepare_v2(IntPtr db, IntPtr pSql, Int32 nBytes, IntPtr& stmt, IntPtr& ptrRemain)
at SQLitePCL.SQLite3Provider_sqlcipher.SQLitePCL.ISQLite3Provider.sqlite3_prepare_v2(IntPtr db, String sql, IntPtr& stm, String& remain)
at SQLitePCL.raw.sqlite3_prepare_v2(sqlite3 db, String sql, sqlite3_stmt& stmt, String& tail)
at SQLite.SQLite3.Prepare2(sqlite3 db, String query)
at SQLite.SQLiteCommand.Prepare()
at SQLite.SQLiteCommand.ExecuteNonQuery()
at SQLite.SQLiteConnection.Execute(String query, Object args)
at SQLite.SQLiteConnection.SetKey(String key)
at SQLite.SQLiteConnection…ctor(SQLiteConnectionString connectionString)


I am using sqlite-net-sqlcipher v1.6.292 on .NET Framework 4.5.1.

Code is straightforward:

var options = new SQLiteConnectionString(dbPath, true, key: keyValue);
var connection = new SQLiteConnection(options); // Exception mentioned above gets thrown here

Any input is appreciated. Thanks.