Daily Usage Issues

Problems with multiple workspaces

Started by MarcChu on 5,197 views

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.
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.
*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

Post a reply

Log in to reply.