dotnet / dotnet/wpf

WPF Rendering issue on any machine

Open
#4,276 16 comments 2 reactions 0 assignees View on GitHub
.NET Framework Bug
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

* .NET Version: 5
* Windows version: Windows 10 20H2 (OS Build 19042.867)
* Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes, also .NET Framework 4.5.2, and all .NET Core versions.



**Problem description:**
WPF windows stop rendering at all when use BitmapCache on any window's control or root control and first shown WPF window was hidden by set Visibility to Hidden or call Hide() method.

**Actual behavior:**
There's no exceptions or fatal crashes. All WPF windows that use BitmapCache just stop rendering at all! While FIRST hidden window will not be shown.

**Expected behavior:**
WPF Windows should render normally.

**Minimal repro:**
Please follow this steps to catch problem on your machine or build any project below. Please, help me resolve it.

https://github.com/Erapchu/GhostWindows
https://github.com/Erapchu/GhostWindowsCore

1. Create empty WPF project.
2. Use property CacheMode="BitmapCache" in MainWindow's Grid;
3. Show MainWindow on start application, then hide it. Show new MainWindow. You can use a code below. Additionally remove StartupUri in App.xaml
4. Press Ctrl + Alt + Del or Win + L and try to interact with showed window (resize, minimize) it should be broken now.

In App.xaml.cs OnStartup overrided method:
`var window1 = new MainWindow();
window1.Show();
await Task.Delay(1000);
window1.Hide();
var window2 = new MainWindow();
window2.Show();`

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.