wixtoolset / issues

WiX Toolset Issues Tracker
http://wixtoolset.org/
129 stars 36 forks source link

Per User Installation - Rollback does not remove product registration from registry #8574

Open destiny14 opened 1 month ago

destiny14 commented 1 month ago

WiX Version

4.0.3 (also present in 5, not present in 3)

.NET or MSBuild or Visual Studio Version

.NET 8.0.302, Visual Studio 17.10.2

HeatWave Version

1.0.4.5

Windows Version

Win 11 23H2

Repro Repo

https://github.com/destiny14/WixRollbackBugRepro

Repro Steps

  1. Create a project as per the WiX4 tutorial
  2. Convert project to perUser (set scope, add MSIINSTALLPERUSER and ALLUSERS, adjust INSTALLFOLDER, add Reg Key to component to silence ICE)
  3. Add a CustomAction project and make the action return Failure
  4. Add the CustomAction to the installer project
  5. Install the application and observe the rollback

Actual Result

The rollback removes all files and custom registry keys, but the application is still listed under installed applications afterwards. When using an installer with UI the Add/Modify/Remove screen is shown when executing the installer again despite the application not being actually installed.

The log shows numerous errors during rollback of the "PublishProduct" action:

MSI (s) (84:AC) [13:08:48:581]: Executing op: RegRemoveValue(Name=LastUsedSource,Value=#%n;1;C:\Users\USERNAME\Desktop\,)
MSI (s) (84:AC) [13:08:48:581]: Note: 1: 1402 2: HKEY_USERS\S-1-5-21-2434534019-508715739-355924699-3662\Software\Microsoft\Installer\Products\E6D6D9FBD5F27EF40B21E8441F5F53C7\SourceList 3: 5 
MSI (s) (84:AC) [13:08:48:581]: Note: 1: 2205 2:  3: Error 
MSI (s) (84:AC) [13:08:48:581]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1403 
Info 1403.Could not delete value LastUsedSource from key \S-1-5-21-2434534019-508715739-355924699-3662\Software\Microsoft\Installer\Products\E6D6D9FBD5F27EF40B21E8441F5F53C7\SourceList.  System error .  Verify that you have sufficient access to that key, or contact your support personnel.

wixTestLog.txt

Expected Result

The application should be properly removed from the registry.

Acknowledgements

barnson commented 1 month ago

Windows Installer is the runtime that executes .msi packages, so as long as WiX correctly built the package, it's not involved in the runtime (not counting custom actions).

destiny14 commented 1 month ago

I know, but the rollback worked fine when using WiX 3, and I don't think the MSI runtime changed that much in the last months.

barnson commented 1 month ago

Maybe add that to your repro?

destiny14 commented 1 month ago

I edited my report.

barnson commented 1 month ago

I meant your repro project.

destiny14 commented 1 month ago

The reason it was working with WiX3 is a different sequencing, it was sequenced after InstallInitialize and thus executed before the product registration. It is broken in WiX3 too.

I did compare it to a package generated with Advanced Installer. I tried recreating the custom action as good as possible, it is a custom code action which fails. Advanced Installer does not allow sequencing between InstallExecute and -Finalize, so I moved the CA in WiX to before InstallExecute, which yielded the same result (broken rollback). Here is a screenshot comparing both packages. WiX (broken rollback) is on the left, AI (working rollback) is on the right.

image

So it seems to me that this problem is actually related to WiX and not caused by the Windows Installer Runtime.

barnson commented 1 month ago

That sequencing is equivalent, though, so...

destiny14 commented 1 month ago

Yes, and using WiX it is broken. Using Advanced Installer it works.

barnson commented 1 month ago

Can you attach that .msi?

destiny14 commented 1 month ago

Sure: advancedinstaller.zip

destiny14 commented 1 month ago

wix.zip