clowd / Clowd.Squirrel

Quick and easy installer and automatic updates for cross-platform dotnet applications
427 stars 39 forks source link

MyApp will not start. #151

Closed KennyTK closed 1 year ago

KennyTK commented 1 year ago

I'm running into an issue with installing my application on my dev machine. This error may or may not be related to uninstalling. dotnet7.0. win10 pro x64. Version 10.0.19044 Build 19044. Clowd.Squirrel 2.9.42. Winforms C#

Installing

Application: My_Fancy_Application.exe CoreCLR Version: 6.0.1423.7309 .NET Version: 6.0.14 Description: The process was terminated due to an internal error in the .NET Runtime at IP 00007FFE595A0C21 (00007FFE593F0000) with exit code 80131506

Faulting module name: coreclr.dll, version: 6.0.1423.7309, time stamp: 0x63cf6c9b Exception code: 0x80131506 Fault offset: 0x00000000001b0c21 Faulting process id: 0x4934 Faulting application start time: 0x01d95d2f61c3c267

I'm able to compile as debug, release. I previously had this project working on my machine but changed between net6 and net 7 frameworks a few times. I'm able to compile as debug with "just my code" disabled. App starts up but I notice the error:

'My Cool App.exe' (Win32): Loaded 'C:\Windows\System32\windows.storage.dll'. 'My Cool App.exe' (Win32): Loaded 'C:\Windows\System32\wldp.dll'. 'My Cool App.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. 'My Cool App.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. Exception thrown: 'System.InvalidOperationException' in SquirrelLib.dll Exception thrown: 'System.InvalidOperationException' in SquirrelLib.dll 'My Cool App.exe' (Win32): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.3\System.Diagnostics.TraceSource.dll'.

I'm unsure how to investigate this further and give useful information.

Uninstalling

When I uninstall the broken app via Add and Remove Programs.

2023-03-22 23:23:36.9321 [INFO] - Program: Finished Squirrel Updater 2023-03-22 23:24:48.1222 [INFO] - Program: Starting Squirrel Updater: --uninstall 2023-03-22 23:24:48.2561 [INFO] - Program: Starting uninstall for app: 2023-03-22 23:24:48.4887 [INFO] - ApplyReleasesImpl: Starting full uninstall 2023-03-22 23:24:59.0625 [WARN] - Utility: Unable to delete child 'C:\Users\Me\AppData\Local\MyApp': System.UnauthorizedAccessException: Access to the path 'Update.exe' is denied. at System.IO.FileSystem.RemoveDirectoryRecursive(String , WIN32_FIND_DATA& , Boolean ) at System.IO.FileSystem.RemoveDirectory(String , Boolean ) at System.IO.Directory.Delete(String , Boolean ) at Squirrel.Utility.<>c__DisplayClass31_0.<DeleteFsiVeryHard>b__0() in ./Internal/Utility.cs:line 487 at Squirrel.Utility.<>c__DisplayClass31_0.<DeleteFsiVeryHard>b__2() in ./Internal/Utility.cs:line 499 at Squirrel.Utility.<>c__DisplayClass11_0.<Retry>b__0() in ./Internal/Utility.cs:line 152 at Squirrel.Utility.Retry[T](Func1 block, Int32 retries, Int32 retryDelay) in ./Internal/Utility.cs:line 164 at Squirrel.Utility.DeleteFsiVeryHard(FileSystemInfo fileSystemInfo) in ./Internal/Utility.cs:line 504 2023-03-22 23:24:59.0625 [ERROR] - Utility: Unable to delete 'C:\Users\Me\AppData\Local\MyApp': System.UnauthorizedAccessException: Access to the path 'Update.exe' is denied. at System.IO.FileSystem.RemoveDirectoryRecursive(String , WIN32_FIND_DATA& , Boolean ) at System.IO.FileSystem.RemoveDirectory(String , Boolean ) at System.IO.Directory.Delete(String , Boolean ) at Squirrel.Utility.<>cDisplayClass31_0.b0() in ./Internal/Utility.cs:line 487 at Squirrel.Utility.<>cDisplayClass31_0.b2() in ./Internal/Utility.cs:line 499 at Squirrel.Utility.<>c__DisplayClass11_0.b__0() in ./Internal/Utility.cs:line 152 at Squirrel.Utility.Retry[T](Func1 block, Int32 retries, Int32 retryDelay) in ./Internal/Utility.cs:line 164 at Squirrel.Utility.DeleteFsiVeryHard(FileSystemInfo fileSystemInfo) in ./Internal/Utility.cs:line 504 at Squirrel.Utility.DeleteFsiTree(FileSystemInfo fileSystemInfo) in ./Internal/Utility.cs:line 472 at Squirrel.Utility.DeleteFileOrDirectoryHard(String path, Boolean throwOnFailure) in ./Internal/Utility.cs:line 436 2023-03-22 23:24:59.1130 [INFO] - Program: Finished Squirrel Updater

This uninstall succeeds to my knowledge.

Possibly related: Unmanaged .dll pointer

caesay commented 1 year ago

You've not posted a log file for the Squirrel install, but as far as I can tell from the logs you've posted, both the Squirrel install and uninstall is working as intended and it's your own application (My_Fancy_Application.exe) that is failing to start. Squirrel does not modify your program, so my assumption is that this is not a problem with Squirrel. If you believe it is an issue with Squirrel, please create a github repository with some sample code which reproduces the problem (include build / repro steps in your readme).

KennyTK commented 1 year ago

For future readers:

I've narrowed down the issue to something with dotnet publish and dependencies. Possibly caused by switching between net6.0 and net7.0 a few times while building / publishing / deploying intermittently. I removed xunit from project, deleted everything in publish folder, cleaned solution, rebuilt solution. Problem solved.

Launching app from publish folder is a good way to check if app is failing to start before deploying with squirrel.