Replying to 96d1ae1b37 in thread C# db connection firing an exception only when compiled in release mode
By m.peirone on 2024-08-09 10:26:06
SqliteConnection seems to work just fine in debug mode while firing an exception after being compiled in release mode
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 connection is succesfull when the project runs in debug mode, while fires up an exception if ran after being compiled.
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
The string parmeter passed to SqliteConnection function has been checked with a log statement immediately before it and does contain a valid value. The working environment is Visual Studio 2022, the project is an UWP app