Daily Usage Issues

NCrunch seems to occasionally lock folders in projects making the folders impossible to rename

Started by ljohnston on 8,128 views

Sometimes while working with a project that has NCrunch enabled if I attempt to rename a folder I'll get the Visual Studio message: "Cannot rename 'MyFolder'. The process cannot access the file because it is being used by another process.

If I use LockHunter to see which processes have the folder locked it will show that devenv.exe (the instance with the project loaded) has the folder locked.

I believe it's actually NCrunch that's locking the folder because if I disable NCrunch then the lock immediately goes away. When I re-enable NCrunch the lock comes back.

NCrunch doesn't seem any given folder all the time, but when it does lock them it seems to do so for an arbitrarily long time, meaning I have to disable NCrunch if I want to rename the folder. I'm not sure what causes it to lock or not lock a folder. It seems to happen pretty regularly, but not all the time (often enough to be quite frustrating, not often enough to claim I can easily reproduce it for you).

This is particularly frustrating if I'm using git for source control, because switching to a branch will often involve renaming/adding/deleting folder(s) within a project, so when this issue occurs it makes it impossible to switch branches without disabling NCrunch first. (To be clear I'm seeing this even attempting to rename the folders manually in VS, not only when git is attempting to make changes.)

Could this be a bug in NCrunch? If it could be, is this enough information to track it down? If there's additional information you need I'll try to provide it. I can't provide the entire projects I'm currently working with.

Edited

Yes - this is a known issue. It is tied to the method NCrunch is using to watch for file changes inside these folders.

The problem can be reproduced by attempting to rename a project sub-folder that contains other folders. It won't happen for folders that don't contain other nested folders.

A fix is planned. To work around the problem, simply temporarily disable the engine (as you've described).

Edited

Thanks for the reply. A fix to this would be most appreciated. Do you anticipate the fix will make it into the next version?

There's a bit already in the next version ... so it's tough to make promises, but I'll see what I can do.
Thanks. I understand you can't make any promises and I appreciate you being willing to look into it.
It's been 2 years and problem still happens
Is there way to make NCrunch NOT lock any folders and still track changes?
We have an independent build system that randomly errors out because of this.
Enabling & disabling NCrunch is the last resort
Hi,

Unfortunately, the locking of folders is a consequence of watching them for changes. My understanding is that this is an O/S level constraint. NCrunch does its best to try and watch for changes only using high-level folders, but if your solution/build structure is such that you have root level folders being changed by the build, there isn't going to be anything that NCrunch can do to avoid the locks. I'm sorry, but you will likely either need to change your solution structure or your build system to resolve this problem. I haven't yet found a way to completely fix this problem in NCrunch.

Edited

Post a reply

Log in to reply.