I have my test file using NUnit 3.10.1
Here's the output I'm receiving after running nunit3-console.exe
NUnit Console Runner 3.6.0
Copyright (C) 2017 Charlie Poole
Runtime Environment
OS Version: Microsoft Windows NT 10.0.16299.0
CLR Version: 4.0.30319.42000
Test Files
.\dll_test.dll
Unhandled Exception: NUnit.Engine.NUnitEngineException: Failed to start remote test agent.
at NUnit.Engine.Services.TestAgency.OnAgentExit(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)
System.TypeLoadException: Could not load type 'NUnit.Engine.NUnitEngineUnloadException' from assembly 'nunit.engine.api, Version=3.0.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb'.
at NUnit.Engine.Runners.ProcessRunner.Dispose(Boolean disposing)
at NUnit.Engine.Runners.AbstractTestRunner.Dispose()
at NUnit.Engine.Runners.MasterTestRunner.Dispose(Boolean disposing)
at NUnit.Engine.Runners.MasterTestRunner.Dispose()
at NUnit.ConsoleRunner.ConsoleRunner.RunTests(TestPackage package, TestFilter filter)
at NUnit.ConsoleRunner.Program.Main(String[] args)
PS C:\Users\eyang\Documents\Work\Demonstration\dll_test\dll_test\bin\x64\Debug>
I found this thread (https://github.com/nunit/nunit/issues/1348) but it did not help much.
Cheers!
You've said you're using nunit console 3.8 - but your output shows you're running in console 3.6. I suspect you may have two different versions installed side by side or something, and that's causing the confusion?
How are you running you tests - do you have the console installed both via the msi, and as a NuGet package or anything? Where does the 3.8 version come from? I suggest you have a dig around down that line of enquiry. 馃檪
Closing this, as there's not enough information to understand/reproduce the problem.
Happy to reopen if anyone has more to add. 馃檪
I encountered similar issue and it's 3.8 shown in log, not 3.6 ;)
位 nunit3-console.exe MyTests.dll
NUnit Console Runner 3.8.0
Copyright (c) 2018 Charlie Poole, Rob Prouse
Runtime Environment
OS Version: Microsoft Windows NT 10.0.17134.0
CLR Version: 4.0.30319.42000
Test Files
MyTests.dll
Unhandled Exception: System.TypeLoadException: Could not load type 'NUnit.Engine.NUnitEngineUnloadException' from assembly 'nunit.engine.api, Version=3.0.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb'.
at NUnit.Common.ExceptionHelper.FlattenExceptionHierarchy(Exception exception)
at NUnit.Common.ExceptionHelper.BuildMessage(Exception exception)
at NUnit.ConsoleRunner.Program.Main(String[] args)
I have following NUnit packages in my packages.config:
<package id="NUnit" version="3.10.1" targetFramework="net452" />
<package id="NUnit.ConsoleRunner" version="3.8.0" targetFramework="net452" />
<package id="NUnit3TestAdapter" version="3.10.0" targetFramework="net452" />
When I downgrade it to 3.9.x - it works correctly. It seems like NUnit.ConsoleRunner 3.8.0 doesn't work with NUnit 3.10.x.
At this point I don't need 3.10.x for any specific needs, 3.9.x works well and it's enough, however it's not the first time I spontaneously update my packages to more recent version and encountering this not obvious issue. So - if it's fixed, then I still would be happy.;)
Hmmm. If you remove the NUnit3TestAdapter package, and clean and rebuild, does it work? I'm wondering if this is caused by two different version of the ending being involved.
The framework version shouldn't affect this at all however - did you also update the adapter at the same time?
Yes, seems like NUnit3TestAdapter is causing it. Either removing it or leaving it downgraded to 3.9 version - then Console runner 3.8.0 works with NUnit 3.10.x.
However I still need to have NUnit3TestAdapter. NUnit3TestAdapter is used for development, while Console runner is used during CI/CD builds.
I'd guess this is caused because the NUnit3TestAdapter is referencing NUnit.Engine 3.7, and the Console is referencing NUnit.Engine 3.8. Looks like with wrong dll is being hit somewhere.
For anyone as clumsy as I am .... I just saw a similar problem, due to my error. Not an NUnit issue.
I found I had named 2 assemblies the same:
myname.myassembly.UnitTests - one have been myname.myassembly - DOH!
Actually reading the long qualified names made it clear that the method under test was being sought in the unit test assembly.
I also get this error:
System.TypeLoadException: Method 'get_TargetFramework' in type 'NUnit.Engine.Extensibility.ExtensionNode' from assembly 'nunit.engine, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' does not have an implementation.
This occurs when I'm using Nunit3TestAdapter 3.13.0. However, when I use version 3.11.2, all my tests work fine.
@reckface are you getting this exception when running the NUnit Console? Which version of the console are you running? Is the console installed to the project as a NuGet package? Do you also have the console installed as an MSI?
Hi, I ran into the same problem and @reckface's solution worked for me. Downgrading Nunit3TestAdaptor from 3.13.0 to 3.11.2 didn't result in the he mentioned above.
I installed the Nunit3TestAdaptor as a NuGet package.
I just ran into this on one computer, but not another running tests in ReSharper's test sessions window. I noticed running the tests from the VS Test explorer window, there was no error.
I did get the same results downgrading Nunit3TestAdaptor 3.13.0 to 3.11.2. They started working again in ReSharper's test window.
So I upgraded to ReSharper 2018.3.4 on the machine it was failing and reverted back to the TestAdapter 3.13.0. Problem gone.
I had the same error as @reckface, and re-installing the TestAdapter and upgrading R#, just as @spring1975 said, did the trick.
I get the following similair exception with packages installed from NuGet
System.TypeLoadException: 'Method 'get_AssemblyPath' in type 'NUnit.Engine.Extensibility.ExtensionNode' from assembly 'nunit.engine, Version=3.10.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' does not have an implementation.'
EDIT: I've downgraded the NUnit3TestAdapter to v3.13.0 and the exception is gone. Any version above v3.13.0 produces this exception. Ah and I want to mention, that I run the tests with Resharpers (2020.1.4) built-in test explorer.
I think this bug has been correctly diagnosed in https://github.com/nunit/nunit-console/issues/800. I'm going to close this issue as a duplicate of that one.
Most helpful comment
I also get this error:
System.TypeLoadException: Method 'get_TargetFramework' in type 'NUnit.Engine.Extensibility.ExtensionNode' from assembly 'nunit.engine, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' does not have an implementation.This occurs when I'm using Nunit3TestAdapter 3.13.0. However, when I use version 3.11.2, all my tests work fine.