Reply to topic  [ 7 posts ] 
File Handle Lock 
Author Message

Joined: Wed Jan 16, 2008 9:13 am
Posts: 8
Reply with quote
Post File Handle Lock
I am trying to read an already created Excel file and immediately write it out to disk as another file, however when this happens there seems to be a file handle left open as I cannot delete the file. I open Process Explorer and it seems that for some reason the indexing service (cidaemon.exe) keeps a handle to this file always open. I am also testing other libraries and this does not happen. The code snippet is listed here:

Code:
EasyXLS.ExcelDocument xlsDoc = new ExcelDocument();                               
xlsDoc.easy_LoadXLSFile("whatever.xls");                               
xlsDoc.easy_WriteXLSFile("whatever(EasyXLS).xls");
xlsDoc.Dispose();


Wed Jan 16, 2008 11:38 am
Profile

Joined: Fri Feb 03, 2006 12:23 pm
Posts: 199
Location: Brasov, Romania
Reply with quote
Post 
The easy_LoadXLSFile and easy_WriteXLSFile methods close the streams at the end. The issue is caused by something else.


Thu Jan 17, 2008 6:20 am
Profile WWW

Joined: Wed Jan 16, 2008 9:13 am
Posts: 8
Reply with quote
Post 
Daniela wrote:
The easy_LoadXLSFile and easy_WriteXLSFile methods close the streams at the end. The issue is caused by something else.


And that something else being what? Can you offer any insight as to what I might be doing wrong with my code? This seems to happen quite frequently for me with the .NET version (C#).


Thu Jan 17, 2008 8:35 am
Profile

Joined: Fri Feb 03, 2006 12:23 pm
Posts: 199
Location: Brasov, Romania
Reply with quote
Post 
Is it possible to open later the XLS file generated with EasyXLS with a different application or even with your program that you are writing?


Thu Jan 17, 2008 12:10 pm
Profile WWW

Joined: Wed Jan 16, 2008 9:13 am
Posts: 8
Reply with quote
Post 
Daniela wrote:
Is it possible to open later the XLS file generated with EasyXLS with a different application or even with your program that you are writing?


You can open it in Excel, however it opens Read Only. What my program does is if I try to open a file called "MyFile.xls", it'll load the file and then save the file as "MyFile(EasyXLS).xls". Once the "MyFile(EasyXLS).xls" file is locked, and my program runs again to do the same thing, rather than taking 13 minutes (please see issue http://forum.easyxls.com/viewtopic.php?t=130) it takes 2 seconds to run because (I believe) the write fails because the file is locked, however I don't receive any sort of exception even though the easy_WriteXLSFile method is failing. I will do more research to see if I can recreate this scenario.


Thu Jan 17, 2008 1:34 pm
Profile

Joined: Wed Jan 16, 2008 9:13 am
Posts: 8
Reply with quote
Post 
I cannot get this to happen again. I'm not sure what was going on before, it is possible that I was not using the Dispose() method before, but I don't think that was the case. Regardless, I have ran this a few times and have not come across it again.

In regard to this:

Quote:
the write fails because the file is locked, however I don't receive any sort of exception even though the easy_WriteXLSFile method is failing.


I noticed that you can retrieve error messages. I just assumed that since read/write methods were returning void that if an error occurred it would throw an Exception.[/i]


Thu Jan 17, 2008 3:42 pm
Profile

Joined: Fri Feb 03, 2006 12:23 pm
Posts: 199
Location: Brasov, Romania
Reply with quote
Post 
Check also ExcelDOcument.easy_getError method for errors.


Fri Jan 18, 2008 5:27 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.