peterhuene / sqlite-net-wp8

A C++/CX wrapper for SQLite functions that sqlite-net depends on. Can be used as an alternative to csharp-sqlite on Windows Phone 8. This library is released under the MIT license.
MIT License
74 stars 65 forks source link

Problem Value cannot be null #18

Closed geniovi closed 11 years ago

geniovi commented 11 years ago

Hello, in a my database have a value null. if i calling this code in a device WP8 receive errors. Works with emulator. Why?

CODE: list List; SQLiteAsyncConnection conn = new SQLiteAsyncConnection(Path, "mydb.sqlite")); List = await conn.QueryAsync(sql, _params);

receive error:

_exception: {System.ArgumentNullException: Value cannot be null. at System.StubHelpers.HStringMarshaler.ConvertToNativeReference(String managed, HSTRING_HEADER* hstringHeader) at Sqlite.Sqlite3.sqlite3_open_v2(String filename, Database& db, Int32 flags, String zVfs) at SQLite.SQLite3.Open(String filename, Database& db, Int32 flags, IntPtr zVfs) at SQLite.SQLiteConnection..ctor(String databasePath, SQLiteOpenFlags openFlags, Boolean storeDateTimeAsTicks) at SQLite.SQLiteConnection..ctor(String databasePath, Boolean storeDateTimeAsTicks) at SQLite.SQLiteConnectionWithLock..ctor(SQLiteConnectionString connectionString) at SQLite.SQLiteConnectionPool.Entry..ctor(SQLiteConnectionString connectionString) at SQLite.SQLiteConnectionPool.GetConnection(SQLiteConnectionString connectionString) at SQLite.SQLiteAsyncConnection.GetConnection() at SQLite.SQLiteAsyncConnection.<>cDisplayClass29`1.b28() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.Execute()

Thank you

peterhuene commented 11 years ago

Is that your actual code? SQLiteAsyncConnection's constructor takes a string and a bool, not (presumably) two strings.

geniovi commented 11 years ago

Yes ok i was wrong to Write the constructor example code.. In My app is correct. Error occurs in a queryasync only on device

peterhuene commented 11 years ago

Can you debug it on the device and put a breakpoint on SQLite.SQLiteConnection..ctor(String databasePath, SQLiteOpenFlags openFlags, Boolean storeDateTimeAsTicks) to see if databasePath is null?

The only reason this exception should occur is if SQLite.SQLite3.Open is called with either filename as null or zVfs as null (zVfs should not be null because sqlite-net passes in an empty string when USE_WP8_NATIVE_SQLITE is defined).

geniovi commented 11 years ago

hello, thanks. I have added USE_WP8_NATIVE_SQLITE in a device compilation and works.