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

Notification

Icon
Error

NCrunch fails to build UnitTests project
Dirk Maegh
#1 Posted : Saturday, April 15, 2023 5:20:10 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 11/30/2016(UTC)
Posts: 55
Location: Belgium

Thanks: 8 times
Was thanked: 8 time(s) in 8 post(s)
Hi,

I didn't know whether to go on from the previous topic or not.
I am trying your new build 4.17.0.3 on a different laptop now, different project.

It is still a source generator though, but the unittests project fails to build. (VS2022 builds fine)


An error occurred while analysing this project after it was built: NCrunch encountered an unexpected error occurred while building an environment to analyse an assembly: The NCrunch task process failed to correctly initialise with the following exception: nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The NCrunch task process was unexpectedly terminated. For information on how to troubleshoot this problem, please see https://www.ncrunch.net/...inated-unexpected-error
at nCrunch.TaskRunner.Ipc.Fast.IpcReader.Initialise()
at nCrunch.TaskRunner.Ipc.Fast.IpcStream.Connect()
at nCrunch.TaskRunner.Ipc.Fast.FastIpcClient.Connect()
at nCrunch.Core.ProcessManagement.DefaultProcessLoader.ConnectToProcess(ExternalProcess externalProcess, ProcessLoadParameters parameters, Action`1 outOfBandMessageHandler)
at nCrunch.Core.ProcessManagement.ExternalProcessManager..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Core.ProcessManagement.ExternalProcessManager.(EffectiveProcessorArchitecture , ProcessLoadParameters , Boolean )

The trace output for the process is as follows:
Error:
An assembly specified in the application dependencies manifest (nCrunch.TaskRunner.DotNetCore.20.x64.deps.json) was not found:
package: 'System.Collections.NonGeneric', version: '4.3.0'
path: 'lib/netstandard1.3/System.Collections.NonGeneric.dll'

First I thought it might be an installation issue, so I tried a repair, but to no avail.
Dirk Maegh
#2 Posted : Sunday, April 16, 2023 9:33:58 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 11/30/2016(UTC)
Posts: 55
Location: Belgium

Thanks: 8 times
Was thanked: 8 time(s) in 8 post(s)
Just sharing another experience - building the same project on my desktop (also Windows 11 64 bit, also VS2022, also same build of NCrunch)
Ncrunch builds the same project fine here...
Remco
#3 Posted : Sunday, April 16, 2023 10:25:31 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, this problem looks like a Nuget dependency resolution issue. The specified package is required in the NCrunch test environment, but it isn't found on the machine.

NCrunch does have a special initialisation step that will download these packages automatically, but we've noticed that for undetermined reasons, the restore step fails on some systems. You can work around this by creating a dummy project in VS that references the missing package. This will force Nuget to install the package on your machine, thus correcting the issue.
Dirk Maegh
#4 Posted : Monday, April 17, 2023 3:50:09 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 11/30/2016(UTC)
Posts: 55
Location: Belgium

Thanks: 8 times
Was thanked: 8 time(s) in 8 post(s)
Hi,

it indeed seems like a nuget dependency issue. And I fixed it, and I think you would want to hear what fixed my problem exactly...

At the same time as when I wrote down this issue, NCrunch also showed another warning - it could not create a test environment, as you also said in last message. Which is why I thought bringing this up might be interesting for you guys :)
If you hadn't brought this up, I would think of this as "just another warning" (which I usually just hide and do not handle)
The content of this warning was the following (I think many libraries are double ? Could be fixed, and I had to manually edit into the csharp project form. You might throw that syntax in for free instead of just listing, could certainly help :) )

<Quote>
NCrunch was unable to restore Nuget packages required to build a test environment for this solution, due to an error: The msbuild command returned exit code 1: "c:\program files\microsoft visual studio\2022\enterprise\MSBuild\Current\Bin\msbuild.exe" /t:Restore "C:\Users\dirk_\AppData\Local\NCrunch\21904\PackageRestore\restorePackages.csproj"

The following packages do not exist under the Nuget packages folder for the active user profile, yet they have been flagged by NCrunch as potentially needed for normal operation. NCrunch has attempted to restore these files via an MSBuild restore step, which has either failed or not returned the expected result. It's possible that these packages may not be needed for building projects or running tests in your environment. If you experience downstream problems with NCrunch on this solution, it is recommended you restore or download the packages manually.

Note that the restore of packages may fail if NCrunch is being hosted under a windows account that does not have sufficient rights to store files in the Nuget packages directory.System.Collections.NonGeneric v4.3.0
System.Runtime.Loader v4.3.0
System.Runtime.Serialization.Formatters v4.3.0
System.Runtime.Serialization.Primitives v4.3.0
System.Threading.Thread v4.3.0
System.Collections.NonGeneric v4.3.0
System.Runtime.Loader v4.3.0
System.Runtime.Serialization.Formatters v4.3.0
System.Runtime.Serialization.Primitives v4.3.0
System.Threading.Thread v4.3.0
System.Collections.NonGeneric v4.3.0
System.Runtime.Loader v4.3.0
System.Runtime.Serialization.Formatters v4.3.0
System.Runtime.Serialization.Primitives v4.3.0
System.Threading.Thread v4.3.0
System.Collections.NonGeneric v4.3.0
System.Runtime.Loader v4.3.0
System.Runtime.Serialization.Formatters v4.3.0
System.Runtime.Serialization.Primitives v4.3.0
System.Threading.Thread v4.3.0
System.Collections.NonGeneric v4.3.0
System.Runtime.Loader v4.3.0
System.Runtime.Serialization.Formatters v4.3.0
System.Runtime.Serialization.Primitives v4.3.0
System.Threading.Thread v4.3.0
System.Collections.NonGeneric v4.3.0
System.Runtime.Loader v4.3.0
System.Runtime.Serialization.Formatters v4.3.0
System.Runtime.Serialization.Primitives v4.3.0
System.Threading.Thread v4.3.0
System.Threading.Thread v4.0.0
System.Collections.NonGeneric v4.3.0
System.Collections.Specialized v4.3.0
System.ComponentModel v4.3.0
System.ComponentModel.Primitives v4.3.0
System.ComponentModel.TypeConverter v4.3.0
System.Runtime.Loader v4.3.0
System.Runtime.Serialization.Formatters v4.3.0
System.Runtime.Serialization.Primitives v4.3.0
System.Threading.Thread v4.3.0
System.Collections.NonGeneric v4.3.0
System.Collections.Specialized v4.3.0
System.ComponentModel v4.3.0
System.ComponentModel.Primitives v4.3.0
System.ComponentModel.TypeConverter v4.3.0
System.Runtime.Loader v4.3.0
System.Runtime.Serialization.Formatters v4.3.0
System.Runtime.Serialization.Primitives v4.3.0
System.Threading.Thread v4.3.0
System.Collections.NonGeneric v4.3.0
System.Collections.Specialized v4.3.0
System.ComponentModel v4.3.0
System.ComponentModel.Primitives v4.3.0
System.ComponentModel.TypeConverter v4.3.0
System.Runtime.Loader v4.3.0
System.Runtime.Serialization.Formatters v4.3.0
System.Runtime.Serialization.Primitives v4.3.0
System.Threading.Thread v4.3.0
System.Collections.NonGeneric v4.3.0
System.Collections.Specialized v4.3.0
System.ComponentModel v4.3.0
System.ComponentModel.Primitives v4.3.0
System.ComponentModel.TypeConverter v4.3.0
System.Runtime.Loader v4.3.0
System.Runtime.Serialization.Formatters v4.3.0
System.Runtime.Serialization.Primitives v4.3.0
System.Threading.Thread v4.3.0
xunit.runner.utility v2.4.1
System.Collections.NonGeneric v4.3.0

Click here to remove this error

</Quote>

So I continued what you told me to do to fix the issue.
Except the dummy libary I added, did not compile.
Look around and around. Then found my nuget sources were blank (only the vs offline nuget source)
I added nuget.org again (from here https://stackoverflow.co...package-sources-missing)
Then everything compiled.

Before compilation I removed my dummy library so that that issue "would remain the same".
But ncrunch then found everything.

So the dummy library in itself was not the catalyst in solving the issue, it was the catalyst in finding the source of the problems.
And it was the missing nuget source nuget.org . (in my case)

Thx for the tip...

Remco
#5 Posted : Tuesday, April 18, 2023 2:06:02 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Thanks for sharing these extra details. This is very interesting. We actually got hit with this issue too (outside of NCrunch) when building some new environments recently. It seems that MS have started shipping versions of VS that sometimes don't have a package source configured on a clean install.

If they continue to do this, maybe there's something we can do to modify this error so it gives a better idea of how to solve the problem. In our own case, VS was failing to resolve things long before we had NCrunch set up, so we knew where to look. The unfortunate issue with our current restore step is that 'error code 1' doesn't really tell us anything about why the restore step failed.

I'm glad you are up and running.
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.086 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download