Problem with Xamarin.Forms PCL

I am developing a multi-platform PCL application with Xamarin.Forms using this sqlite-pcl package , as shown in this example .

Caution The nuget PCL library contains the wrong link on the left when you go to the Project Site - it points to the SQLite-net site ... So I don’t even know what the correct Sqlite-PCL link will be ...

It worked fine until this morning when I tried to install some other packages (note that I did not touch sqlite packages at first). Suddenly, my application crashed on first access to the database, saying that

System.IO.FileLoadException: 'Could not load file or assembly' SQLite-net, Version = 1.4.118.0, Culture = neutral, PublicKeyToken = null '. The installed assembly manifest definition does not match the Help assembly. (Exception from HRESULT: 0x80131040)

Ok, ok, I started looking for forums, trying to find which part might be the source of the problem - nothing helped - uninstalling and reinstalling the package, rebooting, manually deleting all the links to this DLL that I found and recompiled, redeploying ... I'm actually stuck, I tried Fuslogvw without success ... I'm pretty desperate for this - any suggestion on how I could find the origin of the problem?

Technical details: - VS Community 2017 - Build configuration: Debugging - Any processor - UWP when processing locales - is there any other relevant data?

OK, after several hours of scanning, and thanks to @ yuri-s, I installed the SQLite.Net.Async-PCL package SQLite.Net.Async-PCL . I had to update some using suggestions, but in the end I seem to have got there.

However, I am stuck at the last point: I need to create a DB connection using the platform-specific assembly in this particular library, but I could not find what the code suggested in the proposed approach here (last post). But I could not understand what code was supposed to get into the dependency interface of each OS ( SQLite.Net.Platform does not seem to exist in this package).

In general, SQLite-PCL packages are quite confusing - I think the community will benefit from clearly distinguishing them ...!

+5
source share
4 answers

There seems to be a lot of confusion between different versions of PCL ...

I managed to get it to work the following guide .

Key points to remember:

  • Install SQLite.NET.Async-PCL v3.1.1 for all projects (once using NuGet package management packages for the solution)

  • Install SQLite.NET-PCL v3.1.1 for all projects (you had to do it individually through the NuGet console) - NOTE: make sure that it installs for the correct project (if not, it will complain that the package already exists),

  • For UWP, you also need to add the Visual Studio extension for UWP and manually add links to it through References->Add .

So, all this and ultimately worked - so there was a mismatch between packages 1. and 2. (update 1. implies that you also need to update individual packages in 2.) ...

I hope this helps anyone who is confused between SQlite packages (and, see the warning in the question, links to the project pages on the pages of the NuGet library are IMPOSSIBLE !!!)

+1
source

install version of sqlite-net-pcl 1.3.3 (previous version is not relevant)

current version 1.4.118.0 has this problem

+4
source

Filed as a problem on Github

Should be allowed in 1.5.166-beta

+2
source

Fixed when I had the same problems with "sqlite-net-pcl -Version 1.4.118", could not be downgraded due to .net v4.5

upgraded to sqlite-net-pcl -Version 1.5.166-beta strong> beta and it works.

0
source

Source: https://habr.com/ru/post/1270393/


All Articles