IO.File.Delete weirdness (undead files)

  • Thread starter Thread starter Fergal Ó Ceallaigh
  • Start date Start date
F

Fergal Ó Ceallaigh

Hi,

As part of my app I allow users to copy files into a 'project' (in reality,
just a regular folder). The copying works fine, however I am running into
consistent problems when trying to later delete files that I have copied.
Often I am finding that the file is being locked "by another process" or I
get silly "permission denied" problems (Its a Windows Forms app and its
being run by an admin). Even weirder still, when debugging and stepping
through the IO.FILE.DELETE(FileName) I note that the file is not deleted
even tho the line doesn't throw an exception. The file remains in place
until after the application itself terminates making it impossible for me to
overwrite or update the files with newer versions etc, as per the user's
needs. Clearly, a request to delete is being delayed and queued in some
fashion. I'd like to be able to see why the file is being locked and get
..net to understand that when I say delete the file; I mean delete the file
now. Can someone help shed light on what is happening here and how I might
work around this?


Thanks much,

Fergal O' Ceallaigh
www.ryarc.com



Other info:

I do thumbnail the files as the user works with them but am careful to make
sure that the objects used to examine the file are released before deletion.
The Folder In which I am doing the file operations (its less than 256
characters) C:\Documents and Settings\Fergal\My Documents\Visual Studio
Projects\RyarcMother\bin\WorkingDirectory\e31da847-9f0d-499c-ac94-9514ce3df31e\FBE7CB33-CBF1-410E-AAD7-DD008A63A1BB\
 
Hi, I found the reason for this. It wasn't enough when using the Video
object of Microsoft.DirectX.AudioVideoPlayback.Video to set it to Nothing, I
had to call .Dispose() everytime I used it to fully release the file.

- Fergal

www.ryarc.com
 
Back
Top