nekdan
Posts: 4
Joined: Tue Aug 23, 2022 4:11 pm

App won't running after installation

Tue Aug 23, 2022 4:32 pm

Hello,

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


Catalin
Posts: 6543
Joined: Wed Jun 13, 2018 7:49 am

Re: App won't running after installation

Fri Aug 26, 2022 1:27 pm

Hello and welcome to our forums,

If your application crashes due to not being able to access a file (be it a DLL, database, etc.) then most likely we are have a permission issue here.

This is not an issue with your setup package, but most likely with your executable, which I'm afraid I can not really help with.

Do you install this database file with your setup? If so, you can try to give permissions to the database folder for everyone. To do so:

- go to "Files and Folders" page

- right click on the folder where you install the database file --> "Properties"

- "Permissions" tab --> "New..."

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

nekdan
Posts: 4
Joined: Tue Aug 23, 2022 4:11 pm

Re: App won't running after installation

Sun Aug 28, 2022 10:04 pm

Catalin wrote:
Fri Aug 26, 2022 1:27 pm
Hello and welcome to our forums,

If your application crashes due to not being able to access a file (be it a DLL, database, etc.) then most likely we are have a permission issue here.

This is not an issue with your setup package, but most likely with your executable, which I'm afraid I can not really help with.

Do you install this database file with your setup? If so, you can try to give permissions to the database folder for everyone. To do so:

- go to "Files and Folders" page

- right click on the folder where you install the database file --> "Properties"

- "Permissions" tab --> "New..."

Hope this helps!

Best regards,
Catalin
Your advice helped a little. For some reason, the created folder in which the application is installed has a read-only permission restriction. In this case, the application is installed as standard in Program Files, perhaps this is somehow connected. Since when installed in the root folder on drive C, the problem disappears. Tell me how to solve this problem and leave the installation in the standard path in Program Files.
Attachments
Screenshot_13.png
Screenshot_13.png (45.83KiB)Viewed 5686 times

Catalin
Posts: 6543
Joined: Wed Jun 13, 2018 7:49 am

Re: App won't running after installation

Tue Aug 30, 2022 2:04 pm

Hello,
Tell me how to solve this problem and leave the installation in the standard path in Program Files.
I am not quite sure I fully understand your request here.

From what I can see, you have the installation type set to "Per-machine if user is administrator, per-user otherwise". This option is set to work with the "InstallTypeDlg" dialog which you can add in the "Dialogs" page.

The "InstallTypeDlg" dialog will let the user choose whether he wants the installation to be per-machine or per-user.

For your installation type, this is how the "Application Folder" should look like in the "Install Parameters" page:
Screenshot_1.png
Screenshot_1.png (13.83KiB)Viewed 5659 times
This is the default path for the "Application Folder" from the "Files and Folders" page.

The [AI_UserProgramFiles] is a special property which resolves based on the selection in the "InstallTypeDlg" dialog, i.e.:

1. if the user selects the per-machine option, the path will be the Program Files folder

2. if the user selects the per-user option, the path will be the %appdata% folder.

If you want the "Application Folder" to automatically resolve to the "Program Files" folder, you can use the "Per-machine only (fails if user is not administrator" option)

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

nekdan
Posts: 4
Joined: Tue Aug 23, 2022 4:11 pm

Re: App won't running after installation

Wed Aug 31, 2022 7:21 pm

Catalin wrote:
Tue Aug 30, 2022 2:04 pm

I am not quite sure I fully understand your request here.
Now, when installed in Program Files, the folder has a read-only attribute, which causes a problem with starting the application, since a file with a database is created at startup. Your first tip about adding the permission helps, but users don't have to do the same at home to run an installed application.

Catalin
Posts: 6543
Joined: Wed Jun 13, 2018 7:49 am

Re: App won't running after installation

Thu Sep 01, 2022 10:07 am

Hello,
Now, when installed in Program Files, the folder has a read-only attribute, which causes a problem with starting the application, since a file with a database is created at startup. Your first tip about adding the permission helps, but users don't have to do the same at home to run an installed application.
You can change the permissions on the installation folder from within your project, meaning that it will be automatically done by your setup, without your users' intervention.

You can do so by right clicking the folder --> "Properties" --> "Permissions" tab.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

nekdan
Posts: 4
Joined: Tue Aug 23, 2022 4:11 pm

Re: App won't running after installation

Sun Sep 18, 2022 9:45 pm

Catalin wrote:
Thu Sep 01, 2022 10:07 am
You can change the permissions on the installation folder from within your project, meaning that it will be automatically done by your setup, without your users' intervention.

You can do so by right clicking the folder --> "Properties" --> "Permissions" tab.

Hi, this looks like what I need. But I didn’t understand who exactly needs to be added to username, administrators with full access, or what should I choose so that any user has read and write access to this folder? Thanks a lot in advance.

Catalin
Posts: 6543
Joined: Wed Jun 13, 2018 7:49 am

Re: App won't running after installation

Tue Sep 20, 2022 2:47 pm

Hello,
But I didn’t understand who exactly needs to be added to username, administrators with full access, or what should I choose so that any user has read and write access to this folder?
You could choose to give everyone access to the folder, sure, no problem with that.

If not, you can choose to give permissions to only the installing user through the LogonUser property.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”