I’m facing an issue where one line of code is working in debug mode but not in release mode. I have an UWP app which connects to a sqlite db in the localState folder, the line of code that does that is the one that follows
Connection = new SqliteConnection($"Data Source={ApplicationData.Current.LocalFolder.Path}\{DB_NAME}");
I’m using the package System.Data.SQLite from SQLite Development Team, installed via NuGet, and imported as follows
using SqliteConnection = System.Data.SQLite.SQLiteConnection;
The logic is: i have a db somewhere in the pc, i have to copy the db to the localState folder (which already works), and i need to open it to start working with the data, super basic stuff. Here comes the issue: while in debug everything is working as expected, publishing the project in release mode results in the following exception on the first shared line of code
2024-08-09 11:37:58 - Value cannot be null.
Parameter name: path1 - at System.IO.Path.Combine(String, String) + 0x50
at System.Data.SQLite.SQLiteConnection..ctor(String, Boolean) + 0x34b
at Prime.Db.Database.<Inizializza>d__12.MoveNext() + 0x16f
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17
at System.Runtime.CompilerServices.TaskAwaiter.GetResult() + 0xb
at Prime.SplashScreenPage.<CaricamentoIniziale>d__8.MoveNext() + 0x3e2a
- Prime.Db.Database+<Inizializza>d__12 - <Inizializza>d__12
I’m a bit confused, as i can’t figure out what’s the difference between the two situations, therefore i don’t know where to put the hands.
Do you guys have some hints on the case?
It would be appreciated.
Thanks in advance.