Directory c:\test has 50 or so files in it, no subdirectories.
If IO.Directory.Exists("C:\test") Then
IO.Directory.Delete("C:\test", True)
End If
IO.Directory.CreateDirectory("C:\test")
Drive C is Intel's X25-M80 SSD drive, OS is Windows 7 64 bit with TRIM support, Visual Studio is 2008 with target framework 3.5. When above code is executed, CreateDirectory breaks code execution without an (visible) exception. After much headache I found that Delete is not yet done by the time code execution gets to CreateDirectory. If I modify my code like this:
If IO.Directory.Exists("C:\test") Then
IO.Directory.Delete("C:\test", True)
End If
Threading.Thread.Sleep(2000)
IO.Directory.CreateDirectory("C:\test")
then everything works as expected.
My questions beside the obvious WTF here are: