Build/Test Issues

Build failure: System.ArgumentNullException

Started by Rasmus on 3,883 views

Hi,

I am working on a large'ish solution for a bank (=> I cannot share too much code). A recent update of a test project caused NCrunch to fail for that project with

System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable`1 source, Func`2 selector)
at nCrunch.Module.MSTest.Integration.MSTestStaticDiscoverer.resolveDataRowParameters(ReflectedAttribute dataRowAttribute)
at nCrunch.Module.MSTest.Integration.MSTestDynamicDiscoverer.<>c__DisplayClass7_0.<FindFrameworkTestsInAssembly>b__1()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Common.PerformanceTracking.PerfTracker.TryTrackActivity(String name, Action activity)
at nCrunch.Module.MSTest.Integration.MSTestDynamicDiscoverer.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.TrackActivity(String name, Action activity)
at nCrunch.TestExecution.TestFinder.FindTestsForFrameworks(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, DescribedTestFrameworkDiscoverer[] describedDiscoverers, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
at nCrunch.Compiler.StaticManipulation.BuiltAssembly.DiscoverTests(TestFrameworkDescription[] applicableTestFrameworks, ComponentUniqueName testComponentUniqueName)
at nCrunch.Compiler.RemoteBuildRunner.(ComponentBuildParameters , FilePath , BuildOutput , DirectoryPath[] , FilePath[] )
at nCrunch.Compiler.RemoteBuildRunner..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Compiler.RemoteBuildRunner.(ComponentBuildParameters )


The problematic code seems to be

[DataRow(TriState.NotSet, null)]
[DataRow(TriState.False, false)]
[DataRow(null, null)]
[DataRow(TriState.True, true)]
[DataTestMethod]
public void When_hin_account_set_with_given_state_map_to_valid_value(TriState? hinAccountState, bool? expectedResult)
{
....
}

where TriState is an external datacontract defined as

[System.Runtime.Serialization.DataContract(Name = "TriState")]
[Serializable]
public enum TriState
{
[EnumMember] NotSet,
[EnumMember] True,
[EnumMember] False,
}

Is there something I can do to make NCrunch happy about this?

Cheers,
Rasmus
Hi Rasmus,

Thanks for posting!

Can you confirm whether you're running the latest version of NCrunch? We fixed a problem with exactly this description in v3.15.
Ooops no, I am on 3.14. Must have missed an upgrade notification. Will upgrade, sorry for the noise.
Upgraded to 3.16, get a different error now

System.ArgumentException: Object of type 'System.Int32' cannot be converted to type 'System.Nullable`1[Iit.Crm.Onboarding.Api.Proxy.DataContract.TriState]'.
at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at nCrunch.TestExecution.Reflection.Clr.ClrMethod.Invoke(Object instance, Object[] parameters)
Do you experience this problem when changing your Framework Utilisation Type for MSTest to 'DynamicAnalysis'?
No, that did it.

Post a reply

Log in to reply.