473,480 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

File locking issue

Hi,

I'm trying to filter a xml file using a xml transform object in
vb.net.
The process is running great till I try to delete the xml file when
the job is finished.

I set all my objects to nothing, call GC.collect and finally call
Kill(xmlfilename).
I get an IO error telling the file was unavailable because locked by
another process.

is there a way to detect which object is still locking the file?

Thanks,

Sep 21 '07 #1
2 1247
Olivers,

Non of the methods you have called are affectiong the locking.

At least you have to close a file to get it free.

Cor

"oliviers" <ol************@gmail.comschreef in bericht
news:11**********************@i13g2000prf.googlegr oups.com...
Hi,

I'm trying to filter a xml file using a xml transform object in
vb.net.
The process is running great till I try to delete the xml file when
the job is finished.

I set all my objects to nothing, call GC.collect and finally call
Kill(xmlfilename).
I get an IO error telling the file was unavailable because locked by
another process.

is there a way to detect which object is still locking the file?

Thanks,
Sep 22 '07 #2
oliviers wrote:
I'm trying to filter a xml file using a xml transform object in
vb.net.
The process is running great till I try to delete the xml file when
the job is finished.
I set all my objects to nothing, ...
Setting objects to Nothing in .Net is an [almost] complete waste of
time. You achieve nothing (no pun intended) by doing it.
All you do is make the object /eligible/ for garbage collection, which
should get rid of the object in its own good time.

... call GC.collect ...
IMHO, and unless you're /very/ sure you know what you're doing, you
should never need to call GC.Collect yourself. There are hidden costs
associated with calling it unnecessarily, e.g. you can promote every
variable in your application to "Gen 2", thereby requiring every
subsequent garbage collection to page each and every variable in and out
of memory just to examine it.
... and finally call Kill(xmlfilename).
When you are finished with an object, if it has a defined Dispose (or,
possibly, Close) method, then call that.

My guess would be that you have an XmlWriter (or similar) still open to
the target file.

HTH,
Phill W.
Sep 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5799
by: Kamus of Kadizhar | last post by:
Thanks to Robert Brewer, I got enough insight into logging to make it work.... Now I have another issue: file locking. Sorry if this is a very basic question, but I can't find a handy reference...
4
6741
by: Alex | last post by:
Is there any way to link a table to a front end for reference only (no requirement to edit data) so that the LDB file is not created. I use a number of tables for reference and do not need to edit...
4
1575
by: darrel | last post by:
I've been dealing with a file locking issue for a while. Our CMS spits out a new XML file each time an item in the DB is updated. This XML file is basically our site menu, and is what we use on...
13
11107
by: George | last post by:
Hi, I am re-writing part of my application using C#. This application starts another process which execute a "legacy" program. This legacy program writes to a log file and before it ends, it...
3
10379
by: dchadha | last post by:
Hi, I am working on application in C# which uses and stores data in xml file. This app can use xml file from two different ways: (a) From User Interface (Windows application) and (b) From...
17
7982
by: Peter Duniho | last post by:
I searched using Google, on the web and in the newsgroups, and found nothing on this topic. Hopefully that means I just don't understand what I'm supposed to be doing here. :) The problem: ...
8
2314
by: dosworldguy | last post by:
I have been having a very peculiar issue from a long time. I have an application where multiple clients read from a shared set of files. When a record is changed, sometimes the win9x clients...
2
4820
by: DeanL | last post by:
Hi Guys, I've been trawling through this group for an answer to this but can't find one that works. I have an Access 97 db sitting on a Novell server that is accessed via a front end with...
1
1755
by: =?Utf-8?B?REZTIEhFTFAgV0FOVEVE?= | last post by:
We are currently testing the Microsoft technology of Distributed File System Replication with DFS Namespaces which is working perfectly, however from the Microsoft documentation surrounding these...
0
7027
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5318
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4763
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4468
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2987
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2974
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
557
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
170
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.