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)
Yes, it has nothing to do with SSD drive. I had same problem but only on a client laptop. I am using .NET 3.5. In my case, the directory had a single file. CreateDirectory seems to be executing first internally before Delete is finished.
This was a code that worked well for three years on many computers. Client changed to a new laptop and the code consistently fails for him. I can not reproduce the scenario on development/test machines with same configuration.