Process locks a folder
- by Vad
Have pretty odd situation. There are 2 applications:
1) C:\MyFolder1\First.exe
2) C:\MyFolder2\Second.exe
First.exe runs Second.exe and quits.
Process.Start(@"C:\MyFolder2\Second.exe");
// And exit.
Seconds.exe waits a few seconds and tries to remove "C:\MyFolder1\" folder.
// Wait for 5 seconds - First.exe terminated by that time for 100%
Directory.Delete(@"C:\MyFolder1\", true);
Action fails with “The process cannot access the file ‘C:\MyFolder1\’ because it is being used by another process.” It's able to remove the First.exe file (actually all files in the folder), but not the folder itself.
Does anybody have an idea why the folder is locked by the second process?