Build/Test Issues

ERROR (Build): TEST_svcHMRMgr_Library: (0): System.NotImplementedException: GenericInst

Started by CoolBreeze on 1,676 views

When I try to run tests in a VB class library with three of the tests using generics I get this error:

[11:24:27.1537-LocalBuildTask-32] ERROR (Build): TEST_svcHMRMgr_Library: (0): System.NotImplementedException: GenericInst
at _Mono.Cecil.SignatureReader.ReadPrimitiveValue(ElementType type)
at _Mono.Cecil.SignatureReader.ReadCustomAttributeElementValue(TypeReference type)
at _Mono.Cecil.SignatureReader.ReadCustomAttributeElement(TypeReference type)
at _Mono.Cecil.SignatureReader.ReadCustomAttributeElement(TypeReference type)
at _Mono.Cecil.SignatureReader.ReadCustomAttributeFixedArgument(TypeReference type)
at _Mono.Cecil.SignatureReader.ReadCustomAttributeConstructorArguments(CustomAttribute attribute, Collection`1 parameters)
at _Mono.Cecil.MetadataReader.ReadCustomAttributeSignature(CustomAttribute attribute)
at _Mono.Cecil.CustomAttribute.<Resolve>b__32_0(CustomAttribute attribute, MetadataReader reader)
at _Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
at _Mono.Cecil.CustomAttribute.Resolve()
at _Mono.Cecil.CustomAttribute.get_Fields()
at nCrunch.Compiler.CecilReflection.ILHashGenerator.HashCustomAttribute(FNV64& hash, CustomAttribute customAttribute)
at nCrunch.Compiler.CecilReflection.ILHashGenerator.(FNV64& , MethodDefinition )
at nCrunch.Compiler.CecilReflection.ILHashGenerator.HashMethod(MethodDefinition cecilMethod, Int32 stackSize)
at nCrunch.Compiler.CecilReflection.CecilMethod.get_Hash()
at nCrunch.TestExecution.Frameworks.DefaultClassMethodDescriptionLocator.(ReflectedType , ReflectedMethod , SequencePoint , Boolean , FNV64 )
at nCrunch.TestExecution.Frameworks.DefaultClassMethodDescriptionLocator.ExtractClassMemberDataFromType(ReflectedType type, Boolean hashAllMethods)
at nCrunch.Compiler.StaticManipulation.BuiltAssembly.(ReflectedAssembly , IDictionary`2 , TestFrameworkDescription[] , Boolean )
at nCrunch.Compiler.StaticManipulation.BuiltAssembly.ExtractClassMethodData(TestFrameworkDescription[] applicableTestFrameworks, IDictionary`2 codeFileIDsByFilePath, Boolean hashMethods)
at nCrunch.Compiler.RemoteBuildRunner..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
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 )

Based on the last term in the error message I see "GenericInst".

So I assume the problem is related to the use of generics.

When I exclude the three test files using generics from the project the build succeeds and I can run tests.

Also interesting:

Yesterday morning I successfully built and ran the tests using generics.

Yesterday afternoon I updated the code to be tested and the test code. No Go.

I'm now trying to narrow this down to a few lines of test code using generics.

After I posted the note I narrowed down the problem to:

<TestCase(ABC_LIB_Search_Criteria(Of String).Input_Format.CSV, "123456789012", {"123456789012"})>

NCrunch doesn't like the (Of String) in the test case. :(

I'll see if I can work around the problem.

NCrunch for Visual Studiuo 2017 3.23.0.10

I looked at all the release notes from builds 3.24 to 3.30. I didn't any notes about fixing bugs related to generics. I'll upgrade anyways and see what happens.

Edited

Hi, thanks for sharing this issue.

This problem is being triggered by an unexpected IL signature in the parameter of the attribute constructor call. Probably, it's specific to VB, which is why it's survived for so long and we haven't seen it before.

We're reworking all this code at the moment from the ground up. My preference would be to simply fix it with the rework. Have you been able to work around the problem in your code?
Hi,

Yes, I worked around the problem like this:

<TestCase("CSV")>
<TestCase("Single_Line")>
Public Sub Test(Input_Format AS String)

Select Case Input_Format
Case "CSV"
' Do CSV test.

Case 'Single_Line"

End Select

End Sub

Not the most elegant but works for the time being.

Thanks for the answer.

FYI: I use NCrunch almost every workday. It's one of the most useful tools I use. So I really appreciate that you created it!

Post a reply

Log in to reply.