I've recently started using Advanced Installer to create installer for my .net application and unfortunately I've ran into an issue.
After installing my application, I try to run it through .exe, the application starts to load, but then crashes. I looked in the Event Viewer for an error on opening the database. Then I ran the .exe with administrator rights and the application started successfully.
Moreover, my application published through visual studio but not yet packaged in advanced installer is successfully launched without administrator rights. The behavior is similar on other computers.
I've googled this problem to see if I could find anything but unfortunately I didn't find anything. Is this a common issue or am I doing something wrong (which I probably am)?
Any help would be appreciated.
Advanced Installer 19.8.1
Windows 11 (and Windows 10)
Error in Event Viewer:
Code: Select all
Application: Instrumentation.App.exe
CoreCLR Version: 6.0.822.36306
.NET Version: 6.0.8
Description: The process was terminated due to an unhandled exception.
Exception Info: Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 14: 'unable to open database file'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext()
at Microsoft.Data.Sqlite.SqliteCommand.GetStatements(Stopwatch timer)+MoveNext()
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteScalar()
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteScalar(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Sqlite.Storage.Internal.SqliteDatabaseCreator.HasTables()
at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.EnsureCreated()
at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.EnsureCreated()
at Instrumentation.DataAccess.InstrumentationContext..ctor(DbContextOptions`1 options) in D:\C#\instrum-2\src\Instrumentation\Instrumentation\DataAccess\InstrumentationContext.cs:line 10
at Instrumentation.DependencyInjection.DataAccessBootstrapper.<>c__DisplayClass0_0.<Register>b__0() in D:\C#\instrum-2\src\Instrumentation\Instrumentation\DependencyInjection\DataAccessBootstrapper.cs:line 15
at Splat.DependencyResolverMixins.<>c__DisplayClass4_0`1.<Register>b__0() in /_/src/Splat/ServiceLocation/DependencyResolverMixins.cs:line 114
at Splat.ModernDependencyResolver.<>c__DisplayClass6_0.<Register>b__0() in /_/src/Splat/ServiceLocation/ModernDependencyResolver.cs:line 95
at Splat.ModernDependencyResolver.GetService(Type serviceType, String contract) in /_/src/Splat/ServiceLocation/ModernDependencyResolver.cs:line 148
at Splat.DependencyResolverMixins.GetService[T](IReadonlyDependencyResolver resolver, String contract) in /_/src/Splat/ServiceLocation/DependencyResolverMixins.cs:line 34
at Instrumentation.DependencyInjection.DataAccessBootstrapper.<>c__DisplayClass0_0.<Register>b__1() in D:\C#\instrum-2\src\Instrumentation\Instrumentation\DependencyInjection\DataAccessBootstrapper.cs:line 18
at Splat.DependencyResolverMixins.<>c__DisplayClass4_0`1.<Register>b__0() in /_/src/Splat/ServiceLocation/DependencyResolverMixins.cs:line 114
at Splat.ModernDependencyResolver.<>c__DisplayClass6_0.<Register>b__0() in /_/src/Splat/ServiceLocation/ModernDependencyResolver.cs:line 95
at Splat.ModernDependencyResolver.GetService(Type serviceType, String contract) in /_/src/Splat/ServiceLocation/ModernDependencyResolver.cs:line 148
at Splat.DependencyResolverMixins.GetService[T](IReadonlyDependencyResolver resolver, String contract) in /_/src/Splat/ServiceLocation/DependencyResolverMixins.cs:line 34
at Instrumentation.ViewModels.MainViewModel..ctor() in D:\C#\instrum-2\src\Instrumentation\Instrumentation\ViewModels\MainViewModel.cs:line 19
at Instrumentation.DependencyInjection.ViewModelsBootstrapper.<>c.<Register>b__0_0() in D:\C#\instrum-2\src\Instrumentation\Instrumentation\DependencyInjection\ViewModelsBootstrapper.cs:line 13
at Splat.DependencyResolverMixins.<>c__DisplayClass9_0`1.<RegisterLazySingleton>b__0() in /_/src/Splat/ServiceLocation/DependencyResolverMixins.cs:line 198
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at Splat.DependencyResolverMixins.<>c__DisplayClass8_0.<RegisterLazySingleton>b__0() in /_/src/Splat/ServiceLocation/DependencyResolverMixins.cs:line 185
at Splat.ModernDependencyResolver.<>c__DisplayClass6_0.<Register>b__0() in /_/src/Splat/ServiceLocation/ModernDependencyResolver.cs:line 95
at Splat.ModernDependencyResolver.GetService(Type serviceType, String contract) in /_/src/Splat/ServiceLocation/ModernDependencyResolver.cs:line 148
at Splat.DependencyResolverMixins.GetService[T](IReadonlyDependencyResolver resolver, String contract) in /_/src/Splat/ServiceLocation/DependencyResolverMixins.cs:line 34
at Instrumentation.App.<>c__DisplayClass1_0.<<OnFrameworkInitializationCompleted>g__GetMainWindowAsync|0>d.MoveNext() in D:\C#\instrum-2\src\Instrumentation\Instrumentation\App.axaml.cs:line 32
--- End of stack trace from previous location ---
at Instrumentation.App.OnFrameworkInitializationCompleted() in D:\C#\instrum-2\src\Instrumentation\Instrumentation\App.axaml.cs:line 41
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
at Avalonia.Threading.AvaloniaSynchronizationContext.<>c__DisplayClass5_0.<Post>b__0() in /_/src/Avalonia.Base/Threading/AvaloniaSynchronizationContext.cs:line 33
at Avalonia.Threading.JobRunner.Job.Avalonia.Threading.JobRunner.IJob.Run() in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 181
at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 37
at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) in /_/src/Windows/Avalonia.Win32/Win32Platform.cs:line 263
at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken) in /_/src/Windows/Avalonia.Win32/Win32Platform.cs:line 210
at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 65
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 120
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 209
at Instrumentation.NetCore.Program.Main(String[] args) in D:\C#\instrum-2\src\Instrumentation\Instrumentation.NetCore\Program.cs:line 19