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

Notification

Icon
Error

UserException - targetting netstandard 2.0
MatthewSteeples
#1 Posted : Wednesday, April 7, 2021 11:11:37 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/28/2014(UTC)
Posts: 130
Location: United Kingdom

Thanks: 7 times
Was thanked: 18 time(s) in 16 post(s)
Hi,

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

Quote:
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
Remco
#2 Posted : Wednesday, April 7, 2021 10:38:20 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
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.
Paramethod
#3 Posted : Sunday, February 27, 2022 6:23:11 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/28/2021(UTC)
Posts: 6
Location: Canada

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
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
1 user thanked Paramethod for this useful post.
Remco on 2/27/2022(UTC)
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.046 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download