MicrosoftEdge / MicrosoftEdge/WebView2Feedback
[Problem/Bug]: Browser process crashes in context menu with custom menu items
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
What happened?
- An item with an icon is added to the browser context menu when the context menu is triggered for the first time.
- A different item with an icon is added to the browser context menu when the context menu is triggered for the second time.
- Context menu is triggered for a misspelled word.
- Several blank items are displayed instead of the spelling suggestions.
- When the last blank item is clicked, the browser process crashes.
The crash does not occur and no blank spelling suggestions are displayed if no icons are supplied for the custom menu items.
Failed workarounds
- Crash occurs with icons loaded from assembly resources or files.
- Crash occurs with icons copied to a dedicated per-item MemoryStream.
See https://github.com/seldoff/WebView2Samples/tree/menu-crash/SampleApps/WebView2WpfBrowser project for a repro code. The code that adds offending menu items is in the MainWindow.WebView_ContextMenuRequested method.
Importance
Important. My app's user experience is significantly compromised.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
125.0.2535.85
SDK Version
1.0.2535.41
Framework
WPF
Operating System
Windows 10, Windows 11
OS Version
22631.3593
Repro steps
Use the WebView2WpfBrowser sample project from https://github.com/seldoff/WebView2Samples/blob/menu-crash/SampleApps/WebView2WpfBrowser.
- Start the app, it navigates to https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_textarea.
- Replace text in the text box in the right panel with a misspelled word: "tesst".

- Right-click on the misspelled word. The context menu with a spelling suggestion is displayed.

- Right-click on the misspelled word again. The context menu with three empty suggestions is displayed.
5. Click on the third empty suggestion. The browser process crashes.
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
Don't know
Last working version (if regression)
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SampleApps/WebView2WpfBrowser project and MainWindow.xaml.cs, especially MainWindow.WebView_ContextMenuRequested. Reproduce the two context-menu openings on the misspelled word with icon-bearing custom items. Done means the second menu has no blank spelling suggestions and clicking its items does not crash the browser process.
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
- 25/100