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

Notification

Icon
Error

Running NCrunch under Local System account
memark
#1 Posted : Sunday, November 15, 2015 9:56:35 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/26/2014(UTC)
Posts: 9
Location: Sweden

Thanks: 4 times
Was thanked: 3 time(s) in 3 post(s)
I'm trying to set up NCrunch with my TeamCity server. My build agent is running under the Local System account, which seems to cause problems for NCrunch.

Running the NCrunch Console Tool from a command line as a normal user works fine. My solution compiles and all tests are run successfully.

Running the NCrunch Console Tool from a command line as Local System gives an error

Quote:
[10:38:58.2328-LocalBuildTask-5] ERROR (Build): NCrunchTest: (0): NCrunch was unable to parse this project file because of an unexpected error: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Windows\system32\config\systemprofile\AppData\Local\NCrunch\2588\1\NCrunchTest'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.SetCurrentDirectory(String path)
at nCrunch.Compiler.RemoteBuildRunner.(ComponentBuildParameters )
at nCrunch.Compiler.RemoteBuildRunner.Build(ComponentBuildParameters parameters)


Examining the detailed log, we can see that files are in fact being copied to this directory, so it seems to exist. Some examples of successful events
Quote:
[10:38:57.9431-LocalBuildTask-5] Building new workspace C:\Windows\system32\config\systemprofile\AppData\Local\NCrunch\2588\1 for component NCrunchTest in context of grid client (local)
[10:38:57.963-LocalBuildTask-5] Writing new workspace member C:\Windows\system32\config\systemprofile\AppData\Local\NCrunch\2588\1\NCrunchTest\Properties\AssemblyInfo.cs (version 1)
[10:38:57.983-LocalBuildTask-5] Copying assembly reference C:\Users\coll-loans-bld\Desktop\NCrunchTest\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll into workspace at C:\Windows\system32\config\systemprofile\AppData\Local\NCrunch\2588\1\_ncrunchreferences\xunit.abstractions.dll (BCL=False)


Please see provided log file.
https://www.dropbox.com/...h-detailed-log.txt?dl=0

Windows Server 2012 R2 Datacenter
NCrunch Console Tool 2.17.0.16

Any idea what the problem might be? Is it related to permissions? Is the folder path simply too long? Is it possible to reconfigure NCrunch to store its workspace somewhere else?

(Not sure how to open a command prompt under Local System? Just download Sysinternals and run "psexec -s cmd" in an elevated prompt.)
Remco
#2 Posted : Sunday, November 15, 2015 12:01:12 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Hi,

I think this is a permissions related issue. It looks as though the NCrunch engine has no trouble creating or accessing this directory (the workspace), but as soon as it tries to access the directory in a build runner process, it can't open it.

The cleanest way to solve this would probably be to set a custom path for your workspace base path. You can do this in your NCrunch configuration file ('WorkspaceBasePath' in the XML). Set the value to a known path, ideally close to the root of your disk (i.e. C:\NCrunchWorkspaces). You can then create the directory yourself and assign a broader set of permissions to it. NCrunch won't ever delete the workspace base path, so this should be a permanent fix (assuming it solves the problem).
1 user thanked Remco for this useful post.
memark on 11/15/2015(UTC)
memark
#3 Posted : Sunday, November 15, 2015 1:01:08 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/26/2014(UTC)
Posts: 9
Location: Sweden

Thanks: 4 times
Was thanked: 3 time(s) in 3 post(s)
Thank you, that worked! I didn't even have to create the directory (since Local System already has high permissions).

However, I would still encourage you to look into this issue. Running TeamCity as Local System is pretty common, and solving this would make integrating NCrunch into TeamCity much easier for a lot of users.
1 user thanked memark for this useful post.
Remco on 11/15/2015(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.032 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download