Note that there are some explanatory texts on larger screens.

plurals
  1. PORestartManager fails to restart application during update
    text
    copied!<p>I'm using c#, .net 4, WIX 3.5, Windows Vista. I have made my application compatible with RestartManager by p/invoking the RegisterApplicationRestart method and by handling the WM_QUERYENDSESSION and WM_ENDSESSION window messages (I return <code>new IntPtr(1);</code>).</p> <p>If I try to update my application manually, then everything works as it should:</p> <ol> <li>Launch application;</li> <li>Launch msi file containing new app version;</li> <li>During the installation/update, I'm prompted to close the running application;</li> <li>Upon continuing the running app is closed, install completes, and the app is restarted;</li> </ol> <p>If I try to update my application from the application itself, then I run into problems:</p> <p>1) Launch application;<br> 2) Download the new msi file;<br> 3) Launch msi file with: </p> <pre><code> using (System.Diagnostics.Process p = new System.Diagnostics.Process()) { p.StartInfo.UseShellExecute = false; p.StartInfo.FileName = "msiexec"; p.StartInfo.Arguments = "/i \"" + downloadPath + "\" /passive"; p.StartInfo.UserName = "Administrator"; p.StartInfo.Password = securePassword; p.Start(); } </code></pre> <p>4) Because I'm using passive mode, the application is closed automatically;<br> 5) After the installation, my application is not restarted and under Event Viewer I have an<br> Event 10007 - <em>Application or service 'MyApp' could not be restarted</em>.</p> <p>I have tried:</p> <ol> <li>Not to use passive mode for msiexec;</li> <li>Launch msiexec via cmd.exe (cmd.exe /C "msiexec /i ....") - in the hopes that launching msiexec from another process would solve the problem;</li> <li>Wait for 60+ seconds before launching the msi update (shouldn't be relevant in my scenario, but MSDN documentation has something about it...)</li> </ol> <p>But none of the above has worked (always the same result).</p> <p>Having to launch the setup with elevated permissions might have something to do with the issue, because during the manual update I get a warning in the Event Viewer - <em>Application MyApp (pid 3220) cannot be restarted - Application SID does not match Conductor SID</em>.<br> Despite this, restarting the app still works. Googleing the warning yields no good/specific results, only that this warning is probably caused by running the msi in an elevated prompt.</p> <p><strong>How do I fix (or workaround) this issue, so that I can update my application from the application itself and restart my application afterwards?</strong></p> <p><strong>Edit - extra testing:</strong></p> <ol> <li>There doesn't seem to be a need to respond to WM_QUERYENDSESSION and WM_ENDSESSION messages, because application restart during a manual upgrade works without them, so we can rule them out;</li> <li>If I don't provide administrator credentials to the application initiated upgrade and instead I type them in during the upgrade, then app restarting works;</li> <li>If I run an elevated command prompt and initiate an application upgrade from there (manually), then app restarting still works;</li> <li>In order for application upgrade to work at all under Standard user accounts (so far I tested under an Administrator account with UAC), then I also have to set <code>p.StartInfo.LoadUserProfile = true;</code>. Otherwise nothing happens. (application restart still doesn't work though);</li> <li>I tried all other process StartInfo parameters that I could set - WorkingDirectory, Redirect, Verb<br> (= "runas") - no change in results;</li> <li>I installed Vista SP2 onto the virtual machine that I have been testing on (so far ran SP1), but no change;</li> <li>I performed an "automatic" application upgrade with verbose logging. In the end there was an error message - <strong>RESTART MANAGER: Failed while restarting applications. Error: 352</strong>. That error code is very generic (<a href="http://msdn.microsoft.com/cs-cz/library/aa373665" rel="noreferrer">http://msdn.microsoft.com/cs-cz/library/aa373665</a>), inorder to get more detailed info I would have to write my own installer that would call <em>RmGetList</em> after the error, then I might get more details (this though is something I'm not willing to do);</li> </ol> <p><strong>Edit 2 - msi log file:</strong><br> <a href="http://mommi.planet.ee/muu/log.txt" rel="noreferrer">http://mommi.planet.ee/muu/log.txt</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload