Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

NCrunch has encountered an internal error: System.IndexOutOfRangeException: Index was outside the bo
robinz
#1 Posted : Saturday, April 12, 2025 3:36:22 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/25/2019(UTC)
Posts: 6
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
This is an ongoing issue that has been plaguing me for years. There doesn't seem to be any rhyme or reason for it. I can go months (over a year?) and never see the issue, and then it crops up unexpectedly.

Update, this is not true:
Typically I can move to another working directory and continue working. Today that trick isn't helping. Rolling back in source to previous commits where NCrunch was working doesn't fix it either.

I was able to track down the commit where it breaks (81500/42b29ea7c173). Updating to 81499/70f51d356373 fixes it. Updating back to 81500 breaks with the error below.

Using NCrunch for Visual Studio 2022 5.10.0.7.

NCrunch has encountered an internal error: 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.CilSession.LoadAssembly(FilePath assemblyFilePath, Boolean isInstrumentationTarget)
at nCrunch.Compiler.StaticManipulation.BuiltCilAssembly..ctor(FilePath builtAssemblyFilePath, IList`1 adjustedAssemblyReferences, Boolean instrumentForPerformanceMeasurement, ComponentInstrumentationParameters instrumentationParameters, FilePath expectedForegroundBuildOutputPath)
at nCrunch.Compiler.RemoteBuildRunner..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Compiler.RemoteBuildRunner.(ComponentInstrumentationParameters , BuildOutput , IBackgroundTaskProcessor )
at nCrunch.Compiler.RemoteBuildRunner.PerformPostProcessingOfBuiltAssembly(ComponentInstrumentationParameters instrumentationParameters, BuildOutput output, IBackgroundTaskProcessor backgroundTaskProcessor)
at nCrunch.Core.BuildManagement.BuildEnvironment..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Core.BuildManagement.BuildEnvironment.Build(SnapshotComponent snapshotComponentToBuild, IList`1 referencedComponents, GridClientId gridClientId, IList`1 customEnvironmentVariables, IPlatformBuildExtender extender, Guid taskId, GridClientDescription clientDescription, Boolean extractCoverageReportStructure)
Remco
#2 Posted : Saturday, April 12, 2025 11:50:38 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,255

Thanks: 979 times
Was thanked: 1316 time(s) in 1221 post(s)
Hi, thanks for sharing this issue.

robinz;18042 wrote:
This is an ongoing issue that has been plaguing me for years. There doesn't seem to be any rhyme or reason for it. I can go months (over a year?) and never see the issue, and then it crops up unexpectedly.


I'm familiar with this issue, and I share your frustrations with it. If you search this forum, you'll find the same pattern - people report the issue, but can't build a sample to reproduce it. After they change their code, it disappears, only to sometimes reappear later.

The problem is that I've never managed to reproduce it in the NCrunch dev environment in order to fix it. I expect it's probably something simplistic, but I've never been able to isolate it.

It's caused by something inside the assembly structure, possibly related to the size or alignment of the metadata tables.

If you're able to share the .DLL that triggers the issue, I might have a shot at being able to fix it. Unfortunately, IP constraints usually make it hard to share this. You aren't, by chance, working on an open source solution are you?
robinz
#3 Posted : Monday, April 14, 2025 6:45:59 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/25/2019(UTC)
Posts: 6
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
Understood. IP issues are the root of the problem, I can't share our DLLs.

However, I do seem to be in a place where I can replicate the issue by updating to a specific commit. I'm wondering if you built a dev version with more logging around the break and I ran it against this commit if that would be helpful?
Remco
#4 Posted : Tuesday, April 15, 2025 11:52:50 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,255

Thanks: 979 times
Was thanked: 1316 time(s) in 1221 post(s)
I've prepared a build containing a whole lot of temporary trace logs to try and isolate the issue (links are below). I'm wondering if you could try installing this build, then:
1. Open the solution containing the project that fails to build
2. Ensure all grid nodes are disconnected (work locally only)
3. Wait for the build to fail and for the engine to complete any other work
4. Right click the problematic project in the Tests Window and choose to reload and rebuild. This should make it fail again.
5. Use the 'Submit bug report' option to send through a bug report.

I'm hoping you can also repeat this process for the version of your solution that works without problems. In this way, I can compare the logs and see what is different in the metadata structure.

Note that this build actually disables the exception you're seeing by implementing a range check. I don't think this will fix the problem .. most likely it will just push it further downstream, but it will be interesting to see the result.

NCrunch_Console_5.14.0.1.msi
NCrunch_Console_5.14.0.1.zip
NCrunch_GridNodeServer_5.14.0.1.msi
NCrunch_GridNodeServer_5.14.0.1.zip
NCrunch_LicenseServer_5.14.0.1.zip
NCrunch_Rider_5.14.0.1.7z
NCrunch_Rider_5.14.0.1.zip
NCrunch_VS2010_5.14.0.1.msi
NCrunch_VS2010_5.14.0.1.zip
NCrunch_VS2012_5.14.0.1.msi
NCrunch_VS2012_5.14.0.1.zip
NCrunch_VS2013_5.14.0.1.msi
NCrunch_VS2013_5.14.0.1.zip
NCrunch_VS2015_5.14.0.1.msi
NCrunch_VS2015_5.14.0.1.msi.7z
NCrunch_VS2015_5.14.0.1.zip
NCrunch_VS2017_5.14.0.1.msi
NCrunch_VS2017_5.14.0.1.msi.7z
NCrunch_VS2017_5.14.0.1.zip
NCrunch_VS2019_5.14.0.1.msi
NCrunch_VS2019_5.14.0.1.msi.7z
NCrunch_VS2019_5.14.0.1.zip
NCrunch_VS2022_5.14.0.1.msi
NCrunch_VS2022_5.14.0.1.msi.7z
NCrunch_VS2022_5.14.0.1.zip
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.066 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download