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

Notification

Icon
Error

2 Pages12>
Error occurred while analysing project
cbondeson
#1 Posted : Thursday, March 09, 2017 6:11:47 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/9/2017(UTC)
Posts: 7
Location: United States of America

I have a very simple project that is not running correctly in NCrunch. This is the error I am receiving:
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: nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The connection has been closed
at nCrunch.Core.ProcessManagement.ExternalProcessManager.(ProcessorArchitecture , ProcessLoadParameters )
at nCrunch.Core.ProcessManagement.ExternalProcessManager.LoadExternalProcess(ProcessLoadParameters parameters, GridClientId client)
at nCrunch.Core.TestManagement.TestRunnerProcess..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Core.TestManagement.TestRunnerProcess.(Boolean , FilePath , GridClientId , CustomEnvironmentVariable[] )
at nCrunch.Core.TestManagement.TestRunnerProcess..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Core.Processing.AnalysisTaskLogic.DoProcessTaskAndReturnSuccessFlag()

I am using NCrunch 3.5.0.1 with the released version of VS2017 Enterprise. The project is actually a series of base libraries I am going to be using for unit testing. The project is a .netstandard project with a target framework of 1.6. It is referencing NETStandard.Library v1.6.1, NUnit v3.6.1 and NSubstitute v2.0.2.

Let me know any other information you might need and I will do my best to give it to you. Any work around or help would be great.
Remco
#2 Posted : Thursday, March 09, 2017 8:49:55 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 587 times
Was thanked: 667 time(s) in 638 post(s)
Hi, thanks for sharing this problem.

To use this project with NCrunch, you'll need to either retarget it to netcoreapp or disable the NUnit integration with it by turning this off in your NCrunch project-level settings.

NCrunch cannot construct a test environment for a netstandard project because when the project is built to target this platform, it does not have the necessary package bindings that would allow it to run independently. netstandard projects are designed to be loaded via references from other projects (i.e. netcoreapp, .net 461, etc). This makes them unsuitable as test projects.
cbondeson
#3 Posted : Thursday, March 09, 2017 9:00:25 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/9/2017(UTC)
Posts: 7
Location: United States of America

The test project is a dotnetcore DLL, the project I am trying to test is a dotnetstandard DLL. Is there a way to configure NCrunch to work with this kind of project structure? The reference project will be packaged and used as a nuget package and I would like to keep it a dotnetstandard DLL.
Remco
#4 Posted : Thursday, March 09, 2017 9:15:07 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 587 times
Was thanked: 667 time(s) in 638 post(s)
cbondeson;9913 wrote:
The test project is a dotnetcore DLL, the project I am trying to test is a dotnetstandard DLL. Is there a way to configure NCrunch to work with this kind of project structure? The reference project will be packaged and used as a nuget package and I would like to keep it a dotnetstandard DLL.


Sorry, I misunderstood. Yes, this structure should work with NCrunch. I have a bug report submitted for a similar looking problem that went through about an hour before this forum post - is this your report?

The problem itself is appearing when NCrunch tries to initialise a test process under .NET Core. The process exits immediately on startup, yielding no error information.

Would you be able to check if there are any exceptions in your Windows event viewer?

Where I've seen this previously, it's been due to dependency issues. This forum thread gives details about a series of dependency issues encountered in the first test build of NCrunch under .NET Core. It may be be worth checking through this to see if you're experiencing the same problem and perhaps the fix for it hasn't taken properly.
cbondeson
#5 Posted : Thursday, March 09, 2017 9:22:02 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/9/2017(UTC)
Posts: 7
Location: United States of America

That was not my bug report, I wanted to make sure I had not done something wrong before creating one. I checked my event viewer and did not see anything logged under Application log, is there another log you would like me to check? I will also check the link thread to see if that will give me any ideas on how to fix this.

EDIT: I checked the thread and verified that all the specified libraries do exist in the .nuget folder.
Remco
#6 Posted : Thursday, March 09, 2017 9:35:02 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 587 times
Was thanked: 667 time(s) in 638 post(s)
Is there any chance you can reproduce the problem using a test project that you can share with me? If I can get the problem to happen in my own environment, I may be able to extract more information from the process before it dies.
cbondeson
#7 Posted : Thursday, March 09, 2017 9:44:47 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/9/2017(UTC)
Posts: 7
Location: United States of America

Yes I think I can pair it down to the most basic. How would you like me to send it to you?
Remco
#8 Posted : Friday, March 10, 2017 3:35:19 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 587 times
Was thanked: 667 time(s) in 638 post(s)
cbondeson;9918 wrote:
Yes I think I can pair it down to the most basic. How would you like me to send it to you?


Yes!! Thanks! Can you submit it through the contact form?
cbondeson
#9 Posted : Friday, March 10, 2017 2:58:50 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/9/2017(UTC)
Posts: 7
Location: United States of America

I have created the request. I have tagged your name in the description with a link to this thread.
Remco
#10 Posted : Saturday, March 11, 2017 6:12:50 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 587 times
Was thanked: 667 time(s) in 638 post(s)
Thanks! There are two problems I've identified using the sample you've submitted.

The first problem (that you've described above) appears when NCrunch tries to construct an environment to discover NUnit tests in the NetStandard assembly. As described earlier, NCrunch can't actually build a test environment under NetStandard, since this is a portable target that is expected to work only when referenced by more specific targets (such as .NET Core). Since this is actually a reference library and shouldn't contain any true tests anyway, the solution to this problem is to set the 'Enable NUnit3' NCrunch project-level configuration setting for this project to 'False'. NCrunch then won't try to discover tests and it won't blow up on this project.

The second problem is more complicated. This is a dependency related issue where NCrunch hasn't been constructing the .deps file for the test environment correctly. I've implemented a targeted fix for this in the build below. I'd love to hear if it solves the problem for you:

http://downloads.ncrunch.net/NCrunch_Console_3.6.0.1.msi
http://downloads.ncrunch.net/NCrunch_Console_3.6.0.1.zip
http://downloads.ncrunch.net/NCrunch_GridNodeServer_3.6.0.1.msi
http://downloads.ncrunch.net/NCrunch_GridNodeServer_3.6.0.1.zip
http://downloads.ncrunch.net/NCrunch_LicenseServer_3.6.0.1.zip
http://downloads.ncrunch.net/NCrunch_VS2008_3.6.0.1.msi
http://downloads.ncrunch.net/NCrunch_VS2010_3.6.0.1.msi
http://downloads.ncrunch.net/NCrunch_VS2010_3.6.0.1.zip
http://downloads.ncrunch.net/NCrunch_VS2012_3.6.0.1.msi
http://downloads.ncrunch.net/NCrunch_VS2012_3.6.0.1.zip
http://downloads.ncrunch.net/NCrunch_VS2013_3.6.0.1.msi
http://downloads.ncrunch.net/NCrunch_VS2013_3.6.0.1.zip
http://downloads.ncrunch.net/NCrunch_VS2015_3.6.0.1.msi
http://downloads.ncrunch.net/NCrunch_VS2015_3.6.0.1.zip
http://downloads.ncrunch.net/NCrunch_VS2017_3.6.0.1.msi
http://downloads.ncrunch.net/NCrunch_VS2017_3.6.0.1.zip
cbondeson
#11 Posted : Saturday, March 11, 2017 4:10:45 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/9/2017(UTC)
Posts: 7
Location: United States of America

Do I need to install all of these MSIs?
Remco
#12 Posted : Saturday, March 11, 2017 9:39:25 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 587 times
Was thanked: 667 time(s) in 638 post(s)
cbondeson;9939 wrote:
Do I need to install all of these MSIs?


Only install the one(s) relevant to you. My expectation is that you'll probably only want the VS2017 MSI.

I always provide a full set of installers with every build in case people are using multiple components and want to keep their versioning consistent.
cbondeson
#13 Posted : Sunday, March 12, 2017 3:47:28 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/9/2017(UTC)
Posts: 7
Location: United States of America

Thank you very much Remco that worked after I disabled the "NUnit v3+ Enabled" setting under "Test Frameworks" for my dotnetstandard reference project. When do you foresee this being placed into a full release?
Remco
#14 Posted : Sunday, March 12, 2017 9:01:54 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 587 times
Was thanked: 667 time(s) in 638 post(s)
cbondeson;9942 wrote:
Thank you very much Remco that worked after I disabled the "NUnit v3+ Enabled" setting under "Test Frameworks" for my dotnetstandard reference project. When do you foresee this being placed into a full release?


Great, thanks for confirming this!

I'd like to put v3.6 out around the middle of the week if possible. It depends on other critical fixes, as I'm still waiting for information on some other problems people are having. The build above should be fairly stable as it doesn't contain much over v3.5. I wouldn't have any reservations about recommending it for production use, assuming it is still working for you.
Remco
#15 Posted : Wednesday, March 15, 2017 4:38:48 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 587 times
Was thanked: 667 time(s) in 638 post(s)
A fix for this is now out with v3.6.
Lawrence
#16 Posted : Thursday, March 16, 2017 11:04:49 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/14/2016(UTC)
Posts: 3
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
I'm seeing this same error now on my build box and I'm running 3.6.0.2 of the console app. However I'm using xUnit and VS2105
Remco
#17 Posted : Thursday, March 16, 2017 11:11:02 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 587 times
Was thanked: 667 time(s) in 638 post(s)
Lawrence;9982 wrote:
I'm seeing this same error now on my build box and I'm running 3.6.0.2 of the console app. However I'm using xUnit and VS2105


Hi, thanks for sharing this problem.

The exception message given at the top of this thread is a very broad message given for when NCrunch has trouble building a runtime environment for .NET Core.

Given that you're seeing this under the console tool, I'm wondering if this is being caused by a critical dependency not being installed on your build server.

Do you have VS2017 installed on the build server? If so, does running NCrunch (the VS plugin) over your solution on the build server for a single pass allow the console tool to subsequently start working? The package restore steps in the VS plugin are a bit better tested than in the console tool, so I think there is a chance this may solve the problem.
Lawrence
#18 Posted : Friday, March 17, 2017 4:53:50 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/14/2016(UTC)
Posts: 3
Location: United States of America

Was thanked: 1 time(s) in 1 post(s)
My bad. I didn't describe this well at all. I'm running VS2015 on a with a Target Framework of 4.6.1 using xUnit tests. The build box only has VS2015 community edition installed on it and doesn't have the VS plugin installed. Before a call ncrunch I have my Fake script restore and build the package to do static analysis and such, so the console app shouldn't be having to restore anything.

But with that said I got it working. The Console App now has to have .net 4.6.2 framework installed to work even if you're only using a 4.6.1 project.

Sorry to bug you about this. I should have caught this before posting the issue.

Hopefully my mistake will help others understand the error if they see it.

Thanks for the help
1 user thanked Lawrence for this useful post.
Remco on 3/17/2017(UTC)
jonsequitur
#19 Posted : Friday, May 19, 2017 3:52:59 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 5/18/2017(UTC)
Posts: 5
Location: United States of America

I'm seeing this same error across all .NET Core projects on my machine. I'm using VS2017 and the tests use xunit.

It seems to have been triggered by clearing my Nuget package caches. NCrunch began showing an error indicating "Unable to restore required Nuget packages for .NET Core test environment." The output for this error is (for example):

Code:
NCrunch was unable to restore Nuget packages required to build a test environment for this project, due to an unspecified failure when invoking 'dotnet.exe restore'

The following packages need to be restored because they do not exist under the Nuget packages folder for this user profile:

system.diagnostics.debug v4.3.0
system.diagnostics.debug v4.3.0
system.diagnostics.debug v4.3.0
system.diagnostics.debug v4.3.0
system.diagnostics.debug v4.3.0
system.diagnostics.debug v4.3.0
system.diagnostics.debug v4.3.0
system.diagnostics.debug v4.3.0

Click here to remove this error


I can make this error go away by manually placing the restored packages but I still see "Analysis failure" for every test project, with the following output:

Code:


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: nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The connection has been closed
   at nCrunch.Core.ProcessManagement.ExternalProcessManager.(ProcessorArchitecture , ProcessLoadParameters )
   at nCrunch.Core.ProcessManagement.ExternalProcessManager.LoadExternalProcess(ProcessLoadParameters parameters, GridClientId client)
   at nCrunch.Core.TestManagement.TestRunnerProcess..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.Core.TestManagement.TestRunnerProcess.(Nullable`1 , FilePath , GridClientId , CustomEnvironmentVariable[] )
   at nCrunch.Core.TestManagement.TestRunnerProcess..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.Core.Processing.AnalysisTaskLogic.DoProcessTaskAndReturnSuccessFlag()



Remco
#20 Posted : Friday, May 19, 2017 11:20:14 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 587 times
Was thanked: 667 time(s) in 638 post(s)
Hi, thanks for sharing this problem.

When NCrunch builds a .NET Core task environment, this environment has a dependency on a range of common Nuget packages. These packages are usually automatically downloaded by NCrunch when it first encounters a .NET Core project. It looks like this just wasn't possible on your machine, perhaps because of a network connection issue.

If the packages don't exist and cannot be downloaded, the .NET Core task runner will immediately fail internally and be unable to report its error back to the engine. To try and prevent this problem, NCrunch will usually report missing known packages prior to attempting to initialise the environment. It looks like in this case there is a core dependency on something that should normally be on your machine but just isn't, and the engine isn't aware of it to be able to report on it.

Try creating a new .NET Core project in a new solution and target it towards .NET Core 1.0, then build this in Visual Studio. The package manager should automatically download any critical dependencies and hopefully NCrunch will work afterwards.
Users browsing this topic
Guest
2 Pages12>
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.117 seconds.