-
Notifications
You must be signed in to change notification settings - Fork 152
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
Cannot execute .NET 8 tests that require the Desktop or ASP.NET runtime #1383
Comments
The error occurs when the Here is a repro |
@OsirisTerje Any news on this? |
@ilCosmico No, we don't have anyone working here at the moment. |
@mlessmann Although some other people have referenced this with respect to the NETCORE console runner, it's not clear from your report that you are using it, as opposed to the standard console runner. Can you clarify what package you have installed? It would also help to see the command line you are using to run your tests. |
Can this be closed as a duplicate of #1203? (Though the fix still isn't generally available, only on the 3.18 dev build or 4.0) |
@andrewimcclement The 3.18.1 is out. Have you checked it works with that? |
I examined this and didn't close it with 3.18.1 because we are still waiting for info. I wouldn't want to close it since some people may be running the standard console and others the .NET Core console, which are essentially two different programs due to our use of conditional compilation. I'll look at this when I come back to work in a few weeks. |
I tried the sample project NUnitTestProject1.zip and it works with version 3.18.1 🥳 |
I'll add a version of NUnitTestProject1.zip to the package tests when I'm back to work. |
I have also tested the project with 3.18.1, it works when targeting WindowsForms. However, if I switch the project to WPF, it still does not run the test. I think it loads Windows.Base from the .Net Framework instead of the .Net 8 WindowsDesktopApp runtime. |
Can someone experiencing this error try the latest build on our MyGet feed? That one is running .NET 8.0 WPF apps for me and finding the correct WindowsBase. The latest version on myget is 2.0.0-dev00027. |
I'm sorry, still the same error with the WPF test project. Identical screenshot except for the NUnit Console version. I have tested version 3.18.2-dev00027, I assume you mean this one. Is there anything else that needs to be changed in the project? |
@dipts Thanks for checking. Yes, that's the version. I'm jumping back and forth between two projects and mixed up the versions. So, this bug remains on the list. It's a matter of not taking the first WindowsBase assembly found but continuing to examine others and taking the best version. |
This issue has been resolved in version 3.18.2 The release is available on: |
@CharliePoole Thanks for the fix, it solves the error message that WindowsBase is not found. Unfortunately, the WPF tests do not run again, but get stuck on another module that cannot be loaded, this time wpfgfx_cor3.dll. I know that there are already a few old issues about this - but I cannot derive any solution from them. I assume that the difference lies in the fact that wpfgfx_cor3.dll is a native DLL - and therefore does not run via the AssemblyResolver. However, testing WPF projects is not yet possible again with 3.18.2. I have extended the WPF repro project: NUnitTestProjectWPF2.zip |
Executing a .NET 8 test assembly that references types from WinForms, WPF, or ASP.NET results in the following (or similar) exception:
Could not load file or assembly 'System.Windows.Forms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e89'. The system cannot find the file specified.
The reason is that the nunit-agent only references the Microsoft.NETCore.App runtime in its runtimeconfig.json. Therefore a workaround is to manually add the missing runtimes (Microsoft.WindowsDesktop.App and/or Microsoft.AspNetCore.App) to the runtimeconfig.json.
As far as I know adding the WindowsDesktop runtime will lead to the agent no longer working on Linux. Ideally we could load the necessary runtimes dynamically depending on what dependencies the test assembly has, though I have no idea if that is even possible. The Microsoft documentation does not sound promising.
The text was updated successfully, but these errors were encountered: