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

Notification

Icon
Error

DLLs Copied to project(s) root directory
gatapia
#1 Posted : Monday, March 5, 2012 4:52:42 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/29/2012(UTC)
Posts: 4
Location: Australia

Was thanked: 2 time(s) in 2 post(s)
Hi I'm trying out ncrunch (1.37.0.46b) and am seeing strange behaviour.

For some reason some DLLs are copied to the project root directory of both the test projects and the projects being tested. Its not all dlls just some, such as:
Ninject.dll
NHibernate.dll

This is all I've run into so far.

I haven't been able to identify why/when/where this happens all I know is I go to commit and I have these extra files there.

I've tried deleting the files, forcing NCrunch to run but the files do not get copied. Yet, I'll go and do something else and somehow, sometimes these dlls make an appearance again. The only thing that has changed in my life recently is ncrunch so I assume its that. Has this been reported before (I searched forum but found nothing).

Thanks and great work on this project
Remco
#2 Posted : Monday, March 5, 2012 7:42:14 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for posting!

I've also seen this happen and have had others report it. It's a mystery bug that appears randomly then disappears just as randomly ... I've been trying to track it down but the inconsistency makes reproduction difficult.

My suspicion is that it's happening when NCrunch is first loading the projects (i.e. after it is first enabled), though this is just a theory and I have nothing to back it up.

If you can share any information about the usage pattern causing this, that would be awesome.


Thanks!

Remco
1 user thanked Remco for this useful post.
sperekrestov on 4/13/2012(UTC)
Balfa
#3 Posted : Thursday, January 3, 2013 10:16:09 PM(UTC)
Rank: Member

Groups: Registered
Joined: 12/7/2011(UTC)
Posts: 14
Location: Dallas

Thanks: 2 times
Was thanked: 2 time(s) in 2 post(s)
This happens to me fairly frequently ever since I started using NCrunch over a year ago. I've seen DLLs randomly appear in both the solution root directory (which contains no .csproj) and in project root directories, but it seems to happen more often on the solution level. I'm not sure I've ever seen a Test project DLL appear there, as gatapia describes, but I have seen both 3rd party DLLs (NHibernate, etc.) and my own DLLs for other projects inside the solution either directly being tested, or used by the project being tested.

Just now, I refreshed my working directory in source control (TortoiseHg), saw nothing out of the ordinary, then did a rebuild-all on the solution, and closed VS. Refreshing the working directory again showed NHibernate.dll, NHibernate.pdb, Iesi.Collections.dll and Iesi.Collections.xml all appeared in my solution directory.
Remco
#4 Posted : Thursday, January 3, 2013 10:52:19 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
I've since done more looking into this issue. It's been proving extremely difficult to track down, because it occurs in very few environments and when it does occur, it is always intermittent.

The issue itself seems to be tied to overlapping builds between Visual Studio and NCrunch. Somehow there is state being shared between the builds, and they interfere with each other. v1.40 of NCrunch introduced a feature that deliberately pauses all background building while Visual Studio runs a foreground build, with the intention of reducing (or eliminating) the possibility of these overlaps.

Unfortunately, the overlapping logic is within MSBuild itself, rather than the NCrunch code, which adds to the ambiguity around the issue and makes it that much harder to understand.

Something that may solve the problem in your situation is to look for derived files from your build that trigger NCrunch to start its own build. NCrunch will track all files that are included in projects within your solution, and files that have been included using the 'Additional files to include' configuration settings. If any of these files are changed on disk, NCrunch will kick off a background build of projects that include the changed files. If you have a file that is included by NCrunch and is somehow being changed as a result of your foreground build, then this can cause builds between NCrunch and Visual Studio to overlap. You should be able to spot when this issue exists, as a build of your solution in Visual Studio will visibly trigger NCrunch to start a build.

gareththackeray
#5 Posted : Monday, February 11, 2013 6:09:25 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/11/2013(UTC)
Posts: 4
Location: United Kingdom

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hi,

Just wondering if you'd made any progress with this issue?

We have a post-build event that copies the built binaries (and PDBs) into a "references" folder, from where they can be referenced by other solutions.

When we do a normal build of a project, the copying of the binaries triggers an nCrunch build/run, which causes those binaries to be copied into the solution root as well.

So I was wondering:

1. have you made any progress on fixing this issue fully?

2. I don't understand why copying foo.dll into the references folder would trigger ncrunch - other projects in the solution have a reference to other binaries in that folder, but not foo.dll.

Any help appreciated. I'm loving using ncrunch but this is a fairly big problem for us.

Thanks,

Gareth
Remco
#6 Posted : Monday, February 11, 2013 8:48:36 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Gareth -

Unfortunately I've still had no luck in reproducing this issue consistently, but I can give you some advice on how to find out which project is making use of the contents in the references folder.

There are a couple of quick ways you can do this -

1. Examine the NCrunch workspace built for each project in your solution. This workspace will contain all the files NCrunch has identified as being referenced by the project, deposited relative to the project file. If you notice DLLs stored in the workspace (from the references directory), that means that the project file is referencing those files. Check to make sure you don't have an 'Additional files to include' setting that is too broad, and that they aren't included specifically in the project file itself.

2. If you set the Logging Verbosity to 'Detailed', then reset the engine, you should be able to see the trace logs output by NCrunch when it's building the workspaces for each of your projects - if you look under the Processing Queue Window. Simply click on any of the build projects and you'll see a dump from the workspace builder in the bottom pane. This can help with narrowing down which projects are referencing these files

3. It may also be worth temporarily removing the files and performing a clean of your solution, then executing a build just to be sure none of the projects is referencing anything it shouldn't be
1 user thanked Remco for this useful post.
gareththackeray on 2/12/2013(UTC)
James Crowley
#7 Posted : Sunday, February 17, 2013 10:47:38 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/4/2012(UTC)
Posts: 2
Location: United Kingdom

This has just started occurring in my solution too - across several machines. It's limited to one assembly, and I'm also getting errors complaining about locking that have started at the same time:

"An error occurred while trying to copy a referenced assembly from 'C:\Development\FundApps\Rapptr\src\FundApps.Rapptr.Api\bin\Newtonsoft.Json.dll' to 'Newtonsoft.Json.dll'. Usually this is caused by file locking from processes outside of NCrunch's control.
(308)#0: Could not copy the file "C:\Users\James\AppData\Local\NCrunch\5496\14\FundApps.Rapptr.Api\..\CommonAssemblyInfo.default.cs" because it was not found.
"

and

An error occurred while trying to copy a referenced assembly from 'C:\Development\FundApps\Rapptr\build\bin\Debug\Newtonsoft.Json.dll' to 'Newtonsoft.Json.dll'. Usually this is caused by file locking from processes outside of NCrunch's control.
CSC (0)#0: Source file 'Controllers\AnnotationsControllerTests.cs' could not be found
CSC (0)#1: Source file 'Controllers\ManagedListsControllerTests.cs' could not be found
CSC (0)#2: Source file 'Controllers\ManagedListsContentControllerTests.cs' could not be found
CSC (0)#3: Source file 'Controllers\RuleControllerTests.cs' could not be found
CSC (0)#4: Source file 'Controllers\ViewAsCompanyControllerTests.cs' could not be found
CSC (0)#5: Source file 'Properties\AssemblyInfo.cs' could not be found

(resetting then works fine). Is there anything I can do to help you track this bug down? Not sure where the NCrunch "workspace" is you mention?
Remco
#8 Posted : Sunday, February 17, 2013 11:38:53 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi James -

I'm not yet sure whether the build problems you've described above are caused by the same problem being reported on this thread. Previously when people have reported this problem, it occurs only very infrequently and doesn't regularly cause build issues to appear. I'm wondering if you might be able to help with narrowing down the problem by answering the following questions -

How often do the build errors appear? Does it occur on most/all of your builds, or just occasionally throughout the day?

When the build error appears, does it require a reset before it goes away, or can you just continue working in your solution with any subsequent rebuild working correctly?

When you experience the build problem, is this in the Visual Studio build or the NCrunch build?

Are you running any integration tests that contain absolute file references back to your original solution path?

Are you running any integration tests that spawn child processes of any kind, or create locks on files that may not be released?

When you build your solution using Visual Studio, does this cause NCrunch to suddenly trigger and start running builds and tests?


Sorry for the barrage. There's a lot going on here, so it may take a little back and forward before we find a key piece of information to help analyse this problem. The documentation also has some great information about workspaces that would be worth reading if you're still becoming familiar with this concept.


Cheers,

Remco
Espresso
#9 Posted : Thursday, February 28, 2013 6:28:43 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/27/2013(UTC)
Posts: 4
Location: United States of America

Thanks: 2 times
I've also been seeing both of the problems referred to in this topic: periodically when doing checkins with TortoiseHg, I see a bunch of dlls in the roots of different projects. This just started in the past couple days after starting to use NCrunch again. So far I've just been deleting the un-versioned files and moving on, but it's an inconvenience.

I've also run into the file locking problem a few times in the past hour. Not always with full solution rebuilds, but it was in a couple instances. I believe that every time it occurred, I had multiple NCrunch threads working in the processing queue.

To your questions regarding the file locking:

Quote:
How often do the build errors appear? Does it occur on most/all of your builds, or just occasionally throughout the day?

occasionally

Quote:
When the build error appears, does it require a reset before it goes away, or can you just continue working in your solution with any subsequent rebuild working correctly?

sometimes NCrunch will sort itself out, but not until other projects have reason to build. Manual rebuilds in the NCrunch test window seem to fix it also.

Quote:
When you experience the build problem, is this in the Visual Studio build or the NCrunch build?

NCrunch only, for me

Quote:
Are you running any integration tests that contain absolute file references back to your original solution path?

No

Quote:
Are you running any integration tests that spawn child processes of any kind, or create locks on files that may not be released?

No

Quote:
When you build your solution using Visual Studio, does this cause NCrunch to suddenly trigger and start running builds and tests?

Yes. I'm using engine mode 3 (experimental)
Remco
#10 Posted : Thursday, February 28, 2013 8:03:30 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi,

Thanks for sharing the details above. Based on the information you've also provided in the other thread (re: conditional DLL/project reference issue) and the last answer you gave (building your solution causes NCrunch to trigger), I'm fairly certain that this problem is caused by your inclusion of build output files in your NCrunch workspace.

The later versions of NCrunch (1.43 and above) will generally give a warning if they detect this, although there are many complex cases that can create it and the warnings won't always show.

When your foreground build (in visual studio) changes files that are being watched by NCrunch (which includes assembly references, project files, and files included using the 'Additional files to include' configuration setting), this can then cause overlapping builds between NCrunch and Visual Studio. Because NCrunch's build is designed to be isolated from your foreground solution (using the workspaces), in theory these builds should not interfere with each other. However, I have observed (and been unable to recreate) situations where these builds DO actually somehow share state and can cause crazy file copying to happen.

It's rare, but when NCrunch is running thousands of builds throughout the day, the probability doesn't need to be very high for the problem to occur at least once.

If NCrunch is giving you warnings about references to files output from the build process - I recommend taking these warnings seriously. They can provide useful information about implicit behaviour within your build process. If you have no warnings showing, it is possible to use NCrunch's trace log to identify which file change is causing the engine to trigger in the following way:

1. Enable the 'log to output window' configuration setting in your global NCrunch config
2. Set the log verbosity to 'Medium'
3. Set the engine mode to run tests manually (to avoid noise)
4. Open the VS output window and choose 'NCrunch Diagnostic Output' in the dropdown list
5. Build one of the projects that you believe is causing NCrunch to trigger
6. Watch for when NCrunch triggers, then look through the log for a 'ComponentMemberUpdatedEvent', or a 'ComponentAssemblyReferenceUpdatedEvent'. These events identify files that have been updated and will therefore trigger the engine to run a build.

It is highly desirable to be in a situation where you cannot cause NCrunch to trigger a build by executing a build in Visual Studio. While there are many solutions that work fine with NCrunch even though their builds trigger in this way, it's always the first thing that should be addressed when experiencing random problems like those described above.
1 user thanked Remco for this useful post.
Espresso on 2/28/2013(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.118 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download