Problem with SQLite on Win Phone (XAM 160)

DavidSpicerDavidSpicer USMember, University

I noticed last week that the XAM 160 course had been updated so I downloaded the course materials. While the recorded video does not match this I was able to work through what the code was doing and add what appeared to be the appropriate pieces to my app. This works just fine in Android (don't have a way to test iOS yet) but I get the following from the WP app.

at System.StubHelpers.StubHelpers.GetWinRTFactoryObject(IntPtr pCPCMD) at Sqlite.Sqlite3.sqlite3_open_v2(String filename, Database& db, Int32 flags, String zVfs) at SQLite.Net.Platform.WindowsPhone8.SQLiteApiWP8.Open(Byte[] filename, IDbHandle& db, Int32 flags, IntPtr zVfs) at SQLite.Net.SQLiteConnection..ctor(ISQLitePlatform sqlitePlatform, String databasePath, SQLiteOpenFlags openFlags, Boolean storeDateTimeAsTicks, IBlobSerializer serializer) at SQLite.Net.SQLiteConnection..ctor(ISQLitePlatform sqlitePlatform, String databasePath, Boolean storeDateTimeAsTicks, IBlobSerializer serializer) at SQLite.Net.SQLiteConnectionWithLock..ctor(ISQLitePlatform sqlitePlatform, SQLiteConnectionString connectionString) at ButterfliesByCounty.ButterflyRepository.<>c__DisplayClass2.<.ctor>b__0() at SQLite.Net.Async.SQLiteAsyncConnection.GetConnection() at SQLite.Net.Async.SQLiteAsyncConnection.Table[T]() at ButterfliesByCounty.ButterflyRepository.<GetVariablesAsync>d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter``1.GetResult() at ButterfliesByCounty.StatesViewModel.<getVariablesAsync>d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at ButterfliesByCounty.StatesViewModel.<InitData>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__3(Object state)

I get the same result when I attempt to run the Part 4 Completed solution from XAM 160.

Any suggestions as to how to fix this?

Thanks,
Dave

Posts

  • MarkSmith.8123MarkSmith.8123 USXamarin Team, University, XamUProfessors Xamurai

    Hi @DavidSpicer‌,

    Can you post the entire exception? It looks like the first part is cut off (there's no exception type listed, just the stack trace). Also, what's your system config:

    Visual Studio version (& update level)
    Windows Phone SDK version
    Xamarin channel (stable, beta, alpha)

    Thanks!
    Mark

  • ChrisvanwykChrisvanwyk USXamarin Team, University, XamUProfessors, Developer Group Leader Xamurai

    Hi @DavidSpicer‌

    Please check if you have the "SQLite for Windows Phone" extension added. You can do this via the following steps:

    • Right Click on References in the WP8 project.
    • Select Add Reference ...
    • Open the "Windows Phone SDK 8.0" node in the dialog.
    • Select "Extensions"
    • Now tick the box next to "SQLite for Windows Phone" if not ticked and click OK

    This should add the "SQLite for Windows Phone" extension to your project. You should now be able to run the project without problems. Remember to set the target architecture to ARM if you are going to test on a physical device.

    Please let me know if this solved your problem.

    Chris

  • DavidSpicerDavidSpicer USMember, University

    I don't find anything related to SQLite in the area pointed to. On my system there are only three items in Extensions, the Advertising SDK and two related to testing.

    On the NuGet side I have these installed.
    SQLite.Net PCL - WindowsPhone8 Platform
    SQLite.Net PCL
    SQLite-net-wp8

    As far as I could tell these matched up to what were included in the XAM 160 solution.

    The exception message is:
    System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

    I'm using VS2013 Update 3, Windows Phone SDK 8.0 with the 8.1 update (emulators at least), and the latest stable Xamarin release, shows as 3.5.57.0 in the VS About window.

    If there's anything else I can pull from the exception info let me know. The app stops in
    App.xaml.cs in the Application_UnhandledException method.

    Thanks,
    Dave

  • DavidSpicerDavidSpicer USMember, University

    I found the problem. I went back to the Exercise 2 step by step instructions and found that I had not installed the SQLite for Windows Phone Extension. Once I did that it was available in the Add Reference dialog and my WP 8 project works as expected.

    Thanks,
    Dave

  • MarkSmith.8123MarkSmith.8123 USXamarin Team, University, XamUProfessors Xamurai

    Glad you got it working David!

Sign In or Register to comment.