InvalidCastException while running NUnit tests
I'm running into errors using NUnit. I've gotten my test project to build successfully, but the NUnit runner itself encounters a fatal exception, and I'm not sure what it means:
System.InvalidCastException: Return argument has an invalid type.
Server stack trace:
at System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg, Type paramType)
at System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage msg, Object[] outArgs, Object returnValue)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at NUnit.Core.DomainAgent.CreateRunner(Int32 runnerID)
at NUnit.Util.TestDomain.Load(TestPackage package)
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
at NUnit.Util.RemoteTestAgent.AgentRunner.Load(TestPackage package)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at NUnit.Core.TestRunner.Load(TestPackage package)
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
at NUnit.Util.ProcessRunner.Load(TestPackage package)
at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
at NUnit.ConsoleRunner.Runner.Main(String[] args)
Command exited with code -100
My project is located here: https://ci.appveyor.com/project/dlras2/coreutilities-extensions
I'm not sure where the root of the problem lies. The tests run completely and correctly on my local, using VS 2015 CTP and ReSharper 9.
Thanks!
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac

Support Staff 1 Posted by Feodor Fitsner on 20 Mar, 2015 06:43 PM
Will take a look.
Support Staff 2 Posted by Feodor Fitsner on 22 Mar, 2015 04:32 AM
I see you depend on
nunit 2.6.4however on build workers there are still2.6.3- maybe this could be a problem.You're already installing 2.6.4 nunit runners into
packagesdirectory, so you may try running tests with them with tests auto-discovery disabled.3 Posted by cyclotis04 on 23 Mar, 2015 05:38 PM
It seems like downgrading to 2.6.3 has fixed it. I also had issues using the latest MSBuild but found that solution as well. I've worked through my process step-by-step of getting NUnit, VS2015, etc., working here: https://ci.appveyor.com/project/dlras2/coreutilities-projecttemplate/history
Thanks for taking a look!
Support Staff 4 Posted by Feodor Fitsner on 23 Mar, 2015 06:15 PM
Sure, thanks for the update!
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:54 AM.