Application hangs on shutdown if a Window was created but never used
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
* .NET Core Version: .net 5.0.3
* Windows version: 20H2 19042
* Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
**Problem description:**
If you declare a new Window but never use it, the app will hang on shutdown.
**Actual behavior:**
**Expected behavior:**
Application cleanly shuts down.
**Minimal repro:**
1. Create a new blank WPF Application
2. Above the MainWindow constructor, add the following line of code:
`Window window2 = new Window();`
3. Run the application, and shut it down by clicking the "X" button
4. Notice that Visual Studio is still attached to the process and the process is still running (without VS, see in Task Explorer that the process is still running)
5. If `window2` had been opened at some point, the app will cleanly shut down.
List of threads:

Contributor guide
Assessment
This issue has not been assessed yet.