Forum Cross Platform with Xamarin


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

SQLite-Net-PCL Bait issue

Ok - I've just started a new iOS application complete with PCL so that I can add an Android version in due course. I need to use SQLite-Net and so I installed the PCL (found here to both projects, i.e. PCL and iOS as instructed (Xamarin Uni).

I've created a few models and a repository in the PCL project and am trying to instantiate from iOS but I get the 'This is the bait' error which apparently indicates that I've not added the package to my platform specific project - but I have.

I've uninstalled and reinstalled, cleaned, rebuilt and even restarted Xamarin Studio (I'm running on a Mac) - so what's going on?

The exact error is:
This is the 'bait'. You probably need to add on the SQLitePCLRaw.bundle_* packages to your platform project.'

Looking at the solution I can see that SQLitePCLRaw.bundle_green is in fact referenced (along with sqlite-net-pcl, SQLitePCLRaw.core and SQLitePCLRaw.provider.sqlite3.ios_unified).

So all the bits seem to be in place but obviously something is not wiring up properly - any ideas?

Thanks in advance

Best Answer


  • Gigantor2015Gigantor2015 CAMember ✭✭

    I am having this same problem, has anyone come up with a different solution? This is really blocking me at the moment.

  • BrianKillenBrianKillen USMember ✭✭

    Eric, i had the same problem and rolled back to the 1.2.1 version of sqlite and it solved my problem.

  • Gigantor2015Gigantor2015 CAMember ✭✭

    @DaveCarson Following the three steps you listed did the trick. Thank you for your help!

    @BrianKillen Thanks for your response!

  • I had the same problem, fixed with the instructions of @DaveCarson , thanks!

  • Vivek.zymrVivek.zymr INMember

    This works perfectly for me thanks @DaveCarson.

  • Has anyone seen this working yet with iOS 11?

    I've been getting this same "this is the bait" error and have followed all of Dave's steps above several times (clean, reboot, remove all nuget packages, delete obj/bin folders, ensure all my PCL nuget packages are on the latest versions, install only the unified nuget package as mentioned by Dave above etc). But to no avail, my iPhone 7 is still shutting the app and throwing the "this is the bait" error in the Visual Studio output window...

    Any other ideas anyone :( ?

  • MartinClarkeMartinClarke GBMember
    edited November 2017

    I encountered this issue as well, but I resolved it simply enough by installing the sqlite-net-pcl package to both the class library containing the database access and to the platform specific projects. At time of writing, it appears the package is clever enough to identify the platform specific dependencies it needs to install, which makes the task that much easier!

    The solution offered by @DaveCarson was also very helpful in fully resolving the issue :smiley:

  • JustinBebberJustinBebber Member ✭✭

    @BrianKillen - Thank you, this solved my issue!

  • RicardoSRicardoS ESMember ✭✭✭

    Thank you for your solution, @DaveCarson .

  • Hey guys I had this same error and with that a great amount of trouble figuring out the solution to address this issue. So I thought I'd share this with you all.

    Let me know if it helped you too?

    My exact steps:

    On my PCL I installed:

    • Sqlite-Net-PCL(v1.3.1), SQLitePCLRaw.bundle_green(v1.1.14) and SQLitePCLRaw.core (v1.1.14).

    On my Android Project I Installed:

    • Installed SQLitePCLRaw.bundle_green(v1.1.14), SQLitePCLRaw.core(v1.1.14), and
Sign In or Register to comment.