-
Notifications
You must be signed in to change notification settings - Fork 97
Problems using winsqlite3.dll in UWP applications #249
Comments
I'm not able to repro the first issue on my machine. I wonder if the second issue is caused by this line of code... |
Glad that you are not able to repro the first problem in your machine. It may be just a problem in my machine 😞 |
Looks like having |
Maybe we need to wait to have the NoNative packages? Or is this enough to prioritize the NoNative packages for 1.0.0? cc @rowanmiller |
I'm not sure the NoNative packages would help; none of the |
Splitting the P/Invoke code into separate assemblies may help. I think it all depends on whether tree shaking can remove the P/Invoke code. |
We could also try taking over the loading and calling of the dll--bypass P/Invoke using Win32 APIs. |
I see. I guess it is just static analysis, not much they can do. |
@bricelam are we still planning to do anything about this for 1.1.0-preview1 or are we going to rely on the switch to SQLitePCL.raw to take care of it at a later point? |
The current plan is to switch to SQLitePCL.raw in 1.2.0 where they've already solved this problem. |
No need to call |
After #320, using winsqlite3.dll is as easy as: Install-Package Microsoft.Data.Sqlite.Core
Install-Package SQLitePCLRaw.bundle_winsqlite3 |
Current builds of Windows 10 include a
winsqlite3.dll
assembly that should be usable in UWP applications. I tried to do it following the Local SQLite on UWP walkthrough and adding a call toSqliteEngine.UseWinSqlite3()
early on in the application, but I run into a couple of issues:Native calls through interop such as
sqlite3_open_v2()
fail when targeting winsqlite3.dll instead of sqlite3.dll in an UWP application:0xc0000409
I don't know the exact reason an that is going to require further investigation but there seems to be some kind of mismatch in the declaration of the interop call. In fact I tried a couple of tentative workarounds that made the application work:
CallingConvention.Cdecl
toCallingConvention.StdCall
orCallingConvention.Winapi
.[MarshalAs(UnmanagedType.LPStr)]
. Note that this is not an acceptable workaround because it wouldn't work correctly for international characters, but hopefully[MarshalAs(UnmanagedType.LPUTF8Str)]
will become an option when https://github.com/dotnet/corefx/issues/7804 gets in for .NET Core 1.1.0.The assembly
sqlite3.dll
is deployed with the application and loaded in memory regardless. I verified this with Process Explorer. I even tried removing the assembly from disk but then the application fails to start.The text was updated successfully, but these errors were encountered: