clickonce does not register if user shuts down PC

Add-in Express™ Support Service
That's what is more important than anything else

Only registered users are allowed to subscribe.
clickonce does not register if user shuts down PC
clickonce does not register if user shuts down PC 
Subscribe
aweber




Posts: 62
Joined: 2013-11-21
Sorry to post a new thread. Someone closed and/or locked my previous one.

We are re-testing this issue (see: old thread )

We are not seeing the expected behavior.

What appears "new" is that there is a "Waiting for...Installer" when you attempt to shutdown or restart the PC while the ClickOnce installer is still running. The user is given the option to Cancel his/her shutdown. However, if the user clicks "Cancel" to show his/her desktop again, there is no Installer running (apparent to them). What the installer is waiting for is for the user to close the MS Office application(s) that are holding-up the installer from registering the ClickOnce application. So they are going to try shutting down again, and probably "Force Shutdown", because the application that is waiting is not running (visibly). What they need to do is close all Office apps and then wait for the "Registration Succeeded" dialog. None of that is obvious in any way to an end user.

Either the installer should track its progress and continue on an interruption caused by shutdown/restart, or it should be able to check that the last installation failed to register and upon checking for update again, it should "see" the latest version so the user can try again. Or the installer should offer to close the apps that are holding it up in order to continue.

Simply forcing the PC to halt shutdown and point to a phantom application that is holding up the shutdown (the user can not see this application and will eventually just force shutdown) does not "fix" anything.

Respectfully,
AJ
Posted 02 Oct, 2017 12:44:48 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello AJ,

That topic was closed automatically after 30 days of inactivity.

When your code calls CheckForUpdates(), an adxlauncher.exe is started; this is stage #1. The launcher is the actual application that is deployed and installed using ClickOnce; your add-in is sort of payload for the launcher; the launcher is installed so that a check for updates occurs when it starts. So, calling CheckForUpdates() starts launcher (with no GUI) and this causes the ClickOnce service to do its job (#2): check for updates, download the new version, create a folder structure to keep the files, etc. This ends with starting adxlauncher.exe from the new version (#3). The launcher creates the registry keys required for your add-in and shows an everything-is-okay message box ; this is #4. It takes fractions of a second to get from #3 to #4. There's a variant of this route, however: If the launcher finds the host application started, it shows (#3a) a message box informing the user that for installing the add-in update the host should be closed; after the user closes this message box, the launcher begins waiting for the host to close (#3b); when the host closes (#3c), the registry keys get created and we arrive at #4.

In the scenario that you test, do you start the shutdown process at the stage #2, or at the stage #3b? Does initiating the shutdown closes the Office application or not?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 04 Oct, 2017 08:32:52 Top
aweber




Posts: 62
Joined: 2013-11-21
Thank you for the detailed reply.

To answer your question, we reproduce the issue consistently if you start to shutdown the PC at "3b".

I think the main issue occurs because the info presented in "3a" is not "strict" and is a little confusing. It starts with a statement ("You must close 'Outlook' for the update to complete."), but then asks a question, ("Would you like us to restart it after you close it?"). The focus ends-up on the latter part of the text, because the user if focused on which button they should press.

If the application must be closed to complete the update, you should force it to close. That would basically fix the problem, and would not be unreasonable when the user chose to update the application (add-in). When the user selects his/her choice and that dialog goes away...but nothing appears to happen...they continue using the application. Strictly speaking, this is user error, but it is a byproduct of some confusion in the process and dialog info presented.

To answer your follow-on question, no, apparently Windows will not force-close Outlook while the adxlauncher.exe is still "Waiting" in the background.

I think adxlauncher install/update should track its progress somewhere and upon next restart of the PC should verify that it completed (runonce key?). If it did not complete, it should do so at that time. Many installers/updaters do this when there are conflicts with running applications and/or locked files.

Finally, not to confuse the main issue, but for your additional information...what we have found so far to remediate this issue is to launch the clickonce URL directly from IE. This immediately brings you to the general "Register/Unregister" dialog. If you click "Unregister" and then "Register", the updated/latest version is then correctly registered. NOTE: You can do this when the applications are running. Upon restart of the application, the latest version will be loaded. I do not understand how you determined that "you can not register the add-in while the applications are running". It absolutely works. We have tested it a number of times.

-AJ
Posted 04 Oct, 2017 09:36:01 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello AJ,

aweber writes:
If the application must be closed to complete the update, you should force it to close.


aweber writes:
I think adxlauncher install/update should track its progress somewhere


Adxlauncher is not an installer! It is passive; ClickOnce installs it. When the launcher gets installed, it starts (#3) and registers your add-in (#4). If it isn't installed, there's no software to start it anew!

The inability to provide a full control over the installation process is one of the disadvantages of ClickOnce. This is why we stopped developing this part of Add-in Express and developed ClickTwice instead; in this case we have every little thing we need to support a great number of installation scenarios. Just to feel the difference: you can specify that the dialog window asking the user to close the host application shows a Cancel button. In ClickOnce, it is too late to cancel installing your add-in once the launcher asks for closing the host application: the dialog is shown by the launcher from the new version which is already installed!

BTW, I've noticed that the text that you cited is different from the one I see in the code of Add-in Express:

alertText = "You have the following applications running on your machine:
  {0}
  {1}
  {2}
  {3}
  {4}
  {5}
  {6}
  {7}
  {8}
  {9}
  {10}

Please close the above application(s) for the installation process to complete.
Do you want the application(s) to start automatically after the installation is completed?";


I might agree that the text isn't styled really well and such but I cannot agree to your "If the application must be closed to complete the update, you should force it to close." Imagine a user working on a document/email and expecting to save or delete it *before* the application closes. How to deal with this?

aweber writes:
Strictly speaking, this is user error, but it is a byproduct of some confusion in the process and dialog info presented.


We can change the text; we can't change the process: our hands are tied with restrictions of ClickOnce.

aweber writes:
I think adxlauncher install/update should track its progress somewhere and upon next restart of the PC should verify that it completed (runonce key?).


See above. ClickTwice supports this scenario.

aweber writes:
I do not understand how you determined that "you can not register the add-in while the applications are running". It absolutely works. We have tested it a number of times.


It is possible to register, it isn't possible to unregister on the fly because the files are locked.

Still, even registering may create a problem. Say, you use a CTP. The running application shows a CTP instance created from version #1. After you register version #2, COM-related registry entries point to assembly #2. When the user opens a new window and Add-in Express performs COM calls to create a CTP, they fail because the assembly #2 isn't loaded.

In the example above the COM interfaces that your add-in provides are intact. Modifying them may produce more issues. Any of these cannot occur if you use ClickTwice: it will uninstall an old add-in version before installing a new one.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 05 Oct, 2017 08:56:37 Top