You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have encountered the following problem while working with the NUnit3TestAdapter in a .NET 8 desktop application.
Issue Summary
The NUnit Adapter fails to load test DLLs when the Windows version specified in the Target Framework Moniker (TFM) is higher than the host operating system version. This prevents test discovery and execution on older Windows environments.
Environment
.NET 8 desktop application using WinRT APIs
Target OS in TFM: Windows 10 version 1903 (10.0.18362)
NUnit 4.3.2
NUnit.Console 3.19.2
NUnit3TestAdapter 5.0.0
NunitXml.TestLogger 6.0.0
Microsoft.NET.Test.Sdk 17.13.0
Host OS: Windows Server 2019 (10.0.17763)
Steps to Reproduce
Create a .NET 8 desktop application project targeting a specific Windows version: <TargetFramework>net8.0-windows10.0.18362.0</TargetFramework>
Create an NUnit test project with the same TFM.
Run the unit tests using dotnet test on a Windows OS environment with version lower than specified in the TFM. (e.g., Windows Server 2019 - 10.0.17763)
Expected Behavior
The test project DLL file is loaded and unit tests are discovered and executed normally.
Actual Behavior
The test project DLL fails to load, and consequently, the unit tests are not discovered.
Output logs: NUnit Adapter 5.0.0.0: Test execution started Running all tests in C:\path\to\Common.Test.dll NUnit failed to load C:\path\to\Common.Test.dll NUnit Adapter 5.0.0.0: Test execution complete No test is available in C:\path\to\Common.Test.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
Workarounds
I identified the following workarounds/solutions:
Remove the specific Windows OS version from the TFM: <TargetFramework>net8.0-windows</TargetFramework>
Change the TFM to match the build environment OS version: <TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
Use xUnit instead of NUnit. The same project configuration with xUnit successfully loads the test DLL and executes tests with the same higher Windows version TFM.
Additional Context
The Common.Test.dll.deps.json file contains the same runtime pack references when using either NUnit or xUnit. Below is an example when targeting net8.0-windows10.0.18362.0: "runtimepack.Microsoft.Windows.SDK.NET.Ref/10.0.18362.57": { "runtime": { "Microsoft.Windows.SDK.NET.dll": { "assemblyVersion": "10.0.18362.38", "fileVersion": "10.0.18362.55" }, "WinRT.Runtime.dll": { "assemblyVersion": "2.2.0.0", "fileVersion": "2.2.0.48161" } } }
Thank you for your attention to this issue. If anyone has encountered this problem before or has additional suggestions for workarounds, I'd appreciate your insights. I'm available to provide any further information that might help in resolving this compatibility issue.
The text was updated successfully, but these errors were encountered:
Hi,
I have encountered the following problem while working with the NUnit3TestAdapter in a .NET 8 desktop application.
Issue Summary
The NUnit Adapter fails to load test DLLs when the Windows version specified in the Target Framework Moniker (TFM) is higher than the host operating system version. This prevents test discovery and execution on older Windows environments.
Environment
Steps to Reproduce
<TargetFramework>net8.0-windows10.0.18362.0</TargetFramework>
dotnet test
on a Windows OS environment with version lower than specified in the TFM. (e.g., Windows Server 2019 - 10.0.17763)Expected Behavior
Actual Behavior
Output logs:
NUnit Adapter 5.0.0.0: Test execution started Running all tests in C:\path\to\Common.Test.dll NUnit failed to load C:\path\to\Common.Test.dll NUnit Adapter 5.0.0.0: Test execution complete No test is available in C:\path\to\Common.Test.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
Workarounds
I identified the following workarounds/solutions:
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
Additional Context
The Common.Test.dll.deps.json file contains the same runtime pack references when using either NUnit or xUnit. Below is an example when targeting net8.0-windows10.0.18362.0:
"runtimepack.Microsoft.Windows.SDK.NET.Ref/10.0.18362.57": { "runtime": { "Microsoft.Windows.SDK.NET.dll": { "assemblyVersion": "10.0.18362.38", "fileVersion": "10.0.18362.55" }, "WinRT.Runtime.dll": { "assemblyVersion": "2.2.0.0", "fileVersion": "2.2.0.48161" } } }
Thank you for your attention to this issue. If anyone has encountered this problem before or has additional suggestions for workarounds, I'd appreciate your insights. I'm available to provide any further information that might help in resolving this compatibility issue.
The text was updated successfully, but these errors were encountered: