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

3.15.0 - MSI package is unable to acquire remote process agent #1185

Closed
jamesjohnmcguire opened this issue May 29, 2022 · 12 comments
Closed
Assignees
Milestone

Comments

@jamesjohnmcguire
Copy link

  1. I have installed NUnit console 3.15.0 through the MSI installer from the releases assets on GitHub.
  2. I then created a fresh NUnit project (non-framework) through visual studio, with
    <TargetFramework>netcoreapp3.1</TargetFramework>After creation, I didn't change anything. A copy of project is available on GitHub: https://github.com/jamesjohnmcguire/nunit-console-test
  3. Attempting to run the project from the Windows command line, with the following:
    >nunit3-console TestProject2.dll
  4. Results with the output of:
NUnit Console 3.15.0 (Release)
Copyright (c) 2022 Charlie Poole, Rob Prouse
Sunday, May 29, 2022 4:59:16 PM

Runtime Environment
   OS Version: Microsoft Windows NT 6.2.9200.0
   Runtime: .NET Framework CLR v4.0.30319.42000

Test Files
    TestProject2.dll


Unhandled Exception:
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)

Test Run Summary
  Overall result: Failed
  Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
  Start time: 2022-05-29 07:59:17Z
    End time: NUnit.Engine.NUnitEngineException: Remote test agent exited with non-zero exit code 1
   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)
2022-05-29 07:59:18Z
    Duration: 1.028 seconds

Results (nunit3) saved as TestResult.xml

Additional Information:
This seems similar to issue #1182, but it is not the same.

What I find interesting is that I am running Windows 10:
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"

OS Name:                   Microsoft Windows 10 Home
OS Version:                10.0.19044 N/A Build 19044

and the project is targeting netcoreapp3.1 (I also tried net6.0) and yet the top of the output states:

   OS Version: Microsoft Windows NT 6.2.9200.0
   Runtime: .NET Framework CLR v4.0.30319.42000

Seems like something may be off there.

I also downloaded the zip binaries and extracted the NET6.0 binaries, directly into output directly and then ran that with the results:
nunit3-console TestProject2.dll

NUnit Console 3.15.0 (Release)
Copyright (c) 2022 Charlie Poole, Rob Prouse
Sunday, May 29, 2022 5:34:43 PM

Runtime Environment
   OS Version: Microsoft Windows 10.0.19044
  Runtime: .NET 6.0.5

Test Files
    TestProject2.dll


Run Settings
    DisposeRunners: True
    WorkDirectory: <project-path>\bin\Debug\netcoreapp3.1
    NumberOfTestWorkers: 4

Test Run Summary
  Overall result: Passed
  Test Count: 1, Passed: 1, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
  Start time: 2022-05-29 08:34:43Z
    End time: 2022-05-29 08:34:44Z
    Duration: 0.502 seconds

Results (nunit3) saved as TestResult.xml

In addtion to the application running correctly, the Runtime Environment is now correct. What is the difference from the MSI and the zip (net6.0) bits?

@CharliePoole
Copy link
Collaborator

@jamesjohnmcguire If you can, try running this using either the nuget or the chocolatey package. That will help narrow it down to the msi packaging itself.

@jamesjohnmcguire
Copy link
Author

I added NUnit.Console as a nuget package. But I don't quite understand how to use *.EXE as a nuget package. After building, the nunit3-console.exe doesn't show up anywhere in my output path. I can see it in the nuget cache at: %USERPROFILE%.nuget\packages\nunit.console\3.15.0

How is this supposed to work? How can I test this?

My demo repo is also updated with installed package.

@CharliePoole CharliePoole added this to the 3.15.1 milestone Jun 7, 2022
@CharliePoole CharliePoole modified the milestones: 3.15.1, 3.15.2 Jun 29, 2022
@CharliePoole
Copy link
Collaborator

@jamesjohnmcguire Is this still a problem?

Rereading this, I see I didn't clarify a few points you asked about...

  1. The NUnit console runner, which you were running from the MSI package is a .NET Framework application, which is able to execute .NET Core tests by running them in a separate process. The display info, which you found confusing, is referring to the environment under which the console app itself is running, i.e. the main process, and has nothing to do with the environment under which any test assemblies are run.
  2. The code you extracted under .NET 6.0 is actually a different application, the NUnit .NET Core console runner. It currently runs under .NET 6.0 and can run tests for a single .NET Core assembly, <= version 6.0. It supports a subset of the command-line options of the NUnit ConsoleRunner application. Unfortunately, these two different runners both use an executable name of nunit3-console.exe, which I'd like to change to avoid the confusion it causes.
  3. Either application should run your simple tests. I'd be interested to know whether your test runs successfully with the latest release of the runner (3.15.3) and/or the latest development code (3.16) available from the NUnit MyGet feed. If it is not working, some info about your environment would help working the problem. Alternatively, if you're happy using the NetCore runner, we can close this issue and wait to see if it comes up for others as well.

@jamesjohnmcguire
Copy link
Author

jamesjohnmcguire commented Oct 16, 2022

Thanks for checking in on this issue again.

I tried this again with MSI installer for 3.15.2, with basically the same results as my original post on this issue.

I then uninstalled the MSI package and then installed through chocolately, and, well, it seems to work, at least, on the couple of projects I tested.

So, that, it seems, will get me through the blocking issues. But there still seems something amiss then with the MSI installer.

Also, please note, I tried to go through the directions about using the nunit3-console through the nuget package, as documented here, but there is a bit of a disconnect, as newer versions of nuget use a global cache instead of local 'packages' directory.

Furthermore, looking at the package directory in the global cache, I don't see any actual binaries, so it just furthers my confusion.

example:

.nuget\packages\nunit.console\3.15.2>dir /s
    .nuget\packages\nunit.console\3.15.2

2022-07-24  09:10 PM               182 .nupkg.metadata
2022-06-30  01:12 AM             9,484 .signature.p7s
2022-07-24  09:10 PM    <DIR>          images
2022-06-30  08:06 AM             1,070 LICENSE.txt
2022-07-24  09:10 PM            29,318 nunit.console.3.15.2.nupkg
2022-07-24  09:10 PM                88 nunit.console.3.15.2.nupkg.sha512
2022-06-30  08:10 AM             2,301 nunit.console.nuspec

   .nuget\packages\nunit.console\3.15.2\images

2022-06-30  08:06 AM            16,371 nunit_256.png

So, I'm still wondering how to use the nunit3-console through the nuget package, but perhaps that should be considered a separate issue. And thus, since I can get along now with the choco package, it isn't really a concern for me.

Hope this helps!

@CharliePoole
Copy link
Collaborator

You're right that the docs no longer tell you how to use a nuget package install! I'll create an issue for that.

Thanks for clarifying that this works for the chocolatey install but not the msi package. I'll make a copy of your repro example in order to look at this further. It's possible that the issue may have been fixed, since a number of changes have been made to the msi generation in preparation for the 3.16 release. The latest development packages are available as version 3.16.0-dev00043 (or higher) from our MyGet feed.

@CharliePoole CharliePoole changed the title 3.15.0 - NUnit.Engine.NUnitEngineException : Unable to acquire remote process agent 3.15.0 - MSI package is unable to acquire remote process agent Oct 16, 2022
@CharliePoole CharliePoole modified the milestones: 3.15.3, 3.16 Oct 19, 2022
@CharliePoole
Copy link
Collaborator

@jamesjohnmcguire Can you check whether 3.16.0-dev00043 fixed this problem for you?

@jamesjohnmcguire
Copy link
Author

I tried to find a MSI installer for 3.16.0-dev00043, but couldn't find any. So, I tried installing the nuget package, through VS Package Manager console. Builds just fine but I still don't know how to run nunit3-console with the nuget package.

After uninstalling the choco version, when trying to run nunit3-console from the command line, I get: 'nunit3-console' is not recognized as an internal or external command, operable program or batch file.' and there is no nunit3-console.exe anywhere in sight.

So, until I can get an understanding of how to run nunit3-console through the nuget package, I would say this hasn't helped.

I'm still fine and good to go with the choco package version.

@CharliePoole
Copy link
Collaborator

@jamesjohnmcguire Sorry, I wasn't thinking! You obviously need the msi to verify this. You can grab it from the msi link on this page: https://ci.appveyor.com/project/CharliePoole/nunit-console/builds/45081009/artifacts

BTW, you can get chocolatey builds from our myget source as well, although that won't work for this purpose. AFAIK they don't handle msi packages.

@mattsmith321
Copy link

Can you check whether 3.16.0-dev00043 fixed this problem for you?

Not OP, but the 3.16.0-dev00043 fixed my issue with the original "unable to acquire remote process agent" error message I was getting from the MSI. However, while it "runs" without throwing an error, it does not appear to actually run the test. Still trying to track that down though.

@mattsmith321
Copy link

mattsmith321 commented Oct 24, 2022

However, while it "runs" without throwing an error, it does not appear to actually run the test. Still trying to track that down though.

Making a little headway. Was trying with the deprecated --test instead of --where. Still not actually running but moving forward.

@CharliePoole
Copy link
Collaborator

Since @mattsmith321 verifies that the original problem is fixed, I'm closing this issue. You can still comment here, however, and I'll respond.

@mattsmith321 Your problem with the filter not actually working is no doubt a different code issue, but if you post what the filter and test you are using look like, I can make some suggestions.

@CharliePoole CharliePoole self-assigned this Oct 29, 2022
@CharliePoole
Copy link
Collaborator

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

No branches or pull requests

3 participants