Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding prompt to CloseApplication prevents installer from completing. #688

Closed
GilesBathgate opened this issue Aug 7, 2019 · 5 comments
Closed

Comments

@GilesBathgate
Copy link
Contributor

When I set PromptToContinue = true to a within a CloseApplication, the prompt dialog doesn't return the correct return code and so no matter which button is pressed "Abort"/"Retry"/"Ignore" the installer fails:

var project = new ManagedProject("MyProduct",
                            new Dir(@"%ProgramFiles%\My Company\My Product",
                                new File("Program.cs")),
                             new CustomActionRef("WixCloseApplications", When.Before, Step.CostFinalize, new Condition("VersionNT > 400")),
                             new CloseApplication("chrome.exe", true, false) { PromptToContinue = true, Description = "Close Chrome" });

The log is as follows

Info: === Logging started: 07/08/2019  16:29:36 ===
CommonData: Message type: 0, Argument: 1033
CommonData: Message type: 1, Argument: MyProduct
ActionStart: Action 16:29:36: INSTALL. 
Info: Action start 16:29:36: INSTALL.
CommonData: 1: 0 2: 1033 3: 1252 
CommonData: 1: 0 2: 1033 3: 1252 
CommonData: 1: MyProduct
Info: === Logging started: 07/08/2019  16:29:40 ===
CommonData: Message type: 0, Argument: 1033
CommonData: Message type: 1, Argument: MyProduct
ActionStart: Action 16:29:40: INSTALL. 
Info: Action start 16:29:40: INSTALL.
InstallStart: 1: MyProduct 2: {6FE30B47-2577-43AD-9095-1861CA25889C} 
ActionStart: Action 16:29:40: WixSharp_InitRuntime_Action. 
Info: Action start 16:29:40: WixSharp_InitRuntime_Action.
Info: SFXCA: Extracting custom action to temporary directory: C:\Users\Giles\AppData\Local\Temp\MSI9812.tmp-\
Info: SFXCA: Binding to CLR version v4.0.30319
Info: Calling custom action WixSharp!WixSharp.ManagedProjectActions.WixSharp_InitRuntime_Action
Info: Action ended 16:29:40: WixSharp_InitRuntime_Action. Return value 1.
ActionStart: Action 16:29:40: WixSharp_Load_Action. 
Info: Action start 16:29:40: WixSharp_Load_Action.
Info: SFXCA: Extracting custom action to temporary directory: C:\Users\Giles\AppData\Local\Temp\MSI989F.tmp-\
Info: SFXCA: Binding to CLR version v4.0.30319
Info: Calling custom action WixSharp!WixSharp.ManagedProjectActions.WixSharp_Load_Action
Info: Action ended 16:29:40: WixSharp_Load_Action. Return value 1.
ActionStart: Action 16:29:40: AppSearch. Searching for installed applications
Info: Action start 16:29:40: AppSearch.
Info: Action ended 16:29:40: AppSearch. Return value 0.
ActionStart: Action 16:29:40: ValidateProductID. 
Info: Action start 16:29:40: ValidateProductID.
Info: Action ended 16:29:40: ValidateProductID. Return value 1.
ActionStart: Action 16:29:40: CostInitialize. Computing space requirements
Info: Action start 16:29:40: CostInitialize.
Info: Action ended 16:29:40: CostInitialize. Return value 1.
ActionStart: Action 16:29:40: FileCost. Computing space requirements
Info: Action start 16:29:40: FileCost.
Info: Action ended 16:29:40: FileCost. Return value 1.
ActionStart: Action 16:29:40: WixCloseApplications. 
Info: Action start 16:29:40: WixCloseApplications.
Warning: Close Chrome
Info: WixCloseApplications:  Error 0x80073fff: Unexpected return value from prompt to continue.
Info: WixCloseApplications:  Error 0x80073fff: Failure while prompting user to continue to close application.
Info: CustomAction WixCloseApplications returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Info: Action ended 16:30:28: WixCloseApplications. Return value 3.
Info: Action ended 16:30:28: INSTALL. Return value 3.
InstallEnd: 1: MyProduct 2: {6FE30B47-2577-43AD-9095-1861CA25889C} 3: 3 
CommonData: 1: 2 2: 0 
CommonData: 1: 2 2: 1 
Info: Action ended 16:30:28: INSTALL. Return value 3.

@GilesBathgate
Copy link
Contributor Author

If I use the managed UI the bug occours:

project.ManagedUI = ManagedUI.Default;

If I use the standard UI the bug does not occour:

project.UI = WUI.WixUI_Minimal;

@GilesBathgate
Copy link
Contributor Author

@GilesBathgate
Copy link
Contributor Author

GilesBathgate commented Aug 8, 2019

As a workaround it seems you can add this to the ProcessMessage override in ProgressDialog

public override MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton)
        {
            switch (messageType)
            {
                case InstallMessage.Error:
                case InstallMessage.Warning:
                case InstallMessage.User:

                        var dialogResult = MessageBox.Show(
                            this,
                            messageRecord.ToString(),
                            "[ErrorDlg_Title]".LocalizeWith(Runtime.Localize),
                            (MessageBoxButtons)(int)buttons,
                            (MessageBoxIcon)(int)icon,
                            (MessageBoxDefaultButton)(int)defaultButton);

                        return (MessageResult)dialogResult;
                       ...

However this, unfortunately, will display the message dialog twice

@GilesBathgate
Copy link
Contributor Author

@oleg-shilo Can you also please consider #692

@oleg-shilo
Copy link
Owner

All done. Merged. Txs

oleg-shilo pushed a commit that referenced this issue Aug 11, 2019
* Added registry values aggregator (`RegKey`):
  ```
  new RegKey(fullSetup, RegistryHive.LocalMachine, @"Software\My Company\My Product",
      new RegValue("Message", "Hello"),
      new RegValue("Count", 777)),
  ```
* Issue #699: Wix Error for ServiceInstaller if at least one ServiceConfig parameter is not specified
* Improvements to DigitalSignature to allow loading cert by sha1hash
* Implemented custom message dialog instead (of the default MessageBox.Show) for displaying error message (if any detected) during the MSI session.
* Issue #688: Adding prompt to CloseApplication prevents installer from completing.
* Issue #683. Close MSI Interop handles when getting data from MSI
* Issue #672: outdir and BuildMsiCmd fails because the outdir is not created
* Issue #670: msi is always creating root folder, even if feature is disabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants