Build/Test Issues

Have InvalidCastException when build test projects with NCrunch

Started by Xinyu on 1,489 views

Hi,

One of my projects fail to build in NCrunch Processing Queue and here is the error I'm getting:

[PID:37092 14:43:57.3071 LocalBuildTask-24] ERROR: System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Object[]'.
at nCrunch.Module.MSTest.Integration.MSTestCilResolvedParameters..ctor(CilCustomAttribute dataRowAttribute)
at nCrunch.Module.MSTest.Integration.MSTestCilDiscoverer.createTestCases(CilMethodDefinition method, CilTypeDefinition fixture)
at nCrunch.Module.MSTest.Integration.MSTestCilDiscoverer.<FindFrameworkTestsInAssembly>b__12_0()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Module.MSTest.Integration.MSTestCilDiscoverer.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
at nCrunch.TestExecution.TestFinder..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.TestExecution.TestFinder..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActi

A string is mistakenly converted to object[] somewhere, but I cannot find where the issue might be. My project builds and runs well using Visual Studio. Is it an NCrunch internal error? Can anyone give some advice?

Thanks,
Xinyu.
Hi, thanks for posting. Can you confirm whether you are running the latest version of NCrunch? There was a breaking change in MSTest a few months ago that was causing issues like this one.
Hi,

Thanks for answering. I'm not using the newest version. I'm using 4.11. Unfortunately we only have license for 4.11. Then that's the reason.
Xinyu wrote:Hi,

Thanks for answering. I'm not using the newest version. I'm using 4.11. Unfortunately we only have license for 4.11. Then that's the reason.


Sorry, to resolve this issue you'll either need to roll back to an earlier version of MSTest, or upgrade your NCrunch. The version of NCrunch you're using wasn't designed to run on the version of the MSTest framework binary that you're referencing (they broke the API and we had to fix it in a later version).

Edited

Post a reply

Log in to reply.