[wix-users] Custom BA: Silent Uninstall Doesn't Appear to Trigger ApplyComplete

Bryan Dam bryand at recastsoftware.com
Fri Feb 14 12:49:40 PST 2020


I've got a custom BA mostly working and began testing the major upgrade.  Everything mostly works as expected and the new versions are installed ... but the installer never exits.  Dug into it and it looks like after installing the updated packages burn runs the original BA's uninstaller silently.  Ok, my bad, I didn't put any logic to handle silent (un)installs.  I focused on making a silent uninstall work (main bits below) but the problem I'm having is that the ApplyComplete event seems to not be triggered in this scenario.  Which means that the BA threads just sit there doing nothing and never exit.  Works fine in Full UI mode, just not silently.  I added a ApplyBegin handler that writes to the log and can confirm that this is called.  I have a similar log call in ApplyComplete but that never makes it into the log even after everything appears to be finished both in the log (see below) and Add/Remove Programs.

Here's what I think are the relevant bits from the log.  The last line here is the last line of the log.
Plan complete, result: 0x0
Apply begin
ApplyBegin() - LaunchAction: Uninstall
...
...
Finished uninstalling Our Company Management Server
Applied execute package: Our Company.RCT.Server.Installer, result: 0x0, restart: None
Removing cached package: Our Company.RCT.Proxy.Installer, from path: C:\ProgramData\Package Cache\{4604BD2D-E21C-40FE-92BE-1950CF4C4E21}v4.1.1912.26455\
Removing cached package: Our Company.RCT.Server.Installer, from path: C:\ProgramData\Package Cache\{59737062-54CF-4273-898F-1902883D3A8A}v4.1.1912.0\
Session end, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{377148df-e147-4523-8c46-e527d4fc398c}, resume: None, restart: None, disable resume: No
Removed bundle dependency provider: {377148df-e147-4523-8c46-e527d4fc398c}
Removing cached bundle: {377148df-e147-4523-8c46-e527d4fc398c}, from path: C:\ProgramData\Package Cache\{377148df-e147-4523-8c46-e527d4fc398c}\
Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{377148df-e147-4523-8c46-e527d4fc398c}, resume: None, restart initiated: No, disable resume: No
ActionResult  changed: Success.

Here's the pared-down version of what I'm trying to do:

Run()
{
....
if (this.Command.Display == Display.Passive || this.Command.Display == Display.Full)
{
//run Full UI
}
else
{
this.PlanComplete += BootstrapperUI_PlanComplete;
this.ApplyBegin += BootstrapperUI_ApplyBegin;
this.ApplyComplete += BootstrapperUI_ApplyComplete;
this.Engine?.Plan(_vm.LaunchAction);
}
}

private void BootstrapperUI_ApplyBegin(object sender, ApplyBeginEventArgs e)
{
this.Engine.Log(LogLevel.Standard, "ApplyBegin() - LaunchAction: " + _vm.LaunchAction);
}

private void BootstrapperUI_ApplyComplete(object sender, ApplyCompleteEventArgs e)
{
this.Engine.Log(LogLevel.Standard, "ApplyComplete() - Status:" + e.Status);
this.Engine?.Quit(_vm.ExitCode)

                // code to close the BA
}

private void BootstrapperUI_PlanComplete(object sender, PlanCompleteEventArgs e)
{
this.Engine.Log(LogLevel.Standard, "PlanComplete() - Status:" + e.Status);
this.Engine?.Apply(IntPtr.Zero);
}

Anyone have any ideas what I'm doing wrong here?  Everything 'works' ... it just doesn't know when to stop.
      Thanks,
         Bryan


More information about the wix-users mailing list