wpf application crashes immediately (System.Windows.Threading.DispatcherObject, WindowsBase)
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
* .NET Core Version: 3.1.416
* Windows version: Version 20H2 (OS Build 19042.1415)
* Does the bug reproduce also in WPF for .NET Framework 4.8?: n/a
**Problem description:**
when publishing the project the wrong WindowsBase.dll gets copied.
**Actual behavior:**
Application: sds.master.exe
CoreCLR Version: 4.700.21.56803
.NET Core Version: 3.1.22
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeLoadException: Could not load type 'System.Windows.Threading.DispatcherObject' from assembly 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
**Expected behavior:**
The wpf application should not crash.
**Minimal repro:**
1. create new solution
2. add wpf project
3. add asp.net core project or class library
4. publish project: dotnet publish -o --self-contained true -r win10-x64 --force
5. start the wpf application -> crash

**NOTE**
With NET Core Version 3.0.100 everything is working as expected.
[WpfApp2.zip](https://github.com/dotnet/wpf/files/7781027/WpfApp2.zip)
JSON ZIP:
[json.zip](https://github.com/dotnet/wpf/files/7814305/json.zip)
Contributor guide
Assessment
This issue has not been assessed yet.