SQLitePCL.raw icon indicating copy to clipboard operation
SQLitePCL.raw copied to clipboard

Missing methods with SQLitePCLRaw.bundle_winsqlite3 and Microsoft.Data.SQLite.Core

Open anleac opened this issue 6 years ago • 10 comments

Compiling release builds using SQLitePCLRaw.bundle_winsqlite3 2.0.1 (and also 2.0.0) and Microsoft.Data.SQLite.Core 3.0 is broken as it features missing methods.

image

This breaks the release build, and I have to revert to older versions (SQLitePCLRaw.bundle_winsqlite3 1.1.14 with Microsoft.Data.SQLite.Core 2.2.6).

is there any work around?

PS: This is in a UWP C# application with a .NET standard 2.0 as the base target.

anleac avatar Oct 02 '19 13:10 anleac

Full error messages:

warning : MCG : warning MCG0007: Unresolved P/Invoke method 'dl!dlopen' for method 'System.IntPtr SQLitePCL.NativeLibrary.NativeLib_dlopen.dlopen(System.String, System.Int32)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.

warning : MCG : warning MCG0007: Unresolved P/Invoke method 'dl!dlsym' for method 'System.IntPtr SQLitePCL.NativeLibrary.NativeLib_dlopen.dlsym(System.IntPtr, System.String)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.

warning : MCG : warning MCG0007: Unresolved P/Invoke method 'dl!dlclose' for method 'System.Int32 SQLitePCL.NativeLibrary.NativeLib_dlopen.dlclose(System.IntPtr)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.

microsoft.net.native.compiler\2.2.3\tools\Microsoft.NetNative.targets(801,5): error : ILT0014: Failed to compile interop source code.

anleac avatar Oct 02 '19 13:10 anleac

Hmm. That's bad.

I don't think there is a viable workaround. This will require another release to fix it.

ericsink avatar Oct 02 '19 14:10 ericsink

I'm more or less in the same boat with your comment. I've tried quite a few things to get past this, but sadly been unsuccessful in my attempts. Would the fix (on the release side) be simple or quite a complex endeavor? (aka would this be awhile before being in pre-release).

Also thanks for your very fast reply!

anleac avatar Oct 02 '19 14:10 anleac

It's fairly simple. I'll try to get this into a pre-release in the next few days.

But I'm swamped in preparation for a trip, so, emphasis on the word "try". :-)

ericsink avatar Oct 02 '19 14:10 ericsink

That'd be amazing - this would really unblock my product update release at the current stage. I appreciate such a fast reply and potential turn-around of the new NuGet package release :)

anleac avatar Oct 02 '19 14:10 anleac

OK, I just pushed up version 2.0.2-pre20191003102319 to nuget.org.

FWIW, I was able to reproduce the error reported above, and with the attempted fix in this pre version, the error goes away and a UWP project with bundle_winsqlite3 does successfully build in release mode.

Let me know how this works for you.

ericsink avatar Oct 03 '19 15:10 ericsink

Yes! I can confirm that the new pre-release has fixed the release build issue.

Thank you so much!

anleac avatar Oct 04 '19 08:10 anleac

Out of curiosity, would what be an 'expected' time-frame for this to leave pre-release?

anleac avatar Oct 04 '19 12:10 anleac

I'll close this issue when I ship the fix in a non-pre release, which I'm guessing will happen 2-3 weeks from now

ericsink avatar Oct 04 '19 12:10 ericsink

A small update on this: The latest version seems to be incompatible with Windows version 1709 and 1803 (haven't tested 1809 yet). I've been using an Azure VM to test these for older version incompatibilities.

Ref for Windows versions: https://en.wikipedia.org/wiki/Windows_10_version_history

It appears to immediately crash upon release build, however using Microsoft.Data.Sqlite 2.2.6 and winsqlite3 1.1.14 in a sample app succeeds in the release builds and runs (on version 1709).

Enabling native debugger gives a slightly nicer debug error, which is Entry Point not found. Aside from this, the debugger fails to attach itself to the exe as it crashes instantly.

anleac avatar Oct 07 '19 15:10 anleac

Closing old/stale issue.

ericsink avatar Sep 22 '22 21:09 ericsink