nunit-console icon indicating copy to clipboard operation
nunit-console copied to clipboard

v3.14 fails with target framework net461 ... net48 on linux (ArgumentException: The net-4.6.1 framework is not available.), but v3.12 works well

Open devizer opened this issue 3 years ago • 3 comments

Intro: We need nunit-console to test NET Standard Libraries on mono-only platforms such as armv6, Raspberry PI zero, etc. v3.12 did it well, but the latest v3.14 fails.

For v3.14 the output on a Linux for net4.6.1 test assembly is:

NUnit Console Runner 3.14.0 (.NET 2.0)
Copyright (c) 2021 Charlie Poole, Rob Prouse
Thursday, February 10, 2022 3:33:32 PM

Runtime Environment
   OS Version: Linux 4.4.153.0
   Runtime: .NET Framework CLR v4.0.30319.42000

Test Files
    Universe.CpuUsage.Tests.dll


Errors, Failures and Warnings

1) Error :
System.ArgumentException : The net-4.6.1 framework is not available.
Available frameworks: mono-4.0
--ArgumentException
The net-4.6.1 framework is not available.
Available frameworks: mono-4.0
  at NUnit.Engine.Services.TestAgency.GetAgent (NUnit.Engine.TestPackage package) [0x0008e] in <78bad2d45f9a4bfe96b1d2028544fabf>:0
  at NUnit.Engine.Runners.ProcessRunner.CreateAgentAndRunnerIfNeeded () [0x0003d] in <78bad2d45f9a4bfe96b1d2028544fabf>:0
  at NUnit.Engine.Runners.ProcessRunner.RunTests (NUnit.Engine.ITestEventListener listener, NUnit.Engine.TestFilter filter) [0x0001f] in <78bad2d45f9a4bfe96b1d2028544fabf>:0

Test Run Summary
  Overall result: Failed
  Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
  Start time: 2022-02-10 15:33:33Z
    End time: 2022-02-10 15:33:33Z
    Duration: 0.034 seconds

Results (nunit3) saved as TestResult.xml

v3.12 works well. How to reproduce:

NETFW=net461
work=$HOME/transient-builds/src
mkdir -p $work && cd $work
echo "git clone|pull"
test ! -d Universe.CpuUsage && git clone https://github.com/devizer/Universe.CpuUsage || true
cd Universe.CpuUsage
git reset --hard; git pull
echo "Reset target framework to [$NETFW]"
Reset-Target-Framework --framework $NETFW --language latest
echo "Restore Dependencies"
cd Universe.CpuUsage.Tests
msbuild /t:Restore -v:m
echo "Build Release for Universe.CpuUsage.Tests"
msbuild /t:Build /p:Configuration=Release -v:m
cd bin/Release/$NETFW
echo "Run Integration Tests"
nunit3-console --workers=1 Universe.CpuUsage.Tests.dll
echo "Successfully completed"

nunit3-console is a shell-link: mono /...path...to...nuget..package/packages/NUnit.ConsoleRunner/tools/nunit3-console.exe "$@" mono and msbuild: the latest from official Xamarin repo, 6.12.0.122 OS Ubuntu 18.04 LTS (actually Linux version doesn't matter)

Below just references how to simplify reproduction step Reset-Target-Framework scripts above resets Targetframwork[s] to specific version for csproj-files. here is it: https://github.com/devizer/test-and-build/blob/master/lab/permanent-scripts/Reset-Target-Framework.sh

v3.12 can be installed via snapshot.gz using shared script: https://github.com/devizer/glist/blob/master/bin/net-test-runners.sh

The latest version of nunit-console can be installed via nuget using another shared script https://github.com/devizer/test-and-build/blob/master/lab/NET-TEST-RUNNERS-build.sh As of now, it installs v3.14

devizer avatar Feb 10 '22 15:02 devizer

3.14 fails and even 3.15 version of NUnit.ConsoleRunner is throwing the same error

System.ArgumentException : The net-4.5.2 framework is not available. Available frameworks: mono-4.0 --ArgumentException The net-4.5.2 framework is not available. Available frameworks: mono-4.0 at NUnit.Engine.Services.TestAgency.GetAgent (NUnit.Engine.TestPackage package) [0x0008e] in <83a050af71a545d186bc8c62a15c3005>:0 at NUnit.Engine.Runners.ProcessRunner.CreateAgentAndRunnerIfNeeded () [0x0003d] in <83a050af71a545d186bc8c62a15c3005>:0 at NUnit.Engine.Runners.ProcessRunner.RunTests (NUnit.Engine.ITestEventListener listener, NUnit.Engine.TestFilter filter) [0x0001f] in <83a050af71a545d186bc8c62a15c3005>:0

Azure DevOps pipeline failing after updating NUnit.ConsoleRunner nuget package to to 3.15 version. Command use to run the nunit test:

exec /Library/Frameworks/Mono.framework/Versions/Current/bin/mono --debug /Users/name/Documents/MyProject/packages/NUnit.ConsoleRunner.3.15.0/tools/nunit3-console.exe /Users/name/Documents/MyProject/TestProject.NUnitTest/bin/Release/TestProject.NUnitTest.dll

Provided more details here Latest Nunit consoleRunner failing

suchithm avatar Feb 18 '22 11:02 suchithm

Yes, same issue here with 3.15

sateeshkumardamera avatar May 02 '22 18:05 sateeshkumardamera

Removed from milestone so we can get the critical bug fixed.

CharliePoole avatar Jun 29 '22 18:06 CharliePoole

This issue has been resolved in version 3.16.0

The release is available on: GitHub. NuGet packages are also available NuGet.org and Chocolatey Packages may be found at Chocolatey.org

CharliePoole avatar Nov 15 '22 09:11 CharliePoole