clickonce does not register if user shuts down PC

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

clickonce does not register if user shuts down PC
 
aweber




Posts: 62
Joined: 2013-11-21
We are seeing users who are starting an upgrade to their ClickOnce addin in Outlook and then allowing that to continue "in the background" (not really, but they are not paying attention to it, and they continue their work in Outlook and other programs). It appears that eventually they forget they were performing an upgrade and at the close of business, they just shutdown their PC. The result is that the upgraded binaries are installed but never registered (because it apparently waits until the user closes Outlook to do that). If we launch the adxlauncher.exe, and we UNREGISTER, and then REGISTER in that order, the new version is fully functional. Otherwise, the old version remains operational. Is there a way to either: 1) Force register of the new version even if the application has not been closed? OR 2) is there command-line syntax to adxlauncher to unregister then register the new version if we can detect this issue? NOTE: We can not use regsvr32 because we are installing per-user and most users are not able to run regsvr32 due to permissions. (ALSO: Sorry for one paragraph here...for some reason my browser is not allowing me to insert CR!) -AJ
Posted 09 May, 2017 08:50:51 Top
Andrei Smolin


Add-in Express team


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

Currently, this isn't possible to implement this in Add-in Express. But you can implement this yourself if you use a ClickOnce action. Say, you could show a popup in the custom tray. On ClickOnce actions, see section Customizing ClickOnce installations in the PDF file in the folder {Add-in Express}\Docs on your development PC.

In the same code, you can register adxlauncher.exe as an application requiring a process to shutdow; see https://msdn.microsoft.com/ru-ru/library/windows/desktop/ms686227(v=vs.85).aspx and http://hintdesk.com/c-catch-shutdown-event-of-computer/.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 10 May, 2017 10:53:00 Top
aweber




Posts: 62
Joined: 2013-11-21
I'm not clear as to why I would register adxlauncher.exe as an application requiring a process to shutdown. It seems that the install completes, but the registration does not succeed (or even get attempted) until Outlook is closed. But if the user shuts-down his/her PC, Outlook doesn't close cleanly - or doesn't trigger the register action somehow. Is adxlauncher running during the install/register, and if we keep windows from shutting down, you believe it will complete properly??? Please clarify? EDIT: I read through those links. I don't know that they will help. Whatever is responsible for doing the registration of the new version is not working in the situation I documented in my OP. The software/update is fully downloaded and "installed" on disk, but it is not registered properly, because Outlook has not been closed by the user. When Windows shuts down, obviously Outlook is closed, but it does not trigger the register to occur properly...the old version of the add-in loads. If you use the adxlauncher GUI, you must click "Unregister" and then "Register" (in that order) to fix the situation. NOTE: You can do that with Outlook running...I don't know why the automated upgrade/registration can not also happen while Outlook is running (you just won't get the updated code until restart of application).
Posted 10 May, 2017 11:18:57 Top
Andrei Smolin


Add-in Express team


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

When the new add-in version gets downloaded, the new adxlauncher.exe is started. It waits for the host app to close, then it unregisters the old add-in version and registers the new version.

You can't prevent the user from shutting down the PC. What you can do is to show a popup message, sort of "Don't shut the PC down". If the user ignores this message (and they will), you can register adxlauncher.exe as waiting for the process completion. This will show the adxlauncher.exe process on the "Waiting for tasks to complete" screen: this is the last possibility to inform the user that the update is in progress.

Alternatively, you can switch to using ClickTwice: if the update process is terminated in this way, ClickTwice will start it anew when the machine is restarted.

aweber writes:
I don't know why the automated upgrade/registration can not also happen while Outlook is running (you just won't get the updated code until restart of application).


You can only unregister a COM component when it isn't used. If your add-in is loaded, you can't unregister it because the component is loaded and corresponding files are locked.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 11 May, 2017 06:39:29 Top
aweber




Posts: 62
Joined: 2013-11-21
I think I better understand your recommendation now.

However, the notes specific to "ShutdownBlockReasonCreate()" indicate that you must still catch the WM_QUERYENDSESSION and possibly the WM_ENDSESSION in the main window of the process.

Since the process we're trying to add a block for is adxlauncher.exe, I do not have any access to add that code to the process' WndProc. That is ADX's program.

I don't think I can add the ShutdownBlock to Outlook, because we must allow Outlook to close before adxlauncher can complete its unregister/register that we are missing (if I am reading your info correctly).

I can try setting adxlauncher to a later shutdown (with SetProcessShutdownParameters), but it appears that Windows will still just force the shutdown at a later stage.
Posted 11 May, 2017 11:22:21 Top
Andrei Smolin


Add-in Express team


Posts: 14140
Joined: 2006-05-11
Well, you are right. It is better if we implement this logic in Add-in Express; the issue is now filed down under #10664 in our issue-tracking DB. You will have wait for the next Add-in Express build. I'll send you a note when it is published. Unfortunately, no ETA is available at the moment.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 12 May, 2017 07:15:20 Top
aweber




Posts: 62
Joined: 2013-11-21
Can you get us a relative timeframe on this fix? We have users who are stuck upgrading because of this.

Will this be fixed in a number of weeks or months?

Thanks,
AJ
Posted 12 May, 2017 10:34:48 Top
Andrei Smolin


Add-in Express team


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

2-3 months. If we have this specific issue fixed earlier, we'll send you a fixed assembly for testing.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 15 May, 2017 06:53:23 Top
aweber




Posts: 62
Joined: 2013-11-21
Hi Andrei,

Just checking-in to see if any progress has been made on this issue and if there is a patch or beta-release that we can test for you (and us)?

If not, any update on the ETA for the fix?

Thanks,
AJ
Posted 19 Jun, 2017 10:16:53 Top
Andrei Smolin


Add-in Express team


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

No, we don't have a beta or such. We are going to release the new build in 2-4 weeks. I'll send you a note when the build is published.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 Jun, 2017 04:56:36 Top