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

Notification

Icon
Error

Issues building project, possibly related to SRP
Axima
#1 Posted : Sunday, August 13, 2017 10:40:13 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/13/2017(UTC)
Posts: 15
Location: Australia

Thanks: 4 times
Was thanked: 3 time(s) in 3 post(s)
I have just recently upgraded to VS 2017 from VS 2013.
This involved moving up a patch level with NCrunch and installing via the 2017 installer.

On VS 2013 everything was working ok, but on VS 2017 I am finding that most projects fail to load, with the following exception:

Code:
System.InvalidOperationException: No process is associated with this object.
   at System.Diagnostics.Process.EnsureState(State state)
   at System.Diagnostics.Process.EnsureState(State state)
   at System.Diagnostics.Process.get_Id()
   at nCrunch.Core.ProcessManagement.ExternalProcessManager.(ExternalProcess )
   at nCrunch.Core.ProcessManagement.ExternalProcessManager.(ProcessorArchitecture , ProcessLoadParameters )
   at nCrunch.Core.ProcessManagement.ExternalProcessManager.LoadExternalProcess(ProcessLoadParameters parameters, GridClientId client)
   at nCrunch.Core.BuildManagement.BuildProcessLauncher..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TryTrackActivity(String name, Action activity)
   at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , ProcessorArchitecture , GridClientId , BuildSystemParameters , IList`1 )
   at nCrunch.Core.BuildManagement.BuildProcessLauncher.AnalyseComponentBuildInExternalProcess(ComponentLoadParameters parameters, IList`1 customEnvironmentVariables)
   at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.(ProcessorArchitecture , 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)


Our company has SRP (Software Restriction Policies) in place, which when temporarily disabled allow the project to load and build in NCrunch without issue.

I can add local SRP rules to make an exception for NCrunch, but profiling using Process Monitor I was unable to determine exactly what executable/path is being blocked, and i'm not sure if this is the correct solution to the problem.

Can anybody shed any more light on this issue, or point me in the right direction for further debugging?

Thanks,
Axima
#2 Posted : Sunday, August 13, 2017 10:50:16 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/13/2017(UTC)
Posts: 15
Location: Australia

Thanks: 4 times
Was thanked: 3 time(s) in 3 post(s)
On examination of the event log I found multiple events like the following:

Code:
Access to C:\Users\{username}\AppData\Local\NCrunch\BuildSystem\840\VS2017\nCrunch.BuildHost462.x86.exe has been restricted by your Administrator by the default software restriction policy level.
Access to C:\Users\{username}\AppData\Local\NCrunch\BuildSystem\8952\VS2017\nCrunch.BuildHost462.x86.exe has been restricted by your Administrator by the default software restriction policy level.


This looks like the source of the problem.
I can add a SRP path rule in for C:\Users\{username}\AppData\Local\NCrunch\BuildSystem\*\VS2017\*.exe, however is this what is normally recommended?
Did something change between the VS 2013 and VS 2017 extensions that causes this issue?
Remco
#3 Posted : Sunday, August 13, 2017 11:53:00 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 930 times
Was thanked: 1257 time(s) in 1170 post(s)
Axima;10973 wrote:

This looks like the source of the problem.
I can add a SRP path rule in for C:\Users\{username}\AppData\Local\NCrunch\BuildSystem\*\VS2017\*.exe, however is this what is normally recommended?
Did something change between the VS 2013 and VS 2017 extensions that causes this issue?


Yes, your analysis here is correct. Under VS2017, NCrunch's build integration works differently because MSBuild assemblies aren't installed in the GAC. This means that the buildhost needs to have dynamically constructed binding redirections to the MSBuild assemblies so that build tasks can find them. To make this work, NCrunch sandboxes the build executable.

I have no solid experience with SRP rules, but I believe your solution is the right one. NCrunch needs to be able to launch .EXEs from the above path, otherwise it won't be able to build your projects.
Axima
#4 Posted : Sunday, August 13, 2017 11:58:21 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/13/2017(UTC)
Posts: 15
Location: Australia

Thanks: 4 times
Was thanked: 3 time(s) in 3 post(s)
Ok thanks.

I have implemented the above rule, and NCrunch looks to be working correctly.
1 user thanked Axima for this useful post.
Remco on 8/14/2017(UTC)
Peska
#5 Posted : Tuesday, January 9, 2018 7:27:43 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/9/2018(UTC)
Posts: 4
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I have the same problem, but unfortunately I cannot apply any rules to my local machine. Is there a way to change this directory? I tried to set up "Workspace base path" in my NCrunch Configuration, but it doesn't have any effects.
Remco
#6 Posted : Tuesday, January 9, 2018 11:03:16 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 930 times
Was thanked: 1257 time(s) in 1170 post(s)
Peska;11672 wrote:
I have the same problem, but unfortunately I cannot apply any rules to my local machine. Is there a way to change this directory? I tried to set up "Workspace base path" in my NCrunch Configuration, but it doesn't have any effects.


Hi, I'm sorry to hear this is the case.

The directory itself is hard-coded. It's normally safe for software to assume that it can store data in its own directory under your local user profile. Without any way to adjust your SRP, I'm not sure how to solve this problem for you. NCrunch needs to have a transient location to store these files, and the workspace base path isn't the appropriate place.
Peska
#7 Posted : Wednesday, January 10, 2018 7:18:02 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/9/2018(UTC)
Posts: 4
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I contacted my security department and they were able to add exception in the rules on my local machine. That solved all my problems. Thanks.
1 user thanked Peska for this useful post.
Remco on 1/10/2018(UTC)
Axima
#9 Posted : Thursday, May 2, 2019 10:36:53 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/13/2017(UTC)
Posts: 15
Location: Australia

Thanks: 4 times
Was thanked: 3 time(s) in 3 post(s)
So I just had this problem again after upgrading to 2019.
Came to the forums to search for an answer and came across my own post!
I modified the SRP above to replace VS2017 with a * wildcard and everything is working now.
Remco
#10 Posted : Thursday, May 2, 2019 10:59:28 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 930 times
Was thanked: 1257 time(s) in 1170 post(s)
We have actually included a change in the latest release to allow you to change the directory used by NCrunch for its build hosts.

If you set your 'Workspace base path' configuration setting to somewhere else (that is allowed under SRP), you hopefully won't have this problem again.
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.063 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download