-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wpf application crashes immediately (System.Windows.Threading.DispatcherObject, WindowsBase) #5873
Comments
@consysPM Do you use any assembly that reference dotnet framework? The |
@consysPM Can you please attach a sample project? |
i have attached the solution -> WpfApp2.zip to reproduce the behavior open the terminal and execute: the created WindowsBase.dll file will only have 15kb and the executable will crash immediately thanks |
i have found a workaround for everyone who is interested: every net core 3.1 project must use the flag UseWPF: true within the propertygroup of the csproj file. this will "fix" the issue. however this should not be the final solution. |
@consysPM I tried the application that you have shared. Not able to reproduce the issue. What is the output of |
u will find the json files above. -> json.zip dotnet --list-runtimes: Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] dotnet --list-sdks 2.1.818 [C:\Program Files\dotnet\sdk] |
here is a video proof that the app is crashing :) wpf.mp4 |
Need that information just to be able to understand the build environment. Thank you for video, appreciate your efforts to explain the problem. |
One more question, what happens, if you have NET 6.0 or NET 7.0 installed on the machine. I am not able to reproduce the problem at all, but, I have these two installed. I am using the sample application provided in the original bug. |
i dont have net 6.0 or 7.0 installed (are this versions only available for visual studio 2022? i have vs 2019 community installed) |
You can download the installers from here |
the installer will not work (according to microsoft) for visual studio 2019 |
Yes, .NET 6.0 and up, will need to try with VS2022. May be trying on a separate VM will help? |
i have tried it with .NET 5 and it works. (i have changed every referenced project to .NET 5) can u try to set up a VM with only .net core 3.1 and VS2019 installed? :) thanks |
The issue is reproducible, as soon as, I upgraded the VS2019. The observations were similar, as we had in the issue #5711 Will this thread updated. |
If I'm not mistaken the cause of the issue comes from mixing two different You can easily check this if you compare the content of the related NuGet-Packages that are used when publishing an application. The default location for runtime DLLs for .NET Core apps is: And the default location for runtime DLLs for .NET Desktop apps is: You'll see that there are a hand full of DLLs with identical name and base version but different in e.g. size. For example for win-x64 in .NET 6.0.1 the That is probably the reason why the "wrong" |
@consysPM - Does the above suggestion work for you?. If yes, could you please close this issue. |
yes, but this is not a solution, but a workaround |
@consysPM - Does it reproduce for .NET 6 as well ? |
Its only .NET 3.1. However we can not switch to VS 2022 until end of the year. |
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:
NOTE
With NET Core Version 3.0.100 everything is working as expected.
WpfApp2.zip
JSON ZIP:
json.zip
The text was updated successfully, but these errors were encountered: