Skip to content
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

NUnit.Engine.NUnitEngineException when spaces in agent file path #1206

Closed
cw397 opened this issue Aug 8, 2022 · 9 comments · Fixed by #1209
Closed

NUnit.Engine.NUnitEngineException when spaces in agent file path #1206

cw397 opened this issue Aug 8, 2022 · 9 comments · Fixed by #1209
Assignees
Milestone

Comments

@cw397
Copy link

cw397 commented Aug 8, 2022

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.

@CharliePoole
Copy link
Member

Good catch! Also needs to be fixed for the 4.0 development build.

@CharliePoole
Copy link
Member

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.

@CharliePoole
Copy link
Member

@cw397 Can you test the dev release and let me know if you see any problems?

@cw397
Copy link
Author

cw397 commented Aug 11, 2022

@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.

@CharliePoole
Copy link
Member

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

@CharliePoole
Copy link
Member

Packages are back on MyGet and will hopefully stay there!

@CharliePoole
Copy link
Member

Merged into both the version3 and main branches.

@cw397
Copy link
Author

cw397 commented Aug 17, 2022

@CharliePoole sorry for taking so long, but I can confirm that 3.15.3-dev00002 does indeed fix the issue we were seeing.

@CharliePoole CharliePoole modified the milestones: 3.15.3, 3.16 Sep 23, 2022
@CharliePoole CharliePoole self-assigned this Sep 24, 2022
@CharliePoole
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants