clowd / Clowd.Squirrel

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

Error -532462766 occurred while running setup #181

Closed will-scc closed 9 months ago

will-scc commented 12 months ago

I have an app where the install via Setup.exe always fails with error code -532462766: image

The log file specified does not get created: image

I have other apps using Clowd.Squirrel which work fine, and as far as I can tell, use it in exactly the same way... I'm at a complete loss as to what the issue might be, I can't find anything useful about that error code.

(I did also try running the Setup.exe as admin just in case, even though I know that shouldn't be required, and it made no difference.)

My pipeline doesn't seem to suggest any issues either:

[INFO] NugetConsole: Starting to package '%localappdata%\SquirrelClowdTemp\tempa\Test.nuspec'
[INFO] NugetConsole: Successfully created package '%localappdata%\SquirrelClowdTemp\tempa\Test.2.5.0-beta6.nupkg'.
[INFO] DotnetUtil: Extracting Update.exe resources to temp directory
[INFO] DotnetUtil: Patching Update.exe icon
[INFO] DotnetUtil: Re-packing Update.exe bundle
[INFO] Program: Creating release for package: D:\BuildAgents\SK-TFS-01\_work\44\a\Test.2.5.0-beta6.nupkg
[INFO] ReleasePackage: Creating release package: D:\BuildAgents\SK-TFS-01\_work\44\a\Test.2.5.0-beta6.nupkg => D:\BuildAgents\SK-TFS-01\_work\44\a\Test-2.5.0-beta6-full.nupkg
[INFO] ReleasePackage: Removing unnecessary data
[INFO] ReleasePackage: No release notes found in %localappdata%\SquirrelClowdTemp\tempc\Test.nuspec
[INFO] Program: There are 1 SquirrelAwareApp's. Binaries will be executed during install/update/uninstall hooks.
[INFO] Program:   Detected SquirrelAwareApp 'Test.exe' (arch: x86)
[INFO] Program: Package Architecture (detected from SquirrelAwareApp's): x86
[INFO] Program: Creating 1 stub executables
[INFO] EasyZip: Compressing '%localappdata%\SquirrelClowdTemp\tempc' to 'D:\BuildAgents\SK-TFS-01\_work\44\a\Test-2.5.0-beta6-full.nupkg' using 7z...
[INFO] Program: Creating Setup bundle
[INFO] Program: Setup bundle created at 'D:\BuildAgents\SK-TFS-01\_work\44\a\Setup.exe'.
[INFO] Program: Done

Any help would be most welcome.

caesay commented 12 months ago

What version of Squirrel are you using?

If you can upload an app that reproduces this issue, I may be able to take a look at it.

If you want to investigate yourself, here are a few steps to get you started. Setup.exe basically just extracts your .nupkg and Update.exe, and then runs Update.exe --install {your nupkg}. The error message you've shown comes from Update.exe, probably that means it's crashing.

First you can have a look at event viewer (Windows Logs / Application) - sometimes .net crash exceptions get logged there.

If that's not helpful, you can compile and run Update.exe with the VS debugger attached, and give it the --install {nupkg} arguments to a pre-built nupkg. Then you may be able to see where/why it crashes.

will-scc commented 9 months ago

Sorry, took me a while to get back to this. This error is happening with Clowd.Squirrel version 2.11.1.

The event logs from Windows appear to be unhelpful:

Application: squBD00.tmp.exe
CoreCLR Version: 6.0.21.52210
.NET Version: 6.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: System.BadImageFormatException: 
File name: 'C:\Users\%username%\AppData\Local\Temp\Update.dll'
Faulting module name: KERNELBASE.dll, version: 10.0.19041.3693, time stamp: 0x64ee7a9c
Exception code: 0xe0434352
Fault offset: 0x0013f932
Faulting process ID: 0x7e1c
Faulting application start time: 0x01da282b097b80a1
Faulting application path: C:\Users\%username%\AppData\Local\Temp\squBD00.tmp.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report ID: a5dd80cd-ff7e-4d45-bcc8-c3fc87e71b9b
Faulting package full name: 
Faulting package-relative application ID: 

(I replaced my actual username with %username% for privacy.)

I've tried debugging Update.exe but I'm just more confused.

If I run Update.exe with the following command line args: --install C:\\Users\\%username%\\Documents\\test_package.nupkg

Note that this Documents folder doesn't have a RELEASES file in it. I tried with/without just in case, but didn't make any difference.

I hit the following error: System.IO.IOException: 'The parameter is incorrect. : 'C:\Users\%username%\Documents\test_package.nupkg'' (Again, I've replaced my actual username with %username%, but the path is valid.)

This is on line 238 in Program.cs:

var nupkgs = sourceDi.GetFiles()
    .Where(x => x.Name.EndsWith(".nupkg", StringComparison.OrdinalIgnoreCase))
    .Select(x => ReleaseEntry.GenerateFromFile(x.FullName));

Interestingly, if I change the command line args to: --install C:\\Users\\%username%\\Documents (i.e. just the directory containing the .nupkg file), I get further, but then hit error ArgumentNullException: Value cannot be null. Arg_ParamName_Name thrown at line 248:

var rootAppDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ourAppName);

This is because ourAppName is null now.

So it looks like the command line is expecting either the directory containing the nupkg, or the path to nupkg itself, but at different points is expecting different things?

I'm very confused though because I don't understand why this would only not work for this one project...


EDIT: I've just tried this with a different package which has worked in the past and this gets further, but still falls over at Utility.FindLatestFullVersion (var currentRelease = Utility.FindLatestFullVersion(localReleases, null); in determineUpdateInfo) with System.ArgumentNullException: 'Value cannot be null. Arg_ParamName_Name'.

This error appears to be caused by Utility.FindCompatibleVersions:

if (!localReleases.Any()) {
    return null;
}

That returns null into:

public static ReleaseEntry FindLatestFullVersion(IEnumerable<ReleaseEntry> localReleases, RID compatibleRid)
{
    return FindCompatibleVersions(localReleases, compatibleRid).FirstOrDefault(f => !f.IsDelta);
}

The Value cannot be null. (Parameter 'source') exception is coming from trying to call FirstOrDefault(f => !f.IsDefault) on a null (i.e. null.FirstOrDefault(f => !f.IsDelta) does not work).

I'm a bit baffled what the intention is behind localReleases = localReleases ?? Enumerable.Empty<ReleaseEntry>(); and then trying to find the latest version with var currentRelease = Utility.FindLatestFullVersion(localReleases, null); , when we know localReleases is empty (i.e. doesn't exist).


Any help would be great.

will-scc commented 9 months ago

I tried this again today via VS Package Manager Console like I would normally, and both 2.11.1 and 2.9.48 worked.

I have no idea why it didn't work before, I used exactly the same nuspec file... The only thing I possibly did different was removing any pre-existing RELEASES file/packages. Although I am sure I tried that before. Not sure. If it happens again I'll try investigating again.