I'm working with my team on a fairly large web project, with thousands of tests, and we are trying out NCrunch to see if it can help us as we are working in TDD. The tool looks very promising and we are excited with what we have seen yet.
Sadly, some assemblies aren't covered as NCrunch fails to build them. Some others have question marks on them.
Here is an error we are getting, which seems to be the root problem:
Any idea? Thanks you!
System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
at System.IO.Path.SafeSetStackPointerValue(Char* buffer, Int32 index, Char value)
at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck)
at System.IO.Path.GetFullPathInternal(String path)
at System.IO.Path.GetFullPath(String path)
at nCrunch.Core.ComponentLoader.SnapshotComponentFactory.#=qqd2JX6h79gzNyuwEGEi_zv_71GiUVNyNTQI2Ii0izVw=(String #=qje9ub4E0cNgQGa3PH0irpw==)
at nCrunch.Core.ComponentLoader.SnapshotComponentFactory.#=qhzH3fDgeMQNy$Q7f19YshrzzdhorlM05yRGA_P$fQ6c=()
at nCrunch.Core.ComponentLoader.SnapshotComponentFactory.CreateSnapshotComponentFromXml(String projectFilePath, String projectXml, String solutionFilePath)
I tried setting the WorkspaceBasePath property in configuration, but it didn't solve the problem. We have a lot of subfolders to structure our projects, so the paths are, as a matter of fact, probably long, but I can't change that. Is there someway to solve this, or is it simply a bug?
Thanks for posting! This exception is being thrown from the project loader in NCrunch - so while changing the WorkspaceBasePath is definitely a good idea (and should be done for a project like this), know that this issue will occur before NCrunch goes to construct workspaces.
You can probably solve this issue by moving your project directory further up in the file structure. The issue is likely caused by at least one file within your solution that has an exceptionally long name - watch out for generated files such as WCF service references, as the names of these can get out of hand (and many of them are not actually required to be included in your project at all!). There are many tools that have issues with long file paths (such as SVN etc), so I would not be surprised if you experience other non-NCrunch related issues with this.
Naming the file in cause in the stacktrace would make it so much easier to find the cause.
Unfortunately we can't change the structure of directories now, since the projects are deployed on dozens of computers. We don't have any other issues with pathnames as of now, so we'll have to live with that for a bit.
I wish I could offer you a fix, but I don't doubt that there will be many areas within NCrunch's engine where such a long path will cause problems. I'll make a note to improve the error message so it's more informative and will also give you the name of the problematic file.
I've taken a deeper look at this, and it may be fixable. NCrunch 1.35b isn't efficiently using the entire path space of 260 characters - which means your path may be slightly under this limit but NCrunch is pushing it above. I've implemented a fix in 1.36b, and I think it would be good to give this a try when it's released to see if it solves your problem. 1.36b is due for release within the next few days. I'll keep you posted.
Remco wrote:The fix for the above problem has now been released as part of 1.36b. Please let me know if this solves the problem for you.
Awesome! The new message helped us to dig out a problem in some .vbproj, where a specific reference was registered with an absolute path instead of a relative path. This path was very long due to our heavy hierarchy, and caused the PathTooLongException.
Thanks a lot for this. Quick answer, good communication, quick solution. We will definitely be using NCrunch from now on, and follow its evolution!