MicrosoftEdge / MicrosoftEdge/WebView2Feedback

WebView2 DevToolsProtocolEventReceiver crashes

Open
#2,017 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

webView.CoreWebView2.GetDevToolsProtocolEventReceiver("Overlay.nodeHighlightRequested").DevToolsProtocolEventReceived += OnOverlayNodeHighlightRequested;
webView.CoreWebView2.GetDevToolsProtocolEventReceiver("Overlay.inspectNodeRequested").DevToolsProtocolEventReceived += OnInspectNodeRequested;
                
await webView.CoreWebView2.CallDevToolsProtocolMethodAsync("DOM.enable", "{}");                
await webView.CoreWebView2.CallDevToolsProtocolMethodAsync("Overlay.enable", "{}");         
await webView.CoreWebView2.CallDevToolsProtocolMethodAsync("Overlay.setInspectMode", "{\"mode\":\"searchForNode\",\"highlightConfig\":{\"showInfo\":true,\"contentColor\":{\"r\": 155, \"g\": 11, \"b\": 239, \"a\": 0.7}}}");

receiving the inpectNodeRequested stops working after some time or it will crash.

Exception thrown at 0x00007FF8C32FF3F0 (Microsoft.Web.WebView2.Core.dll) in WinUI3.exe: 0xC0000005: Access violation writing location 0x00000001000002C7.

00007FF8C32FF3B6  call        qword ptr [rax+8]  
00007FF8C32FF3B9  nop  
00007FF8C32FF3BA  lea         rax,[winrt::impl::heap_implements<winrt::Microsoft::Web::WebView2::Core::implementation::CoreWebView2DevToolsProtocolEventReceivedEventArgs>::`vftable' (07FF8C3343028h)]  
00007FF8C32FF3C1  mov         qword ptr [rbx],rax  
00007FF8C32FF3C4  mov         qword ptr [rsp+28h],rdi  
00007FF8C32FF3C9  mov         rsi,qword ptr [r15]  
00007FF8C32FF3CC  mov         qword ptr [rsp+20h],r14  
00007FF8C32FF3D1  lea         rcx,[rsi+28h]  
00007FF8C32FF3D5  call        AcquireSRWLockExclusive (07FF8C3333897h)  
00007FF8C32FF3DA  mov         rdi,qword ptr [rsi+20h]  
00007FF8C32FF3DE  lea         rcx,[rsi+28h]  
00007FF8C32FF3E2  test        rdi,rdi  
00007FF8C32FF3E5  je          <lambda_1614a4de527adbc7ae79ce87febc4e38>::operator()+19Dh (07FF8C32FF49Dh)  
00007FF8C32FF3EB  mov         qword ptr [rsp+20h],rdi  
00007FF8C32FF3F0  lock xadd   dword ptr [rdi],ebp  
00007FF8C32FF3F4  call        ReleaseSRWLockExclusive (07FF8C3333891h)

Version
SDK: 1.0.0
Runtime: WinRT.Runtime 1.3.0.0, Microsoft.Windows.SDK.NET 10.0.19041.21
Framework: WindowsAppSDK
OS: Win11

Repro Steps

  1. Sample VS2022 project in https://github.com/minesworld/WebView2Tests

  2. Crash reports (copy & paste) in folder crashes

  3. Build & Start WinUI3 project

  4. Select some options:
    4.1. "Async": second async call to intialize the WebView2
    4.2. "DT-Overlay": enable Developer Tools Overlay mode
    4.3. "DT-Event": receive Overlay events
    4.4. "WebMessage": run a JavaScript interval function and receive them
    4.5 "Navigation": receive NagivationComplete events

  5. Press "Start" Button

  6. watch Debug/Diagnostic output

  7. if DT-Overlay & DT-Event checked and clicking does not bring up a new output line, click "No DT-Event" button to have this logged

  8. do some clicks, wait, use another app, etc. . Crashes come unexpected, but it seems to depend on the website (my "favorite" for crashing: https://www.bundestag.de/abgeordnete/biografien )

Besides the crash:

  • nodeHighlightRequested are not received at all
  • inspectNodeRequested only received on clicks

Expeced Behaviour

  • should work as WPF project which doesn't seem to crash.
  • either nodeHighlightRequested or inspectNodeRequested should be fired on node changes (by mouse over)

Additional context
filed also as https://github.com/microsoft/WindowsAppSDK/issues/1911

AB#37414485

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.

Research direction

Start with the WebView2Tests WinUI3 sample and reproduce the crash using GetDevToolsProtocolEventReceiver, CallDevToolsProtocolMethodAsync, and the listed Overlay options. Compare the WinUI3 behavior with the WPF project; done means the DevTools Protocol events work reliably without the access violation and the expected node events are received.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.