MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
444 stars 53 forks source link

WebView2Install /silent /install - no easy way to wait, crashing consuming applications #1349

Open g466a opened 3 years ago

g466a commented 3 years ago

Description The WebView2 Installers (Bootstrapper+Standalone) exit too early, when run with /silent /install from another installer. There is no easy way for a parent installer to correctly wait until the installation finishes. Our Installer starts the WebView2 Consuming Application (Outlook.exe) immediately after the installation, causing Outlook.exe to have Access Violations and this even corrupts WebView2/Edge Data directories sometimes. We must support Windows 7 to Windows 10, so we expect that we will always need to include WebView2 in our installer. We do not want to deploy fixed versions along with our application since that would be too difficult/inappropriate.

If we manually install WebView2 to ensure the installation finishes before the Consuming Application (Outlook.exe) starts, then everything works fine.

Version Public Installer Versions avaiable as of 01-June-2021 from https://developer.microsoft.com/de-de/microsoft-edge/webview2/ Installers that we are interested in: Bootstrapper (prefered) Standalone Installer

Repro Steps

Expected behaviour

Actual behaviour

In our scenario this even means:

Additional context Our Scenario:

AB#44876475

champnic commented 3 years ago

Thanks for the report @g466a - I'll follow up with our installer team to see what the intended behavior is here and if there's a workaround.

champnic commented 3 years ago

@g466a The installers should wait for completion before exiting, even when run silently.

Can you try the following? • uninstall WebView2 Runtime for clean state • rerun the silent install in an admin cmd • observe whether Webview2Setup.exe is exiting right away • observe if the exit code is 0 for success (echo %errorlevel%) or non-zero for failure • observe whether WebView2 Runtime was installed • if any failures or anything looked off, try just running the Webview2Setup.exe from admin cmd without any additional args if anything is different.

Afterwards, could you share these logs? %ALLUSERSPROFILE%\Microsoft\EdgeUpdate\Log\MicrosoftEdgeUpdate.log %LOCALAPPDATA%\Temp\msedge_installer.log %systemroot%\Temp\msedge_installer.log

Thanks!

g466a commented 3 years ago

Ok, here is what I did:

To me it seems as if the the installer simply does not wait...

Screenshot001 appdata_msedge_installer.log MicrosoftEdgeUpdate.log windows_temp_msedge_installer.log

champnic commented 3 years ago

Thanks a lot for the information! We were able to repro the issue and are digging in. In the meantime, one possible solution is to wait for this Clients key to not be null or empty: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}\pv

https://microsoft.visualstudio.com/Edge/_wiki/wikis/Edge.wiki/5492/Detecting-Microsoft-Edge-(Chromium-based)-aka-Anaheim-installed-channels?anchor=channel-keys

g466a commented 3 years ago

Glad to help and thanks for the information - the provided workaround will save us A LOT of trouble with our testers... Thanks a lot!

suprnova74 commented 2 years ago

A workaround I've found is to use start.exe to truly wait. if running from a non .cmd file (i.e powershell, vbscript, etc) it would be: cmd /c start.exe "install" /wait "fullpathtoyourinstaller.exe" /silent /install.

This waited ~15-20 seconds before returning whereas running it directly returned immediately.

Some installations such as Autodesk DWG Trueview behave similarly, but they added a /sms switch so the initial .exe waits for all spawned processes to accommodate similary. Not sure how feasible that is to do for this installer.

fvanheeswijk commented 1 year ago

We are also experiencing this problem in our WiX installer, unfortunately there is not really a way to wait on it with a start.exe call while it is still embedded in the .msi...

When can we expect a fix?

champnic commented 1 year ago

Added this to our backlog. I wouldn't wait for a fix here though. It will lower priority given the runtime has now been pushed to nearly all Win10 devices and is inbox on Win11 (and Win 7/8/8.1 is no longer supported).

NJullienSweet commented 10 months ago

A workaround I've found is to use start.exe to truly wait. if running from a non .cmd file (i.e powershell, vbscript, etc) it would be: cmd /c start.exe "install" /wait "fullpathtoyourinstaller.exe" /silent /install.

This waited ~15-20 seconds before returning whereas running it directly returned immediately.

Some installations such as Autodesk DWG Trueview behave similarly, but they added a /sms switch so the initial .exe waits for all spawned processes to accommodate similary. Not sure how feasible that is to do for this installer.

I came up with the same solution, but with Powershell's Start-Process which I find more readable:

Start-Process "<PathHere>/MicrosoftEdgeWebview2Setup.exe" -ArgumentList "/silent","/install" -Wait