MicrosoftEdge / WebView2Feedback

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

Intermittent crash when calling mouseEventsWebView.MouseEvent with WebViewMouseEventData.EventType.MouseWheel #3739

Closed RubenGarcia closed 1 year ago

RubenGarcia commented 1 year ago

Description

When calling the code to scroll webpages (see below), I am getting an intermittent crash of either the WebView or unity. This is also seen by other people, e.g. see https://github.com/MicrosoftEdge/WebView2Feedback/issues/3705

    private void Wheel(int x, int y)
    {
        var w = webViewComponent.GetWebView();
        IWithMouseEvents mouseEventsWebView = w as IWithMouseEvents;
        WebViewMouseEventData mouseEvent = new WebViewMouseEventData
        {
            WheelX = x,
            WheelY = y,
            WheelHint = WebViewMouseEventData.WheelBehaviorHint.RelativeAndButtonDown,
            Type = WebViewMouseEventData.EventType.MouseWheel,
            TertiaryAxisDeviceType = WebViewMouseEventData.TertiaryAxisDevice.PointingDevice
        };
        mouseEventsWebView.MouseEvent(mouseEvent);
    }

Version SDK: Webview2 0.17.1.pre3 and Webview2 0.17.1.pre5 Runtime: 115.0.1901.203 Framework: Unknown OS: Hololens Windows version 22621.1125.arm64fre.ni_release_svc_sydney_rel_prod.230802-0616

Regression Was this working before but has regressed? no

Repro Steps Create a Webview2, and call Wheel(0,-1) and Wheel (0,1) a few times (map it to a button or a keypress)

Expected: The webpage scrolls up and down, as appropriate Actual: The webpage may scroll, the webpage may disappear, or Unity may crash.

novac42 commented 1 year ago

Thanks for reporting the issue and sorry you are running into it. I've assigned this to a dev who can help follow up on this.

champnic commented 1 year ago

@RubenGarcia Is this different from #3705? I'm going to close this one and I've updated the title of #3705 and changed it to a bug. But let me know if you think this should be separate. Thanks!

RubenGarcia commented 1 year ago

It is the same bug. The old title of #3705 did not make it clear this was a bug, so I wanted to bring the issue to your attention for priorization. You can close this bug.