Build/Test Issues

Problem with new instrumentation since 4.9

Started by cbeauchemin on 2,198 views

Hi,
i was having index out of bound problem with the new instrumentation type. I was using the legacy one and it worked completely. Since 4.9, access to the legacy instrumentation is not possible anymore and i have the same problem in vs 2022 as in vs 2019.

Here is the stack trace:

[PID:2952 09:43:30.7497 LocalBuildTask-43] ERROR: nCrunch.Compiler.StaticManipulation.CilTypeHashException: Unable to hash type ********.****GoogleAdsConfig' due to exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at nCrunch.Compiler.Cil.Types.CilNestedClassTable..ctor(CilModule module, CilTableInfo tableInfo)
at nCrunch.Compiler.Cil.CilModule..ctor(CilAssembly assembly, CilMetadataRoot metadataRoot, CilPeHeaders peHeaders, CilContext context, DirectoryPath workingDirectory, UInt32 entryPointToken)
at nCrunch.Compiler.Cil.CilAssembly..ctor(Byte[] , CilContext , DirectoryPath )
at nCrunch.Compiler.Cil.CilAssembly.Load(FilePath assemblyFile, CilContext context)
at nCrunch.Compiler.Cil.CachedCilAssembly..ctor(FilePath assemblyFilePath, CilContext context, Boolean isInstrumentationTarget)
at nCrunch.Compiler.Cil.CilContext.LoadAssembly(FilePath assemblyFilePath)
at nCrunch.Compiler.Cil.CilSession.LoadAssembly(FilePath assemblyFilePath, Boolean isInstrumentationTarget)
at nCrunch.Compiler.Cil.CilSession.(String , String , UInt16 , UInt16 , UInt16 , UInt16 , String , String  )
at nCrunch.Compiler.Cil.CilSession.LoadAssembly(CilAssemblyReference assemblyReference)
at nCrunch.Compiler.Cil.CilSession.GetReferencedModule(CilModule referencingModule, UInt32 assemblyRefTableRowIndex)
at nCrunch.Compiler.Cil.AssemblyIdentity.CilAssemblyRefTable.GetAssemblyModuleByRowIndex(UInt32 tableIndex)
at nCrunch.Compiler.Cil.Types.CilTypeReference.(CilModule )
at nCrunch.Compiler.Cil.Types.CilTypeDefinition.ResolveBaseType()
at nCrunch.Compiler.StaticManipulation.CilMethodHashGenerator.HashType(FNV64& hash, CilTypeDefinition type)
at nCrunch.Compiler.StaticManipulation.BuiltCilAssembly.ExtractClassMethodData(TestFrameworkDescription[] applicableTestFrameworks, IDictionary`2 codeFileIDsByForegroundFilePath, Boolean storeImpactHashes)
at nCrunch.Compiler.StaticManipulation.BuiltCilAssembly.ExtractClassMethodData(TestFrameworkDescription[] applicableTestFrameworks, IDictionary`2 codeFileIDsByForegroundFilePath, Boolean storeImpactHashes)
at nCrunch.Compiler.CilProcessingTasks.CilMethodHashingTask..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Compiler.CilProcessingTasks.ConcurrentCilTaskProcessor.()
Hi, thanks for sharing this problem.

This looks to be caused by a hole in our CIL handling. The type mentioned in the error descends from a type declared in another assembly that doesn't seem to fit the CIL structure expected by NCrunch. I'm wondering if it might have been manipulated/obfuscated somehow or built with a niche compiler. Is this base type declared in a package that is available online? If I can reproduce this issue I hope it should be straightforward to fix it.
Hi, Thanks for the quick answer. Nothing have been obfuscated on our side. The problematic class is a derivation from the base class in a Google library named GoogleAdsConfig.cs

This class is included in the package https://www.nuget.org/packages/Google.Ads.GoogleAds/6.0.0

The source of it can be found here: is https://github.com/googleads/google-ads-dotnet

Thanks
Thanks for these details.

I can confirm that I can now reproduce this problem at will using the specified library.

I will let you know as soon as we have a fix available.
Could you try the build below and let me know if this solves the problem for you?

NCrunch_Console_4.10.0.2.msi
NCrunch_Console_4.10.0.2.zip
NCrunch_GridNodeServer_4.10.0.2.msi
NCrunch_GridNodeServer_4.10.0.2.zip
NCrunch_LicenseServer_4.10.0.2.zip
NCrunch_VS2010_4.10.0.2.msi
NCrunch_VS2010_4.10.0.2.zip
NCrunch_VS2012_4.10.0.2.msi
NCrunch_VS2012_4.10.0.2.zip
NCrunch_VS2013_4.10.0.2.msi
NCrunch_VS2013_4.10.0.2.zip
NCrunch_VS2015_4.10.0.2.msi
NCrunch_VS2015_4.10.0.2.msi.7z
NCrunch_VS2015_4.10.0.2.zip
NCrunch_VS2017_4.10.0.2.msi
NCrunch_VS2017_4.10.0.2.msi.7z
NCrunch_VS2017_4.10.0.2.zip
NCrunch_VS2019_4.10.0.2.msi
NCrunch_VS2019_4.10.0.2.msi.7z
NCrunch_VS2019_4.10.0.2.zip
NCrunch_VS2022_4.10.0.2.msi
NCrunch_VS2022_4.10.0.2.msi.7z
NCrunch_VS2022_4.10.0.2.zip
Ok, I can confirm you that its working for vs 2022, i will be soon able to test it with vs 2019. From my point of view, it seem to be fixed!

Thanks
This post has been deleted.

Post a reply

Log in to reply.