Daily Usage Issues

TargetInvocationException Looping

Started by Silvenga on 2,221 views

Happy new years!

When modifying the csproj by hand (changing the TargetFrameworks property, e.g. removing netcoreapp3.0) NCrunch will loop with the following error (for all target frameworks):


NCrunch: This project was built on server '(local)'
NCrunch: The tests in this project were discovered on server '(local)'
System.Exception: An exception was thrown in the remote environment: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> nCrunch.Common.UserException: Errors occurred while trying to load the project file: 
Assets file 'D:\Development\<removed>\tests\unit-tests\<removed>.Tests\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v3.0'. Ensure that restore has run and that you have included 'netcoreapp3.0' in the TargetFrameworks for your project.
   at nCrunch.Compiler.ComponentAnalysisContext.()
   at nCrunch.Compiler.ComponentAnalysisContext.AnalyseComponentBuild()
   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 )
   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, VisualStudioVersion vsVersion, ComponentUniqueName componentName, TaskSettings componentTaskSettings, Exception parseException, String targetFramework)


Performing a dotnet restore makes no impact. The only mitigation I've found is to completely restart the NCrunch engine.
Hi! Thanks for posting and a happy new year!

Would you mind trying the build posted in the last post on this thread: https://forum.ncrunch.net/yaf_postsm14281_Could-not-load-file-or-assembly-after-4-2-0-7-update.aspx#post14281
Thanks for the response!

I installed the new build, the looping is still occuring.

Partly related, I've noticed when adding a new target to a test project, that NCrunch doesn't run the tests under that target until I restart the NCrunch engine. I see the new project target being built, but there is no test node.
Thanks for sharing these problems. Would you mind copy/pasting the contents of your .csproj file to the forum? If you're concerned about placing it publicly, you can also send it through the NCrunch contact form.

NCrunch is reliant on VS to update the project assets json files when projects are changed, but sometimes this process doesn't work in the way we'd like it to. Does rebuilding your solution using VS then resetting NCrunch resolve the issue?

Edited

Post a reply

Log in to reply.