ericsink / SQLitePCL.raw

A Portable Class Library (PCL) for low-level (raw) access to SQLite
Apache License 2.0
525 stars 109 forks source link

Failed to resolve System.String SQLitePCL.raw::sqlite3_column_name(SQLitePCL.sqlite3_stmt,System.Int32) #291

Closed jan-rucka closed 2 years ago

jan-rucka commented 5 years ago

Xamarin.Forms, using Microsoft.Azure.Mobile.Client.SQLiteStore, version 4.1.1 and SQLitePCLRaw.core version 2.0.0, build in Release mode causes exception:

error MSB4018: Mono.Linker.MarkException: Error processing method: 'Newtonsoft.Json.Linq.JObject Microsoft.WindowsAzure.MobileServices.SQLiteStore.MobileServiceSQLiteStore::ReadRow(Microsoft.WindowsAzure.MobileServices.SQLiteStore.TableDefinition,SQLitePCL.sqlite3_stmt)' in assembly: 'Microsoft.Azure.Mobile.Client.SQLiteStore.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.String SQLitePCL.raw::sqlite3_column_name(SQLitePCL.sqlite3_stmt,System.Int32) [/Users/vsts/agent/2.155.1/work/1/s/ScsNtClient/Client.Droid/Client.Droid.csproj]

ericsink commented 5 years ago

SQLitePCLRaw 2.x is not compatible with Azure Mobile Apps. You should stay with 1.1.14.

jan-rucka commented 5 years ago

Hello Eric,

thanx for your answer, but in our solution we use following packages

SQLitePCLRaw.provider.e_sqlite3 SQLitePCLRaw.provider.dynamic_cdecl

these packages have no version 1.1.14 available in nuget.org repo anymore, and they have dependency set to SQLitePCLRaw.core (>= 2.0.0)

Any suggestion?

ericsink commented 5 years ago

Those probably showed up when you tried to upgrade SQLitePCLRaw to 2.0. Those packages IDs were new in 2.0 and never existed as part of 1.1.14.

(That probably means you are using packages.config -- life is much better if you get rid of that and switch to PackageReference, which handles transitive dependencies much better.)

Assuming you have some kind of version control, you should diff your packages.config file against the version before you tried to upgrade SQLitePCLRaw to 2.0.

jan-rucka commented 5 years ago

I just removed SQLitePCLRaw.provider.e_sqlite3 and SQLitePCLRaw.provider.dynamic_cdecl from solution, then downgraded SQLitePCLRaw.bundle_green to version 1.1.14 and during build I got following

Can not resolve reference: SQLitePCLRaw.provider.e_sqlite3, referenced by SQLitePCLRaw.batteries_green. Please add a NuGet package or assembly reference for SQLitePCLRaw.provider.e_sqlite3, or remove the reference to SQLitePCLRaw.batteries_green. Client.Droid

I wanted to add SQLitePCLRaw.provider.e_sqlite3 again but in repo is only version 2.x, which requires SQLitePCLRaw.core 2.x, which is not compatible with Microsoft.Azure.Mobile.Client.SQLiteStore

ericsink commented 5 years ago

Was this working before you tried upgrading SQLitePCLRaw to 2.0? You just need to get back to that state.

One option is to remove all the SQLitePCLRaw packages and the Azure mobile apps packages and then re-add the Azure Mobile App package, and it will add just the dependencies it needs.

If you post your packages.config file here I can take a look at it.

jan-rucka commented 5 years ago

thanks for answer, I'll get back to this issue next week, then I'll let you know

lazmeister commented 5 years ago

@ericsink Any idea when the dependency will be updated? and thank you for the solution! I saw the other post about the current contributor falling off.

ericsink commented 5 years ago

@lazmeister Can you make that question more specific? Which dependency?

lazmeister commented 5 years ago

@lazmeister Can you make that question more specific? Which dependency?

Sorry, this might pertain to Azure mobile client dependency. We were getting link assemblies error until we downgraded to 1.1.14 SQLitePCLRaw packages.

ericsink commented 5 years ago

Ah, yes. I rather doubt that Azure Mobile Apps will be updated for compatibility with SQLitePCLRaw 2.x. I have gotten the impression that the Azure Mobile Apps libraries are no longer being actively developed.

See the README on their main page:

https://github.com/Azure/azure-mobile-apps

lazmeister commented 5 years ago

Yes sadly. Thank you anyway

tebo02 commented 4 years ago

I encountered this issue also in a Windows Console app after updating SQLitePCLRaw.bundle_green to v2.0.2. Downgrading to v1.1.14 installed a bunch of other packages and produced other errors. Creating a new Windows Console app and upgrading to v1.1.14 cleared up all errors and work great. Does this mean that I should not upgrade the SQLite packages beyond v1.1.14?

ericsink commented 4 years ago

@tebo02 I can't answer that question without more info. What packages got installed? What errors? etc.

Version 2.x contained some breaking changes from 1.1.14, so the upgrade does need to be done carefully in many cases.

ericsink commented 2 years ago

Closing old/stale issue.