I have been working on a UWP app with sqlite database using entity framework. When producing a "release" build (x64 or x86), I have received a number of errors related to one of the "Microsoft.EntityFrameworkCore.Sqlite.Core" dependencies which results in being completely unable to produce a production build when using Entity Framework.
Create new "Blank App (Universal Windows)" project.
Target windows version appears not to be a factor but included for completeness:
Target version: Windows 10, version 1903
Minimum version: Windows 10, version 1809
Using Nuget install:
Microsoft.EntityFrameworkCore.Sqlite.Core (v3.1.3)
Microsoft.CodeAnalysis (v3.5.0)
Create a "Release" build (Build => Build Solution) for any platform (attempted both x86 and x64 separately).
Method 'SqlStatement.GetBlobAt(int)' will always throw an exception due to the missing method 'raw.sqlite3_column_blob(sqlite3_stmt, int)' in assembly 'SQLitePCLRaw.core'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
Method 'SqlConnection.ReadBlob(sqlite3_blob)' will always throw an exception due to the missing method 'raw.sqlite3_blob_read(sqlite3_blob, byte[], int, int)' in assembly 'SQLitePCLRaw.core'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
Method 'SqlStatement.GetStringAt(int)' will always throw an exception due to the missing method 'raw.sqlite3_column_text(sqlite3_stmt, int)' in assembly 'SQLitePCLRaw.core'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
Internal compiler error: Failed to parse 'S'
Type 'SQLitePCL.Batteries_V2' from assembly 'SQLitePCLRaw.batteries_v2' was not included in compilation, but was referenced in method 'SQLitePersistentStorageService.TryInitializeLibrariesLazy()'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
Method 'SQLitePersistentStorageService.TryInitializeLibrariesLazy()' will always throw an exception due to the missing method 'Batteries_V2.Init()' in assembly 'SQLitePCLRaw.batteries_v2'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
Method 'SqlConnection.ReadBlobIntoPooledStream(sqlite3_blob, int)' will always throw an exception due to the missing method 'raw.sqlite3_blob_read(sqlite3_blob, byte[], int, int)' in assembly 'SQLitePCLRaw.core'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
Method 'SqlConnection.Throw(sqlite3, Result)' will always throw an exception due to the missing method 'raw.sqlite3_errmsg(sqlite3)' in assembly 'SQLitePCLRaw.core'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
In order to be able to produce a functional production build I have had to remove Microsoft.CodeAnalysis from our project.
EF Core version:
Database provider: Microsoft.EntityFrameworkCore.Sqlite
Target framework: .NET Standard 2.0
Operating system: Windows 10 (10.0.18363; Build 18362)
IDE: Visual Studio Professional 2019 Version 16.4.3
/cc @bricelam @ericsink
Seems likely that Microsoft.CodeAnalysis is somehow bringing in another version of SQLitePCLRaw and then UWP's AOT is choking on it.
Which makes sense because I know roslyn is using SQLitePCLRaw.
But I'm trying to figure out exactly where this is happening, and so far I'm not finding it. I don't know for sure that roslyn is the issue, nor do I know whether that alleged second copy of SQLitePCLRaw is coming in by way of a nuget dependency or something else that happens to be packaging it.
Still digging...
And FWIW, I can reproduce this problem.
Note from triage: follow up with Roslyn.
Most helpful comment
And FWIW, I can reproduce this problem.