ericsink / SQLitePCL.raw

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

Exception after updating from 2.0.8 to 2.1.0 #483

Closed m4r10guapito closed 1 year ago

m4r10guapito commented 2 years ago

Hello guys,

First of all thanks for your work!

I'm having the following issue:

After updating from 2.0.8 to 2.1.0 (tried every preview) I get this exception when I try to create a new SQLiteConnection

System.TypeInitializationException: 'The type initializer for 'SQLite.SQLiteConnection' threw an exception'

Inner exception FileNotFoundException: Could not load file or assembly 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

Going back to version 2.0.8 the problem disappear.

Please let me know if I need to do something special to get 2.1.0 version works.

Thanks in advance

-- Mario

ericsink commented 2 years ago

What platform and target framework is this?

Can you share your csproj?

m4r10guapito commented 2 years ago

Windows application .NET Framework 4.7.2

I can't share my csproj but I can try to reproduce this behavior in a new project and share it. Let me know if you need it

Thanks

ericsink commented 2 years ago

Yeah, if you can provide a minimal repro project, that would be helpful.

m4r10guapito commented 2 years ago

Ok, I'll try do it tomorrow thanks

m4r10guapito commented 2 years ago

Hi, I tried to reproduce this problem in a new project but in a new project I don't see this problem. (same project type, same framework etc) I removed the reference from my project and add it again but still the same (cleaning obj, bin etc). Until 2.0.8 no problem and from 2.1.0 the problem come back.

If you have some idea about what can be the cause of this issue please write it.

In any case I'll continue to investigate on it

Bye

-- Mario

bricelam commented 2 years ago

Does your project include this? (It's in the newer project templates, but may be missing from older projects.)

<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
m4r10guapito commented 2 years ago

Yes it's included

DrewNaylor commented 2 years ago

Noticed this problem as well, but for me, I'm on .NET Framework 4.8 and it couldn't find the e_sqlite library after upgrading to 2.1.0. It appears that the runtimes directory isn't being created in bin\Debug, and thus the e_sqlite library isn't found. I thought this was a VS2022 bug because 2019 is at end of support, but it's not.

twaddell commented 1 year ago

I'm seeing the same issue, using e_sqlcipher having upgraded from 2.0.7 to 2.1.1. It appears that the .targets file in SQLitePCLRaw.lib.e_sqlcipher is no longer being added to the project file. Looking at the nuget packages it looks like the location of the .targets file has changed from build to buildTransitive. Would this cause this problem?

image

ericsink commented 1 year ago

If your nuget is too old to support buildTransitive, then yes, I suspect that would cause this problem. Looks like nuget.exe 5.x is required for that feature. And I'm not sure whether buildTransitive works with packages.config or not.

ericsink commented 1 year ago

Yes, apparently buildTransitive only works with PackageReference, not with packages.config.

ericsink commented 1 year ago

Insofar as this issue relates to support for packages.config, it overlaps with #492 -- closing it as a dupe.