-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PackageReferencing SQLitePCLRaw.bundle_green on Net6.0 app fails p/invoke #523
Comments
This may be similar to #490 |
It'd be nice to use the netstandard2.0 dll, but our current workaround is to explicitly use the one for net461. |
Taking a second look at this, I think I misunderstood. And unless I misunderstanding yet again, I don't think the nativelibrary code is actually related to the problem. The real issue here is that the version of the provider used for The code that generates providers has a flag to allow SQLitePCL.raw/src/providers/provider.tt Lines 852 to 876 in d2ac7fd
And the SQLitePCL.raw/gen_providers/Program.fs Line 61 in d2ac7fd
But I don't think there is a good reason why it should be. I think I incorporated this feature flag when I implemented |
I noticed that the netstandard2.0 version of
SQLitePCLRaw.batteries_v2.dll
is missing NativeLibraries, but it exists in the net461 copy:Since PackageReference uses the targetframework of the app, a .Net6.0 console app will load the netstandard2.0 dll and P/invoking
SQLitePCL.raw.sqlite3_load_extension
returns with a 1 (SQLITE_ERROR) and a null errmsg. If I change out the netstandard2.0 batteries_v2.dll for the net461 copy, the p/invoke succeeds.Digging a bit into the source, the e_sqlite3 bundle imports different xmls per framework: SQLitePCL.raw/SQLitePCLRaw.bundle_e_sqlite3.csproj at master · ericsink/SQLitePCL.raw (github.com)
For netstandard2.0, e_sqlite3_dllimport.xml just contains packagereferences.
For net461, e_sqlite3_dynamic.xml has the additional nativelibrary_for_netstandard2.cs which I believe would unblock our scenario.
Is there a reason for this discrepancy? Should e_sqlite3_dllimport also compile the nativelibrary_defines.cs and nativelibrary_for_netstandard2.cs? If not, will there be separate defines provided? Thanks for taking a look!
What version of SQLitePCLRaw are you using?
If you are using one of the SQLitePCLRaw bundle packages, which one?
What platform are you running on? What operating system? Which version? What CPU?
What target framework are you building for? Are you on .NET Framework or the newer stuff (.NET Core, .NET 5+, etc)?
Are you using the command line, or an IDE? Which IDE? Which version of that IDE?
Is this problem something that just started happening? For example, were things working well for you and then you updated something and then the problem showed up? What changed?
What is the exact error message you are seeing when the problem happens?
Are you using
PackageReference
orpackages.config
?If you are using mobile platforms, are you on classic/legacy Xamarin or on .NET 6 and higher?
Sometimes other packages using SQLitePCLRaw cause problems when they are mixed together. What other packages are you including in your project?
How can we reproduce the problem you are seeing? Your issue will get attention much faster if you attach a minimal reproduction sample project.
The text was updated successfully, but these errors were encountered: