From 7ae1dcb3dd9c6579dcd8c81718a24ceab4e87d1f Mon Sep 17 00:00:00 2001 From: Brad White <4261702+bradselw@users.noreply.github.com> Date: Wed, 3 May 2023 17:13:35 -0700 Subject: [PATCH] Manually initialize the SQLitePCLRaw bundles before calling into Microsoft.Data.Sqlite (#20) Co-authored-by: Brad White --- src/SystemStateManager.Persistence/SqliteConnectionFactory.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SystemStateManager.Persistence/SqliteConnectionFactory.cs b/src/SystemStateManager.Persistence/SqliteConnectionFactory.cs index 8138081..27135a1 100644 --- a/src/SystemStateManager.Persistence/SqliteConnectionFactory.cs +++ b/src/SystemStateManager.Persistence/SqliteConnectionFactory.cs @@ -35,10 +35,14 @@ public static SqliteConnection Create() } } + // In some cases, we need to manually initialize the SQLitePCLRaw bundles before calling into Microsoft.Data.Sqlite + SQLitePCL.Batteries_V2.Init(); + var connectionString = new SqliteConnectionStringBuilder { DataSource = DatabaseFile.FullName, }.ToString(); + var connection = new SqliteConnection(connectionString); connection.Open();