svengeance / Husky

Modernizing the way developers think about installers
3 stars 0 forks source link

[Bug] Uninstaller Can't Resolve Runtime Variables #28

Closed svengeance closed 3 years ago

svengeance commented 3 years ago

Base Information

Husky Version (NuGet): N/A OS: All Architecture: All

HuskyTask: All TaskConfiguration: All

Summary

Running the uninstaller fails to resolve variables because it currently does so in a reversed order, which means Tasks may expect variables to have been created.

Logfile:

StackTrace

System.ArgumentException: Unable to locate variable {create-launch-file.create-launch-script.createdFileName} inside property Target of object HuskyTaskConfiguration

   at Husky.Services.VariableResolverService.Resolve[T](T obj, IReadOnlyDictionary`2[] variableSources) in C:\src\Husky.Services\VariableResolverService.cs:line 84

   at Husky.Installer.HuskyInstaller.ExecuteStep[T](HuskyStep`1 step, InstallationContext installationContext, IServiceProvider services) in C:\src\Husky.Installer\HuskyInstaller.cs:line 105

   at Husky.Installer.HuskyInstaller.ExecuteJob(HuskyJob job, InstallationContext installationContext, IServiceProvider services) in C:\src\Husky.Installer\HuskyInstaller.cs:line 89

   at Husky.Installer.HuskyInstaller.ExecuteStage(HuskyStage stage, IServiceProvider services) in C:\src\Husky.Installer\HuskyInstaller.cs:line 76

   at Husky.Installer.HuskyInstaller.Execute() in C:\src\Husky.Installer\HuskyInstaller.cs:line 63

   at HuskyApp.Installer.Program.Main(String[] args) in C:\src\HuskyApp.Installer\Program.cs:line 183
svengeance commented 3 years ago

Notes: Consider solving this in the following manner -

  1. Guarantee the existence of the application's InstallationDirectory
  2. During the course of installation, store the reversible steps inside a file in Husky's InstallDir
  3. During uninstallation, load the file
  4. During each task of the uninstallation, read into the task the pertinent, reversible items from the installation