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

Notification

Icon
Error

Problems with multiple workspaces
MarcChu
#1 Posted : Wednesday, November 11, 2015 8:47:58 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/26/2014(UTC)
Posts: 22

Thanks: 3 times
Was thanked: 1 time(s) in 1 post(s)
I've been having a problem with some integration tests that I've been running that started only recently. At this point, I can run them once and have them successfully pass. However, if they run again, then they fail. The reason they fail is that they're looking for a connection string, and my error output tells me the connection string doesn't exist. When I debugged into the code, I would see that the only connection string was some default connection string, and the ConfigurationManager was showing me no app settings. Also, I could never debug into my test assembly when this was happening (although I could debug other assemblies). If I reload and rerun the test assembly, then everything works fine again.

After digging around, I finally see why all this is happening. When I reload and re-run the project, two separate workspace directories are created. The bin\debug directory for both has the assembly, config, and pdb. Whenever I right-click a test and select "Browse to workspace used for the selected test", I'm taken to the last created workspace directory. As the tests finish running, I see that the earlier directory remains unchanged. However, after the tests complete, all of the files except for the assembly itself are deleted from the later directory. I realized that the reason I can't debug is that the pdb file is deleted, and the reason for the ConfigurationManager problems is that my .config file is deleted.

I need to know why I'm having this problem, because it's getting really annoying.
Remco
#2 Posted : Wednesday, November 11, 2015 10:36:37 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for sharing this issue.

I think you have a malfunctioning test that is cleaning up these files.

This is because:
- NCrunch doesn't delete build output files out of workspaces until the workspace is due to be removed, which can only happen if all test processes using the workspace have been shut down. Because the .DLL file isn't deleted, this means there is still a test process around that is locking it.
- The nature of this problem is intermittent and therefore likely to be sequence dependent. If there is a test that is deleting these files, you will only notice the failure if your .config related tests are run after the malfunctioning test within a test run. If the .config files are run first, they'll pass.

Try keeping an eye on the workspace for this project and selectively running tests out of your project while in manual mode. Make sure the test hasn't already been run when you start this, as it'll likely corrupt the NCrunch workspace and make a big mess. There must be some test in the project that is causing this to happen.
MarcChu
#3 Posted : Thursday, November 12, 2015 3:45:25 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/26/2014(UTC)
Posts: 22

Thanks: 3 times
Was thanked: 1 time(s) in 1 post(s)
*Sigh* Yes, I was extracting a bunch of files from a zip and then moving all the files in the directory to another location. Problem is that directory was the bin\Debug directory. Stupid.

Thanks for pointing me in the right direction.

MC
1 user thanked MarcChu for this useful post.
Remco on 11/12/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.030 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download