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

Notification

Icon
Error

System.IndexOutOfRangeException from NCrunch compiler, MSBuild working fine
srravula
#1 Posted : Tuesday, August 2, 2016 7:16:19 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/2/2016(UTC)
Posts: 1
Location: United States of America

Hi, I have a project file which is compiling fine with MSBuild but not building with NCrunch 2.23.0.2.

I am using Visual Studio 2015

System.IndexOutOfRangeException: Index was outside the bounds of the array.
at  .(  ,   , Int32& )
at  .(MethodDefinition )
at  .(Collection`1 )
at  .(IEnumerable`1 )
at  .()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Compiler.StaticManipulation.BuiltAssembly.Instrument(ComponentSourceLineMap sourceLineMap, IDictionary`2 instrumentationDirectivesByCodeFileId, IDictionary`2 codeFileIDsByFilePath, Boolean proxyProcessIsActive, Int32 componentId, IInstrumentationFilter[] instrumentationFilters, PerfTracker perfTracker)
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 )
Remco
#2 Posted : Tuesday, August 2, 2016 8:37:18 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for sharing this issue.

It looks to me like there is something not quite right with this assembly.

The assembly's PDB file is referencing a source line that doesn't seem to exist in your source code.

For example, your codebase contains a source file (let's say "MySourceFile.cs") with 20 lines of code, including a method (say, 'MyMethod'). This method has 10 lines of code. When MyMethod is compiled, it's IL is written into the assembly, and the method's instructions are represented in the PDB file and linked back to the original source code (MySourceFile.cs). In this case, there is an instruction inside MyMethod that is pointing to a line of code that is outside the scope of MySourceFile.cs (i.e. line 21).

It's possible to produce this problem by using the '#line' compiler directive. Some tools (such as SpecFlow) use this to trick debuggers and other tooling into enumerating different areas of source that would normally be identified by the compiler.

It may also be caused by a bug in the compiler or another tool that manipulates the assembly or its PDB file.

You can work around this problem by turning off the 'Instrument output assembly' setting in your NCrunch configuration, although you will then lose any code coverage tracking for this project.
Remco
#3 Posted : Monday, August 8, 2016 5:06:51 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
v2.25 has just been released including a change that will make the instrumentor ignore any lines that are pointing at invalid/missing lines of code.
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.029 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download