MicrosoftEdge / MicrosoftEdge/WebView2Feedback

WebView2 crashes if calling .ShowDialog() after receiving a WebMessage

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

Nobody has claimed this yet.

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

Description

I have an application that needs WebView2 to send back WebMessages when pressing buttons.
Processing the WebMessageReceived Event, i have to display a Form as a Dialog ("FormX.ShowDialog();").

After few seconds the FormDialog is shown (around 10), the entire application crashes firing no exception/errors.

I took a look at the Windows Event Viewer, and i got an error:

Module name that generated the error : EmbeddedBrowserWebView.dll, version: 106.0.1370.52, timestamp: 0x6350af70
Exception code: 0x80000003
Offset error: 0x00000000002dcced
Module path that generated the error : “C:\Program Files (x86)\Microsoft\EdgeWebView\Application\106.0.1370.52\EBWebView\x64\EmbeddedBrowserWebView.dll”

I found a solution that consist in assigning the process of the WebMessage to a separate Thread, in order to release the WebMessageReceived Event's resources.

Anyway i assume it's an issue/bug that needs to be fixed: at least WebView2 should throw an Exception or something, so developers can understand what's wrong with the code.

I use Microsoft Visual Studio 2022 version 17.3.6 on Windows 11 Pro, and obviously the latest version of WebView2 (NuGet Package downloadable from VisualStudio).

I made a .sln just to try it, and i will attach the entire folder (.zip) here.

I apologize for the bad English, i'm from Italy.

SampleWebView2ShowDialog.zip

AB#42273741

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 by opening and running the attached SampleWebView2ShowDialog.zip project with the reported WebView2 version. Trace the WebMessageReceived handler and the FormX.ShowDialog() call, then compare behavior when the dialog is shown after receiving a web message. Done means the sample no longer crashes silently, or the failure is reported with a usable exception or error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.