Building or running with VS creates new temp directories


Every time VS runs test discovery with the xUnit.net runner (VS 2013, Windows 8.1 x64; runner version 0.99.0, I get at least one new temp directory that never gets deleted. The structure of the directory is as follows:

PS C:\Users\<Me>\AppData\Local\Temp\069b4c48-acb7-4309-9817-dc2c68ec36e0> gci -rec -name
PS C:\Users\<Me>\AppData\Local\Temp\069b4c48-acb7-4309-9817-dc2c68ec36e0>

Doing test discovery creates over 30 of these directories, and running a single test creates at least one.

Using the VS runner to do TDD, my temp directory fills up quite fast, to the point that it's becoming impractical. (I think I'll need to switch to TDD.net for this and other reasons.)


DJGrossman wrote Dec 6, 2013 at 4:40 AM

I have observed this behavior on two separate Windows 7 x64 VS2013 installations running 0.99.1, as well.

BradWilson wrote Dec 7, 2013 at 3:14 AM

Yes, this is related to the memory leak issue we're working on.

We use a separate AppDomain for discovering and running unit tests. Several objects implement MarshalByRefObject, which we have just recently discovered has "connection" state. When we're done discovering or running, we need to make sure that we haven't left any objects in the connected state when we try to shut down the AppDomain; otherwise, the cleanup code (silently) fails when we try to shut down the app domain and delete the temporary folder that was used for shadow copying.

BradWilson wrote Dec 7, 2013 at 7:08 PM

BradWilson wrote Jan 18, 2014 at 6:46 PM

For v2: Fixed in change set #9ad2a8c.

davidmatson wrote Jan 20, 2014 at 5:17 PM

Verified; thanks!

knatten wrote Jan 28, 2014 at 6:48 AM

Will this be fixed in the stable release (the 1.x series)? If not, do you recommend using 2.0.0 in production? I currently get a new copy of my private assemblies in AppData each time I run my tests, and they are never deleted.

For anyone else struggling with this, here's how to clean it up from a Cygwin shell:
rm -rf `ls | egrep "^(\w|-){36}$"`