tag:help.appveyor.com,2012-11-13:/discussions/problems/1802-invalidcastexception-while-running-nunit-testsAppVeyor: Discussion 2018-08-25T01:54:55Ztag:help.appveyor.com,2012-11-13:Comment/363365462015-03-20T18:20:22Z2015-03-20T18:20:22ZInvalidCastException while running NUnit tests<div><p>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:</p>
<pre>
<code>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</code>
</pre>
<p>My project is located here: <a href="https://ci.appveyor.com/project/dlras2/coreutilities-extensions">https://ci.appveyor.com/project/dlras2/coreutilities-extensions</a></p>
<p>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.</p>
<p>Thanks!</p></div>cyclotis04tag:help.appveyor.com,2012-11-13:Comment/363365462015-03-20T18:43:38Z2015-03-20T18:43:38ZInvalidCastException while running NUnit tests<div><p>Will take a look.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/363365462015-03-22T04:32:22Z2015-03-22T04:32:22ZInvalidCastException while running NUnit tests<div><p>I see you depend on <code>nunit 2.6.4</code> however on build
workers there are still <code>2.6.3</code> - maybe this could be a
problem.</p>
<p>You're already installing 2.6.4 nunit runners into
<code>packages</code> directory, so you may try running tests with
them with tests auto-discovery disabled.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/363365462015-03-23T17:38:55Z2015-03-23T17:38:55ZInvalidCastException while running NUnit tests<div><p>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: <a href="https://ci.appveyor.com/project/dlras2/coreutilities-projecttemplate/history">
https://ci.appveyor.com/project/dlras2/coreutilities-projecttemplate/history</a></p>
<p>Thanks for taking a look!</p></div>cyclotis04tag:help.appveyor.com,2012-11-13:Comment/363365462015-03-23T18:15:19Z2015-03-23T18:15:19ZInvalidCastException while running NUnit tests<div><p>Sure, thanks for the update!</p></div>Feodor Fitsner