MicrosoftEdge / MicrosoftEdge/WebView2Feedback

Crash when using SetVirtualHostMapping

Open
#3,652 10 comments 0 reactions 2 assignees View on GitHub

@LiangTheDev is already working on this.

Since Jul 20, 2023.

bug tracked
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Description

Crash when using SetVirtualHostMapping

Version
SDK: com.microsoft.mixedreality.webview.unity-0.17.1-pre.3.tgz
Runtime: Unity2020.3.33
Framework: Unity2020.3.33, MRTK2.8.3
OS: (Unity Editor) Windows 10 22H2, (Hololens2) 22621.1120.arm64fre.ni_release_svc_sydney_rel_prod.230707-1012

Regression
Was this working before but has regressed? > No.
If yes, what version did this last work on?

Repro Steps

  1. Clone this repository.
    https://github.com/MicrosoftEdge/WebView2Samples/
  2. Resolve compilation errors
    • Do "Restore Features" in Mixed Reality Feature Tool.
    • remove this line from package.json
      "com.unity.collab-proxy": "2.0.3",
      
  3. Open this sample in UnityEditor.
    https://github.com/MicrosoftEdge/WebView2Samples/tree/main/GettingStartedGuides/HoloLens2_GettingStarted/HoloLens2GetStartedApp
  4. Attach this script to "WebView"
using Microsoft.MixedReality.WebView;
using System;
using UnityEngine;

public class WebViewExample : MonoBehaviour
{
    private void Start()
    {
        var webViewComponent = gameObject.GetComponent<WebView>();

        webViewComponent.GetWebViewWhenReady((IWebView webView) =>
        {
            ((IWithVirtualHost)webView).SetVirtualHostMapping("webview2.sample", "Assets\\Html");

            // Navigate to our local content.
            // webViewComponent.Load(new Uri("http://webview2.sample/demo.html")); // comment out!!
        });
    }
}

source: https://learn.microsoft.com/en-us/microsoft-edge/webview2/get-started/hololens2#setvirtualhostnametofoldermapping-and-setvirtualhostmapping

  1. And create a "{ProjectFolder}/Assets/Html/demo.html". (I don't think it matters)

  2. When I run it, it crashes. (Both Editor and Hololens.)

Screenshots

Additional context

AB#45688087

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.