NUnit.Engine.NUnitEngineException when spaces in agent file path
See original GitHub issueI 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.
Issue Analytics
- State:
- Created a year ago
- Comments:9 (7 by maintainers)
Top Related StackOverflow Question
@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