Daily Usage Issues

UserException - targetting netstandard 2.0

Started by MatthewSteeples on 2,377 views

Hi,

We're frequently (multiple times per day, multiple dev machines) receiving the following error trying to build various projects in our solution.

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:\Source\Repos\Core\{Redacted}\obj\project.assets.json' doesn't have a target for 'netstandard2.0'. Ensure that restore has run and that you have included 'netstandard2.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)


Latest version of VS (16.9.3), latest version of NCrunch (4.8.0.3). Am also submitting this within NCrunch itself which will hopefully give you some more debug info.

Happy to answer more questions about our project, but I'm unsure what's relevant at this point.

Regards,
Matthew
Hi Matthew,

Thanks for sharing this issue. Have you identified any pattern around when the issue appear? Things to watch for:
- The issue appearing right after VS is started
- The issue appearing after you update projects externally, such as after doing a git pull

My gut feel here is that VS is corrupting or partially reconstructing the project.assets.json file, and we're reloading it while it's either corrupted or in an incomplete state.

Something to check is whether performing a VS rebuild makes the problem go away.
Hi,

In case it could help... I had the same exception right after I migrated many projects from net472 -> net48. Only the target framework in the error message is net472. I cleaned the solution, purged the bin and obj folders, deleted the ncrunch cache, it didn't work. In the end, I simply edited the ncrunchsolution where I had a CustomBuildProperties\TargetFramework value set to net472.

Alex

Post a reply

Log in to reply.