M
Mugsy_in_Houston
Guest
I keep running into this annoying issue and I hope there's a fix.
When I'm debugging a program, attempting to delete a folder that the program recently accessed throws an exception, telling me I can't delete the folder b/c it is "being used by another process":
bolContinue = False
Do
Try
My.Computer.FileSystem.DeleteDirectory("c:\MyTemp", FileIO.DeleteDirectoryOption.DeleteAllContents) ' Delete work folder.
bolContinue = True
Catch
' If folder is already missing, no need to do anything. Just catch the error.
If IO.Directory.Exists("c:\MyTemp") Then
MsgBox("Error #" & Err.Number & " " & Err.Description & vbCrLf & "Please close Explorer or any other app currently open before continuing.", MsgBoxStyle.Information, "Error")
End If
End Try
Loop Until bolContinue
.
Yeah it's "in use"... BY VISUAL STUDIO!
I've tried "FileIO" & "IO.Directory.Delete", but it made no difference.
IIRC, this problem goes away once the program is published, but it makes debugging a PIA. Is there a way to resolve this?
TIA.
Continue reading...
When I'm debugging a program, attempting to delete a folder that the program recently accessed throws an exception, telling me I can't delete the folder b/c it is "being used by another process":
bolContinue = False
Do
Try
My.Computer.FileSystem.DeleteDirectory("c:\MyTemp", FileIO.DeleteDirectoryOption.DeleteAllContents) ' Delete work folder.
bolContinue = True
Catch
' If folder is already missing, no need to do anything. Just catch the error.
If IO.Directory.Exists("c:\MyTemp") Then
MsgBox("Error #" & Err.Number & " " & Err.Description & vbCrLf & "Please close Explorer or any other app currently open before continuing.", MsgBoxStyle.Information, "Error")
End If
End Try
Loop Until bolContinue
.
Yeah it's "in use"... BY VISUAL STUDIO!
I've tried "FileIO" & "IO.Directory.Delete", but it made no difference.
IIRC, this problem goes away once the program is published, but it makes debugging a PIA. Is there a way to resolve this?
TIA.
Continue reading...