MicrosoftEdge / MicrosoftEdge/WebView2Feedback

WebView2 freeze when activating WebRTC sharing notification

Open
#2,258 5 comments 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
Switching the active window between a WPF application and a WebRTC sharing notification will eventually freeze both the application and notification. The CPU usage was observed with the task manager and was caused mainly by the WebView2 (sub)process.

Version
SDK: Microsoft.Web.WebView2 1.0.1108.44 (nuget.org)
Runtime: Microsoft Edge WebView2-Runtime 95.0.1150.36
Framework: WPF, .NET Framework 4.5.2 (also 4.8)
OS: Win11 21H2 (Build 22000.556), Win10 20H2 (Build 19042.1526)

Repro Steps

  1. Compile and start the example application that is attached to the report
  2. Start to share the desktop / window
  3. Move notification near the title bar of the application
  4. Switch between application and notification until freeze
  5. Repeat step 4 until application freezes

Expected behavior would be no freeze. Once the application freezes neither it nor the notification can be used.

Following the above steps should reproduce the issue rather fast - sometimes only a singe click on the application window is required.

The notification is moved near the application's window title in order to reproduce the issue fast. Other alignments may work as well but weren't witnessed by me.

While the code provided uses WebRTC samples getDisplayMedia to reproduce the issue, a single line (see ExampleHTML) can be used to reproduce the issue as well. The line in question is <script>navigator.mediaDevices.getDisplayMedia()</script>. Note that the ExampleHTML closes the notification after a short period of time, making it hard to to reproduce the issue reliably.

The issue does not occur with the Edge Browser itself what leads me to think that it might have something to do with how WPF handles its window that might conflict with how the WebView2 handles its window.

Bringing another application / screen in front of the frozen application will immediately resolve the issue. That can be any window or even the Windows lock screen.

Additional context

https://user-images.githubusercontent.com/9939713/157857990-df9ec6ad-6b41-4948-8001-889a60f5e638.mp4

WebView2Freeze.zip
ExampleHTML.zip

AB#38525328

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 compiling the attached WebView2Freeze.zip example and reproducing the freeze with the listed WebRTC getDisplayMedia steps. Compare the behavior with the single getDisplayMedia line described for ExampleHTML.zip and inspect the WPF notification/window setup. Done means switching between the application and sharing notification no longer freezes either window.

Written by the indexing model from the issue text.

Assessment

Domain
audio-video-rtc, desktop
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.