MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Problem/Bug]: WebView2 crashes entire application after opening modal window in event handler

Open
#4,734 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What happened?

Opening a MessageBox in WebView event handler causes the application to crash after 30 seconds.
I know that this is not recommended here: https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/threading-model#reentrancy and to use SynchronizationContext instead.
But crash is also not a correct behavior.

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime), Prerelease (Edge Canary/Dev/Beta)

Runtime Version

126.0.2592.113

SDK Version

1.0.2592.51

Framework

Winforms

Operating System

Windows 10

OS Version

19045.4651

Repro steps
  • Create WinForms project.

  • Add WebView2 from NuGet

  • Add WebView2 to form.

  • In constructor, set webview.Source to some URL.

  • Add event handler for NavigationCompleted event

  • In the event handler, run MessageBox.Show("")

  • After starting the application, wait 30 seconds.

  • Actual behavior: application crashes, without any exception thrown.

  • Expected behavior: application keeps working, waiting for the user to close the message box.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

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

Reproduce the issue in a WinForms project using WebView2 SDK 1.0.2592.51: set a source, handle NavigationCompleted, call MessageBox.Show, and wait 30 seconds. Compare the behavior with the expected result that the application remains usable until the message box is closed, using the listed runtime and Windows versions.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.