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

(webview2-runtime) only uses x86, not x64 #223

Closed
2 tasks done
asheroto opened this issue May 23, 2024 · 12 comments
Closed
2 tasks done

(webview2-runtime) only uses x86, not x64 #223

asheroto opened this issue May 23, 2024 · 12 comments
Assignees
Labels
enhancement An enhancement to the package functionality. in progress Work has started / is in progress. waiting on user Waiting on a response from the original poster.

Comments

@asheroto
Copy link

Checklist

  • I have checked for similar opened and closed issues.
  • The issue title is in the format (<PACKAGENAME>) <ISSUE SUMMARY>.

Chocolatey Version

2.2.2

Chocolatey License

None

Package Version

125.0.2535.51

Current Behaviour

I started having issues with WebView2. Wasn't sure what happened. Then I realized that Chocolatey had updated WebView2, but my x64 installation was not actually updated. After updating manually with x64, my WebView2 programs began to function again. It appears that if you only update the x86 and you have an application that targets x64 CPUs, then those programs may break, so both must be installed.

Upon checking the install script, I found that only the x86 package is installed via Choco. Maybe they only had an x86 package to begin with, not sure. Now several architectures are supported.

The Evergreen Standalone installer section is what we're after:
https://developer.microsoft.com/en-us/microsoft-edge/webview2?ch=1&form=MA13LH#download

You could use the Bootstrapper, but then the checksum will change when Microsoft updates it, of course.

Expected Behaviour

Install x86 and x64 as Windows 10/11 supports both, or x64 by default and make available the --forcex86 param.

https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/fa577566-d918-4acc-ad0d-d81c60c9d6ba/MicrosoftEdgeWebView2RuntimeInstallerX64.exe

Steps To Reproduce

  1. Install the package
  2. Confirm that x64 is not installed

Environment

- Operating System (run `[System.Environment]::OSVersion.ToString()` in a PowerShell session): Microsoft Windows NT 10.0.22621.0
- PowerShell Version (run `$PSVersionTable` in a PowerShell session):

Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

- Shell: Windows Terminal / PowerShell 7.4.2

Chocolatey Log

N/A

Anything else?

I will submit a PR to assist.

Copy link

Thanks for raising this issue!

The packages within this repository are maintained in my spare time. My spare time, like yours is important. Please help me not to waste it.

To help me, and to have the issue resolved more quickly, please see CONTRIBUTING for how to raise a pull request to resolve the issue yourself.

Thank you.

@asheroto
Copy link
Author

asheroto commented May 23, 2024

I'm not sure how to best handle this. At first I was going to modify the install script for this, but would that affect uninstall?

If we use the url/url64, then it'll install x64 by default, which may not be what we want to do either.

chocolateyinstall.ps1

$ErrorActionPreference = 'Stop'
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"

$packageArgsX86 = @{
  packageName   = $env:ChocolateyPackageName
  unzipLocation = $toolsDir
  fileType      = 'EXE'
  url           = 'https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/b87a52b9-351d-4b15-af14-70a878199712/MicrosoftEdgeWebView2RuntimeInstallerX86.exe'
  softwareName  = 'Microsoft Edge WebView2*'
  checksum      = '0ECB676812C9372A14203E3949394DF3CA736E4E8D3F2784767154AB32572EEF'
  checksumType  = 'sha256'
  silentArgs    = '/silent /install'
  validExitCodes= @(0)
}

$packageArgsX64 = @{
  packageName   = $env:ChocolateyPackageName
  unzipLocation = $toolsDir
  fileType      = 'EXE'
  url           = 'https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/fa577566-d918-4acc-ad0d-d81c60c9d6ba/MicrosoftEdgeWebView2RuntimeInstallerX64.exe'
  softwareName  = 'Microsoft Edge WebView2*'
  checksum      = '06C56C8E4D03D59ADF12B173DA81BEBDCB6A688449DE7E8402ED39CB4709B327'
  checksumType  = 'sha256'
  silentArgs    = '/silent /install'
  validExitCodes= @(0)
}

Install-ChocolateyPackage @packageArgsX86
Install-ChocolateyPackage @packageArgsX64

I noticed that the icon is 117x117 px, and of course the Choco recommended size is at least 128x128 px. Here is an svg you could use.

https://github.com/pauby/ChocoPackages/assets/49938263/3fb47d66-c6ee-4dfc-aa81-b6bee5840599

Here's how dotnet-runtime handles a similar situation:
https://community.chocolatey.org/packages/dotnet-8.0-runtime#files

Also noticed that dotnet is a virtual package to dotnet-runtime. Perhaps webview2 could be a virtual package to webview2-runtime?

@pauby
Copy link
Owner

pauby commented May 25, 2024

Installing both x86 and x85 of 125.0.2535.67

From my testing, you cannot have both the x86 and x64 versions of the software installed (I created a new branch)

If you have the package installed with choco install webview2-runtime --forcex86.

image

Note the installer being downloaded is the x86 one (emphasis mine):

Downloading webview2-runtime 32 bit
  from 'https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/368f1305-6fe1-40e2-81b8-e305f6821b37/MicrosoftEdgeWebView2RuntimeInstallerX86.exe'

You can find out what is installed using the Chocolatey helper Get-UninstallRegistryKey:

image

(Note the PSPath registry key contains Wow6432Node which indicates the software is a 32-bit version running on a 64-bit Windows).

If you then install the package again (to use your architecture specific version - in my case x64) using choco install webview2-runtime --force :

image

Note the installer being downloaded is the x64 one (emphasis mine):

Downloading webview2-runtime 64 bit
  from 'https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/35ae885b-96ae-4a0e-8cfe-2e50c769ad87/MicrosoftEdgeWebView2RuntimeInstallerX64.exe'

Using the Chocolatey helper Get-UninstallRegistryKey again:

image

Notice the PSPath still has the Wow6432Node entry, which tells me nothing has changed.

I'm going to try to install the older version (which will install x86) and then try to do an upgrade (which will use the x64 installer) and see what happens.

@pauby
Copy link
Owner

pauby commented May 25, 2024

Upgrade from 125.0.2535.541 x86 to 125.0.2535.67 x64

I installed the latest version from the chocolatey Community Repository (which is currently 125.0.2535.51 (I forgot to take a screenshot of that before rebooting the VM). But I did grab the text of the output of Get-UninstallRegistryKey:

DisplayName     : Microsoft Edge WebView2 Runtime
ModifyPath      : "C:\Program Files (x86)\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe" /install appguid={F301722
                  6-FE2A-4295-8BDF-00C3A9A7E4C5}&appname=Microsoft%20Edge%20WebView&needsadmin=true&repairtype=wi
                  ndowsonlinerepair /installsource offline
UninstallString : "C:\Program Files (x86)\Microsoft\EdgeWebView\Application\125.0.2535.51\Installer\setup.exe"
                  --uninstall --msedgewebview --system-level --verbose-logging
InstallLocation : C:\Program Files (x86)\Microsoft\EdgeWebView\Application
DisplayIcon     : C:\Program Files (x86)\Microsoft\EdgeWebView\Application\125.0.2535.51\msedgewebview2.exe,0
NoRepair        : 1
Publisher       : Microsoft Corporation
Version         : 125.0.2535.51
DisplayVersion  : 125.0.2535.51
InstallDate     : 20240208
VersionMajor    : 2535
VersionMinor    : 51
PSPath          : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\C
                  urrentVersion\Uninstall\Microsoft EdgeWebView
PSParentPath    : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\C
                  urrentVersion\Uninstall
PSChildName     : Microsoft EdgeWebView
PSProvider      : Microsoft.PowerShell.Core\Registry

Note the Version and the PSPath containing Wow6432Node again which makes sense as that version is only installing the x86 version.

Running choco upgrade webview2-runtime -s . (which will instyall the latest version I just created with the x64 installer):

Screenshot_%Y%M%D_%H%m%S-12

And Get-UninstallRegistryKey returns:

DisplayName     : Microsoft Edge WebView2 Runtime
ModifyPath      : "C:\Program Files (x86)\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe" /install appguid={F301722
                  6-FE2A-4295-8BDF-00C3A9A7E4C5}&appname=Microsoft%20Edge%20WebView&needsadmin=true&repairtype=wi
                  ndowsonlinerepair /installsource offline
UninstallString : "C:\Program Files (x86)\Microsoft\EdgeWebView\Application\125.0.2535.67\Installer\setup.exe"
                  --uninstall --msedgewebview --system-level --verbose-logging
InstallLocation : C:\Program Files (x86)\Microsoft\EdgeWebView\Application
DisplayIcon     : C:\Program Files (x86)\Microsoft\EdgeWebView\Application\125.0.2535.67\msedgewebview2.exe,0
NoRepair        : 1
Publisher       : Microsoft Corporation
Version         : 125.0.2535.67
DisplayVersion  : 125.0.2535.67
InstallDate     : 20240525
VersionMajor    : 2535
VersionMinor    : 67
PSPath          : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\C
                  urrentVersion\Uninstall\Microsoft EdgeWebView
PSParentPath    : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\C
                  urrentVersion\Uninstall
PSChildName     : Microsoft EdgeWebView
PSProvider      : Microsoft.PowerShell.Core\Registry

Note the new version number and PSPath containing Wow6432Node again.

@pauby
Copy link
Owner

pauby commented May 25, 2024

Installing 125.0.2535.67 x64

image

Get-UninstallRegistryKey gives us:

DisplayName     : Microsoft Edge WebView2 Runtime
ModifyPath      : "C:\Program Files (x86)\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe" /install appguid={F301722
                  6-FE2A-4295-8BDF-00C3A9A7E4C5}&appname=Microsoft%20Edge%20WebView&needsadmin=true&repairtype=wi
                  ndowsonlinerepair /installsource offline
UninstallString : "C:\Program Files (x86)\Microsoft\EdgeWebView\Application\125.0.2535.67\Installer\setup.exe"
                  --uninstall --msedgewebview --system-level --verbose-logging
InstallLocation : C:\Program Files (x86)\Microsoft\EdgeWebView\Application
DisplayIcon     : C:\Program Files (x86)\Microsoft\EdgeWebView\Application\125.0.2535.67\msedgewebview2.exe,0
NoRepair        : 1
Publisher       : Microsoft Corporation
Version         : 125.0.2535.67
DisplayVersion  : 125.0.2535.67
InstallDate     : 20240525
VersionMajor    : 2535
VersionMinor    : 67
PSPath          : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\C
                  urrentVersion\Uninstall\Microsoft EdgeWebView
PSParentPath    : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\C
                  urrentVersion\Uninstall
PSChildName     : Microsoft EdgeWebView
PSProvider      : Microsoft.PowerShell.Core\Registry

Note the PSPath still having Wow6432Node in there.

@pauby
Copy link
Owner

pauby commented May 25, 2024

The questions I'm left with are:

  1. Does the x64 installer install both x86 and x64, or just x64? And I assume the x86 installer will only install the x86 version, no matter the architecture being installed onto.
  2. How do I know which architecture is installed? I was intending to check the PSPath and look for Wow6432Node and determine it was the x86 version from that. But that doesn't look to be a good test.

@dandudley you raised issue #195 so I'm hoping that you may also be able to help with the questions above?

Until I understand more about what the installers are doing, I'm going to put this on hold.

@asheroto
Copy link
Author

Thanks for for checking this out. I'm out of town but will look at it closer on Tuesday.

Preliminary Googling shows a possible answer of x86 and x64 being installed when x64 is installed, but not sure. Given the other facts this may be the case. Will let you know.

@pauby
Copy link
Owner

pauby commented May 25, 2024

Preliminary Googling shows a possible answer of x86 and x64 being installed when x64 is installed

I'll pull on that thread for a bit. If that is the case then all the fancy code I was going to put in to detect if x86 version was already installed, is not needed!

@pauby
Copy link
Owner

pauby commented May 25, 2024

From this GitHub issue:

Any x86/x64 app should be able to use either arch runtime. So we should dig in further as to why the app is failing with x64 runtime.
Comment

A 64-bit app running on a 64-bit machine should work fine with a 32-bit WebView2 runtime. I'm also trying to confirm, but I believe if you use the bootstrapper (https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section) that it will automatically upgrade to the 64-bit version if it can, and won't do anything if already installed. This should save you from having to do custom logic yourself.
Comment.

On that basis, the updated package in the branch should work as expected and won't cause issues for anybody who already has a previous (x86) version installed (which is my biggest concern).

As the new version has been published today, we have a bit of time to sort this out before the next version is likely to be released. So I'll wait to hear back before moving forward.

@pauby pauby added enhancement An enhancement to the package functionality. in progress Work has started / is in progress. waiting on user Waiting on a response from the original poster. labels May 25, 2024
@pauby pauby self-assigned this May 25, 2024
@asheroto
Copy link
Author

asheroto commented Jun 3, 2024

Alright I just had some time to test this out (almost 3 AM now!!!)

Downloading WebView2 from: https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section
x86 direct link
x64 direct link

I created the following builds of the same application (MessagesForWeb.exe):

  • x86
  • x64
  • AnyCPU (prefer 32-bit)
  • AnyCPU (unchecked prefer 32-bit)

This is the target CPU area of Visual Studio, as referenced above. Under application properties > Compile.

image


MessagesForWeb x86

Installed MicrosoftEdgeWebView2RuntimeInstallerX64.exe
Application works.

MessagesForWeb x64

Installed MicrosoftEdgeWebView2RuntimeInstallerX86.exe
Application works.

MessagesForWeb AnyCPU (prefer 32-bit)

Installed MicrosoftEdgeWebView2RuntimeInstallerX64.exe
This did not work at first, just a blank white WebView2 page.
image
Relaunching fixed it.

Installed MicrosoftEdgeWebView2RuntimeInstallerX86.exe
This did NOT work when I first ran it, just a blank canvas...
image
Relaunching fixed it.

MessageForWeb AnyCPU

MicrosoftEdgeWebView2RuntimeInstallerX64.exe
Application works.

MicrosoftEdgeWebView2RuntimeInstallerX86.exe
This did NOT work when I first ran it, just a blank canvas...
image
Relaunching fixed it.


Tested using Windows Sandbox along with various builds of MessagesForWeb. Here are the compiled builds in ZIP format but you can compile from source if you prefer. Note that even though there are 'runtimes' in each build, you still have to install WebView2 for the machine for the application to run.

MessagesForWeb-all_builds.zip

The application opens after installing. If it runs successfully, you should see a QR code appear. Note that the application closes to a system tray icon. Right-click on the icon and exit to exit.


In summary, when using x86 or x64 targeted builds, using either the x86 or x64 installer of WebView2 appears to run the application as expected. Therefore we can assume that the x86 may install (or allow to work) the x64 version. However, if the application targets AnyCPU or AnyCPU (prefer 32-bit), the application may need to be restarted before it will run. I tried replicating this a few times and got mixed results. I think there may be a delay in registering some of the components which is why it sometimes doesn't work at first.

When I originally opened this issue, this type of 'blank canvas' situation is exactly what I had happen with some of my WebView2 apps. Except 3 of the apps had the same thing happen. I even experienced the issue with lencx/ChatGPT which isn't mine and not built using Visual Studio (but still uses WebView2). Was finally able to fix everything after I tried some fenagling to repair/reinstall.

My gut feeling tells me this is some type of upgrade bug or component registration delay.

Long story short, it does appear that x86 or x64 will work with each other, although to me it seems that x64 should be the default option as all modern machines are 64-bit.

I think we're good since everything does eventually work but may require a few application restarts.

Hope this helps!

@pauby
Copy link
Owner

pauby commented Jun 3, 2024

@asheroto that is awesome. Thank you for such a thorough test. I've added a note to the package description and pointed it to your comment. I've also merged the branch in with the changes.

@pauby pauby closed this as completed Jun 3, 2024
@asheroto
Copy link
Author

asheroto commented Jun 3, 2024

Happy to help! Excellent idea on the package description. That should clear up any oddball situations, I hope! 😊 Also I appreciate your responsiveness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement to the package functionality. in progress Work has started / is in progress. waiting on user Waiting on a response from the original poster.
Projects
None yet
Development

No branches or pull requests

2 participants