dotnet / dotnet/maui

Resizing WPF Window causes WebView2CompositionControl content to flicker and disappear

Open
#32,812 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-blazor blazor-webview2-regression feature-blazor-windesktop s/needs-attention t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 14h
Merged PRs (30d)
296

Description

Description

Reproducible with out of the box Blazor Hybrid WPF app (haven't tested same scenario in MAUI).

https://learn.microsoft.com/en-us/aspnet/core/blazor/hybrid/tutorials/wpf

With Microsoft.AspNetCore.Components.WebView.Wpf version 10.0.10, resizing the window produces tons of flickering of the webview content alternating between rendered and a blank content area, or even completely rendering blank until resizing is stopped.

This can result in, when the resizing is stopped, the entire content of the webview being blank if user just happens to stop resizing at the right time. Even if the content is there when resizing is stopped, the overall experience looks terrible.

Version 9.0.120 does not have this problem. Something is wrong with the WebView2CompositionControl in the new version.

https://github.com/user-attachments/assets/42baa32b-e9a9-4486-a839-dc25258dd177

https://github.com/user-attachments/assets/d5fcb329-e926-4f24-8b9c-b4a26ee58c23

Steps to Reproduce
  1. Create, or have a current, Blazor Hybrid WPF application.

  2. Use Microsoft.AspNetCore.Components.WebView.Wpf version 10.0.10

  3. Run app, resize window, observe constant flickering and blank content in the webview.

Link to public reproduction project repository

No response

Version with bug

10.0.10

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

9.0.120 SR12

Affected platforms

Windows

Affected platform versions

net10.0-windows10.0.17763.0

Did you find any workaround?

Downgrade to 9.0.120

Relevant log output

Contributor guide

Open the contributing guide

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 out-of-the-box Blazor Hybrid WPF reproduction described in the issue, using Microsoft.AspNetCore.Components.WebView.Wpf 10.0.10, and inspect WebView2CompositionControl while resizing on Windows. Compare its behavior with version 9.0.120; done means resizing no longer causes flickering, blank content, or content disappearing after the resize stops.

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.