nunit-console
nunit-console copied to clipboard
NUnit.Engine.NUnitEngineException when spaces in agent file path
I ran this (sanitised) command using the console runner (version 3.15.2, installed via the NUnit.ConsoleRunner NuGet package):
"T:\NUnit Console\tools\nunit3-console.exe" "Build Folder\MyTests.dll"
It failed with the following exception:
Unhandled Exception: NUnit.Engine.NUnitEngineException: Remote test agent exited with non-zero exit code -2147450735
at NUnit.Engine.Services.TestAgency.OnAgentExit(Process process, Guid agentId)
at NUnit.Engine.Services.TestAgency.<>c__DisplayClass13_0.<GetAgent>b__0(Object sender, EventArgs e)
at System.Diagnostics.Process.OnExited()
at System.Diagnostics.Process.RaiseOnExited()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback(Object state, Boolean timedOut)
Errors, Failures and Warnings
1) Error :
NUnit.Engine.NUnitEngineException : Unable to acquire remote process agent
--NUnitEngineException
Unable to acquire remote process agent
at NUnit.Engine.Runners.ProcessRunner.CreateAgentAndRunnerIfNeeded()
at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)
I enabled debug logging and found the following line:
22:31:32.929 Debug [ 1] TestAgency: Command line: "C:\Program Files (x86)\dotnet\dotnet.exe" T:\NUnit Console\tools\agents\net6.0\nunit-agent.dll 9c396990-3a76-47bf-a018-a480508cf7de 127.0.0.1:50621 --pid=9968 --trace=Verbose --work="E:\My Folder"
The non-quoted file path to nunit-agent.dll was suspicious! When I changed the NUnit console package file path to just T:\NUnitConsole (i.e. without the space) everything worked fine.
The rename will work fine for us for now, but I feel like this is a bug that should be fixed? Having found the line of code in AgentProcess.cs it is definitely expected to be a full file path that is passed to dotnet.exe, and therefore it should be quoted? I think it should be reproducible for any .NET 6 test assembly simply by running the NUnit Console package from a path with spaces in.
Good catch! Also needs to be fixed for the 4.0 development build.
This fix is now available from our MyGet feed as version 3.15.3-dev00002 and will eventually be incorporated in the 3.15.3 release. I'm holding this issue open until I port the fix to the 4.0 build as well.
@cw397 Can you test the dev release and let me know if you see any problems?
@CharliePoole Maybe I'm doing something wrong, but I can't seem to see or install the 3.15.3-dev versions on MyGet? I can only see 4.0.0-dev versions.
Oh!!! What happened is (1) my script added the packages using that version number and (2) they were immediately deleted following the retention rules... there were already 20 packages in the 4.0.0-dev series.
I changed the rules so it will keep the last 20 uploaded rather than using version number and I'll push again. Meanwhile, you can use the same artifacts from AppVeyor: https://ci.appveyor.com/project/CharliePoole/nunit-console/build/artifacts
Packages are back on MyGet and will hopefully stay there!
Merged into both the version3
and main
branches.
@CharliePoole sorry for taking so long, but I can confirm that 3.15.3-dev00002 does indeed fix the issue we were seeing.
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