MicrosoftEdge / WebView2Samples

Microsoft Edge WebView2 samples
863 stars 466 forks source link

Unity Hololens 2 sample crashes at startup #193

Closed ptc-ccrabb closed 1 year ago

ptc-ccrabb commented 1 year ago

I have enrolled my HoloLens in Windows Insider program, using the "Dev" channel. It is running version 22621.1083.arm64fre.ni_release_svc_sydney.230514-1300 and I have reproduced the crash on a fresh reboot.

The debug output in Visual Studio contains this big hint:

WebView2: Failed to find an installed WebView2 runtime or non-stable Microsoft Edge installation.

According to https://learn.microsoft.com/en-us/hololens/hololens-insider#windows-insider-release-notes the WebView2 component should be available in build 10.0.22621.1061 -- I think my installed version ( 22621.1083 ) is newer.

I have made the changes in my Package.appxmanifest as described at https://learn.microsoft.com/en-us/hololens/hololens-insider#webview2-now-available

I have tried to manually install the Dev channel of Microsoft Edge following the instructions at https://www.microsoftedgeinsider.com/en-us/download?platform=hololens2. The installers fail to launch on my HoloLens.

The Mixed Reality Feature Tool is bringing in version 0.17.1-pre.3 of com.microsoft.mixedreality.webview.unity.

Running the sample app through Unity's play mode works just fine.

Is there some change I can make to enable development/exploration of the WebView2 component in a Unity app on a HoloLens 2?

SamiraAtMicrosoft commented 1 year ago

Hi @ptc-ccrabb,

Out of curiosity, have you tried any of the other WebView2 samples on your HoloLens 2 and do you encounter the same error? For instance, there is also a WinUI2 UWP sample (that would also need the package.appxmanifest update).

Also, are you running Debug or Release on your device?

ptc-ccrabb commented 1 year ago

I'm using Release builds in Unity.

The WinUI2 Getting Started App also fails.

If I do not modify package.appxmanifest then I get a runtime error:

WebView2: Failed to find an installed WebView2 runtime or non-stable Microsoft Edge installation. Microsoft.Web.WebView2.Core.dll!00007FFEC49E16A0: ReturnHr(1) tid(aa8) 80070002 The system cannot find the file specified. Msg:[winrt::hresult_error: The system cannot find the file specified.]

If I modify package.appxmanifest I get a deployment error saying the dependency could not be found:

RemoteCommandException: Windows cannot install package 7e053cd8-2f6f-46f0-b7bb-b27448358047_1.0.0.0_arm64__ph1m9x8skttmg because this package depends on a framework that could not be found. Provide the framework "Microsoft.WebView2Runtime.Stable" published by "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or ARM64 processor architecture and minimum version 1.0.0.0, along with this package to install.

0x80073cf3 DEP0700: Registration of the app failed. [0x80004005] Failed to register through new deployment pipeline.

Note that the failure to deploy only happens when the app isn't already deployed to the device. In my first attempt to deploy I deployed over the existing install just fine and the runtime behaviour was the same as without the package.appxmanifest change. I uninstalled the app completely, then tried to redeploy and got the above error message. It appears that changes to package.appxmanifest dependencies are not honored when redeploying an application.

It appears there is something more than opting into the Windows Insider Dev Channel that is necessary to get the WebView2 components installed onto an HL2.

SamiraAtMicrosoft commented 1 year ago

Thank you for the details. Very strange! On your Device Portal can you navigate to System -> Apps. Under Installed apps, can you select Show framework packages and look for Microsoft WebView2 Runtime. (It normally appears just before the "Microsoft.UI.Xaml.*" items.) Does it appear at all in this list? If it does, can you select it and copy and paste the details that are output once you select it?

Also, do you recall the build you were on prior to updating to 22621.1083.arm64fre.ni_release_svc_sydney.230514-1300?

ptc-ccrabb commented 1 year ago

I don't see a Microsoft WebView2 Runtime, but I do see Microsoft.WebView2Runtime.Stable with the following details:

Version: 112.0.1722.58 Publisher: CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US PackageFullName: Microsoft.WebView2Runtime.Stable_112.0.1722.58_arm64__8wekyb3d8bbwe

I don't recall what version I had prior to enrolling in Windows Insider, but I do know that I had gone to Windows Update in Settings and manually checked for and installed all updates then rebooted and checked for updates again prior to enrolling in Windows Insider.

When I enrolled in Windows Insider I first selected the Release Preview channel and let it install. I later found the documentation that stated that the Dev channel was required and then moved to that channel.

JordanMandel commented 1 year ago

If you still have your device in the same state, could you please log a feedback bug using the Feedback Hub and select the category of Updates please? Thanks!

ptc-ccrabb commented 1 year ago

Feedback captured as ccrabbptc@gmail.com with title Failed to initialize WebView2 on HoloLens2 at version 22621.1083.arm64fre.ni_release_svc_sydney.230514-1300.

There wasn't a category of Updates but there was both Install and Update and Windows Setup and Update -- I've filed under Install and Update => Post-update app experience.

I don't see any unique identifier when viewing the feedback in Feedback hub, so don't know how to directly link you to it.

Next week I'll try flashing the device directly to the dev stream to see if that fixes the problem.

SamiraAtMicrosoft commented 1 year ago

Thank-you @ptc-ccrabb - we received your Feedback Hub bug report and are investigating the issue.

ptc-ccrabb commented 1 year ago

I was able to flash my device back to FE_RELEASE_SVC_SYDNEY_REL_PROD.retail.multi.10.0.20348.1543.ffu then enroll in the Dev channel of Windows Insider and the got the WinUI2 sample working on my HoloLens.

In my own project I've gotten the Unity WebView2 component working with basic click input.

I was unable to get the Microsoft-authored sample Unity WebView2 project working, I may take another pass at if after I get full input working in my project.

michaelfarnsworth commented 1 year ago

Glad to hear you were able to get the WinUI2 sample working.

I would be interested to learn some more details on the issues you had with the Unity-based sample.

ptc-ccrabb commented 1 year ago

The problems with the HoloLens2 sample were entirely my fault. I was using Unity 2021.3.22f1 since that's what I had already installed. The sample project was saved with Unity 2021.3.24f1. I figured the 2 point releases of the LTS stream of Unity wouldn't matter. They in fact do matter.

I was seeing Stack Overflow exceptions coming out of OpenXR when building with Unity 2021.3.22f1. I don't have any problems when using Unity 2021.3.24f1.

From my perspective this issue can be closed. I don't know why my HoloLens didn't upgrade to the Windows Insider Dev channel correctly the first time. Flashing it back and then re-enrolling it seems to have fixed the device problems.

One last question before closing though. Where is the right place to leave feedback for WebView2 Unity functionality? I spent a long time trying to get mouse wheel events to work to scroll the WebView in Unity and those events simply never work. I was able to get press/release working and have functional tapping, so I know the event channel and my conversion to WebView2 coordinates was working correctly.

michaelfarnsworth commented 1 year ago

Currently, this Github repo is the best place. Please, feel free to open an issue. Input is an area we're looking to improve.

Bobypaliya1 commented 1 year ago

Issue by #193

On Wed, 5 Jul 2023, 11:06 pm Nic Champagne Williamson [MSFT], < @.***> wrote:

Closed #193 https://github.com/MicrosoftEdge/WebView2Samples/issues/193 as completed.

— Reply to this email directly, view it on GitHub https://github.com/MicrosoftEdge/WebView2Samples/issues/193#event-9734549102, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2EWYVCODWEQD7HCL3SGRULXOWQZ5ANCNFSM6AAAAAAYMJVRDI . You are receiving this because you are subscribed to this thread.Message ID: @.*** .com>