dotnet / dotnet/wpf

Resizing WPF Window causes Blazor WebView2CompositionControl content to flicker and disappear

Open
#11,291 3 comments 4 reactions 0 assignees View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

I have raised this issue with the MAUI team since it is listed as the owning repository of the `Microsoft.AspNetCore.Components.WebView.Wpf` dependency, but [they think it is more of a WPF issue](https://github.com/dotnet/maui/issues/32812#issuecomment-3569523717)

With `Microsoft.AspNetCore.Components.WebView.Wpf` version `10.0.10` and `10.0.11`, 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.

https://github.com/user-attachments/assets/9af5cd2b-af1d-4eeb-bc44-fcdf0434b305

https://github.com/user-attachments/assets/9d58cbb6-a9c2-42b1-b28e-48262d92b82c

Using plain non-Blazor Webview, in the form of WebView2CompositionControl, does not exhibit this behavior.

```xml


WinExe
net10.0-windows10.0.19041.0
enable
enable
true
WebViewBug




```
```xaml



```

https://github.com/user-attachments/assets/47bebc49-7971-4516-9f7a-f3523d7cbc96

### Reproduction Steps

Reproducible with out of the box Blazor Hybrid WPF app.

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

```xaml







```

### Expected behavior

No flickering as it was before the switch to `WebView2CompositionControl` in .NET 10

### Actual behavior

Flickering, rendering blank intermittently

### Regression?

Yes. Worked with package `Microsoft.AspNetCore.Components.WebView.Wpf` version 9.0.120

### Known Workarounds

Downgrade to 9.0.120

### Impact

Unusable with newest versions.

### Configuration

- .NET 10
- Windows 11
- x64

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.