Build/Test Issues

NCrunch 4.14.0.7 build fails while VS2022 17.3.4 compiles without issue

Started by talbrecht on 1,717 views

NCrunch version 4.14.0.7, VS 17.3.4, solution is .NET 6

The trace output is:
System.Exception: An exception was thrown in the remote environment: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.Substring(Int32 startIndex, Int32 length)
at nCrunch.Compiler.BuildXml.AddTargetScript(String targetName, String dependsOnTargets, String targetScript)
at nCrunch.Compiler.LoadTimeQuery..ctor(BuildXml buildXml, IList`1 importExpressions, IPlatformTypeFactory[] platformTypeFactories, IList`1 loadTimeQueryDeclarations, Boolean supportsBeforeTargets)
at nCrunch.Compiler.ComponentAnalysisContext..ctor(ComponentLoadParameters loadParameters, IBuildableProject buildableProject, DirectoryPath baseIntermediateOutputPath)
at nCrunch.Compiler.RemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.(CallMethodMessage )
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.ProcessMessageReturningResult(Byte[] data)
at nCrunch.TaskRunner.Ipc.RemoteInstance.(Byte[] )
at nCrunch.TaskRunner.Ipc.RemoteInstance.Invoke(IMessage msg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at nCrunch.Compiler.IRemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters)
at nCrunch.Core.BuildManagement.BuildProcessLauncher..(IRemoteBuildRunner )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , FilePath , String , ExternalProcess )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , EffectiveProcessorArchitecture , GridClientId , BuildSystemParameters , IList`1 , Nullable`1 , GridAddress , DotNetCoreSdkVersion  )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.AnalyseComponentBuildInExternalProcess(ComponentLoadParameters parameters, IList`1 customEnvironmentVariables)
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.(EffectiveProcessorArchitecture , String )
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.CreateComponentFromXml(FilePath projectFilePath, ParsedBuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, IDEVersion vsVersion, ComponentUniqueName componentName, TaskSettings componentTaskSettings, Exception parseException, String targetFrameworkForMsbuild, String visibleTargetFramework)


My assumption: The issue is either caused by update of NCrunch to v4.14.0.7 or by VS update to 17.3.4

I just post it here because the stack trace contains no project code, just NCrunch. I found an old post with a similar stack trace which says I shall delete any<solution>.ncrunchsolution.user file but it doesn't solve that issue on my machine. It occurs locally and on our grid nodes.

Best regards,
Thomas

Edited

Hi Thomas,

Thanks for sharing this issue.

This looks to be an internal error in NCrunch which I think may be caused by the structure of your project file.

Can you check for me whether the project file is correctly formed and has a closing </Project> tag at the end of it?
The project file has contained the following
<Project Sdk="Microsoft.NET.Sdk" />

After changing it to
<Project Sdk="Microsoft.NET.Sdk">
</Project>

NCrunch is able to build that project.

Thanks for your help!

Best regards,
Thomas

Post a reply

Log in to reply.