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

Notification

Icon
Error

Not initializing due to exception
christopher7694
#1 Posted : Monday, April 26, 2021 10:17:45 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/26/2021(UTC)
Posts: 4
Location: United States of America

When attempting to load a project, I get the following output:


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 'C:\{...redacted...}\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
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)


following the suggestion in the output, I get this:


Quote:
All packages are already installed and there is nothing to restore.
Time Elapsed: 00:00:00.0669642
========== Finished ==========


Still unable to go forward.
Is there enough information here to help diagnose what is going on?
If not, is there anything else I can provide?

Remco
#2 Posted : Tuesday, April 27, 2021 12:25:06 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Hi, thanks for sharing this problem.

The project.assets.json file is supposed to be produced by VS prior to NCrunch loading the project. Sometimes, it isn't ready in time and NCrunch needs a reload cycle to pick it up. Can you confirm whether building the solution in VS then resetting NCrunch resolves the problem?
christopher7694
#3 Posted : Tuesday, April 27, 2021 12:39:20 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/26/2021(UTC)
Posts: 4
Location: United States of America

I have built the project in VS and then reset NCrunch, the problem persists.
I verified the file exists.
Is the projects.assets.json location hard-coded?

I have a Directory.Build.props file that uses the two properties:
BaseIntermediateOutputPath and IntermediateOutputPath.

Does NCrunch pick up these properties?
Remco
#4 Posted : Tuesday, April 27, 2021 12:55:42 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
christopher7694;15417 wrote:

I have a Directory.Build.props file that uses the two properties:
BaseIntermediateOutputPath and IntermediateOutputPath.
Does NCrunch pick up these properties?


Changing these properties massively increases the complexity of the load system under NCrunch, especially if they are overridden using derived values inside a directory.props file.

We do have handling for this, but I'll need more information to understand how the system is failing. It's possible you have a use case that we can't handle.

Can you share any more information about how these values are declared in your directory.props file?
christopher7694
#5 Posted : Tuesday, April 27, 2021 5:44:50 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/26/2021(UTC)
Posts: 4
Location: United States of America

The file is not particularly complex:

Quote:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<BaseIntermediateOutputPath>..\..\..\.build\.intermediate\$(MSBuildProjectName)\obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<BaseIntermediateOutputPath>..\..\..\.build\.intermediate\$(MSBuildProjectName)\obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>


If you need specific information to help diagnose, please let me know.

Thank you for your help.
Remco
#6 Posted : Wednesday, April 28, 2021 12:31:32 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Thanks for sharing the extra details.

I see now where the compatibility hole is. We aren't able to properly handle an overridden BaseIntermediateOutputPath in a directory.props file using $(MSBuildProjectName). This is due to technical limitations with the way that MSBuild works and how we need to integrate with it in this area. Perhaps you could use a different property, such as $(AssemblyName) instead?
christopher7694
#7 Posted : Friday, April 30, 2021 6:32:24 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/26/2021(UTC)
Posts: 4
Location: United States of America

Remco;15420 wrote:
Thanks for sharing the extra details.

I see now where the compatibility hole is. We aren't able to properly handle an overridden BaseIntermediateOutputPath in a directory.props file using $(MSBuildProjectName). This is due to technical limitations with the way that MSBuild works and how we need to integrate with it in this area. Perhaps you could use a different property, such as $(AssemblyName) instead?


Still trying to figure this out.

So far, I've found that I need to remove:
Quote:

<OutDir>..\..\.build\</OutDir>
<OutputPath>..\..\.build\</OutputPath>

and
Quote:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<BaseIntermediateOutputPath>..\..\.build\.intermediate\$(MSBuildProjectName)\obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<BaseIntermediateOutputPath>..\..\.build\.intermediate\$(MSBuildProjectName)\obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>


as well as inform NCrunch config that each of the projects in the solution need to include a top level .editorconfig that apparently isn't found by NCrunch.

With all those changes, I do get the builds and tests to be recognized.

However, this isn't going to be viable long term. Do you have any other suggestions I can try?

Thanks!!

Remco
#8 Posted : Friday, April 30, 2021 10:56:55 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Does replacing the $(MSBuildProjectName) reference with $(AssemblyName) in the directory.build.props file make any difference?

Usually replacing the OutputPath/OutDir properties shouldn't create a problem. Did you need to do this to solve a different error?

The .editorconfig file won't be automatically detected if it isn't included in the project file(s). Using NCrunch's 'Additional files to include' setting is the correct solution to this problem.
divverencebart
#9 Posted : Wednesday, December 22, 2021 3:57:06 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/22/2021(UTC)
Posts: 1
Location: Netherlands

$(AssemblyName) doesn't even work for `dotnet build` itself - seems that that is resolved to 'empty' so it's 'dotnet restore'ing into the same folder for all projects
Any other suggestions?

Problem is that the default (project/obj) is messing with my docker based build - windows-generated files (needed for ncrunch, for example) are copied along into the docker build environment....

Remco
#10 Posted : Wednesday, December 22, 2021 10:53:23 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
divverencebart;15906 wrote:
$(AssemblyName) doesn't even work for `dotnet build` itself - seems that that is resolved to 'empty' so it's 'dotnet restore'ing into the same folder for all projects
Any other suggestions?


I'm reduced to guesswork here, but what if you set the AssemblyName to a fixed value inside each project file? It's intended to be a user specified value in the project configuration anyway:

<PropertyGroup>
<AssemblyName>MyProjectName</AssemblyName>
</PropertyGroup>
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.084 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download