release objects

  • Thread starter Thread starter mamin
  • Start date Start date
M

mamin

In my code I'm creating a file and then I need to delete it.But while
deleting, it's appear system error that some process is using my file and
it's impossible to delete it.I was trying to release all objects using this
file but without any result.Is there any method to release all objects using
my file or to spy which object is using this file?
 
Hi,

You do not have to release it, all you have to do is close it
Just call FileStream.close() ( if you used FileStream )

Release should close it also, but when depends of when the GC runs so it's
not deterministic.

In case you need to know if other program has it open download the filemon
utility from www.sysinternals.com

Cheers,
 
As Ignacio said, try using filemon to see which process is holding a
reference to the file.
Closing this process should allow you to delete the file.
[You can't delete a file (programatically or manually) while it's being
used by a process, so you have to kill the process before being able to
delete it]

Regards
Mohamed El Ashmawy
MEA Developer Support Center
ITWorx on behalf of Microsoft EMEA GTSC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top