...

View Full Version : [C#] help file.close unhandled exception



halimunan
11-05-2007, 08:46 AM
An unhandled exception of type 'System.IO.IOException' occurred in mscorlib.dll

Additional information: The process cannot access the file 'C:\Webdocs\xxx\xxx.xxx' because it is being used by another process.



hi all,

i`m doing an application to zip a file. this require system.io.file

but i`m having problem as it cannot run because the error above..
do i need to close the File.xxx as the library dont have the close function..

can anyone help?

oracleguy
11-06-2007, 12:12 AM
If you opened the stream, there is a close function. And you need to use it.

Post your code if you require more specific help so we can see what you are doing.

wassif
11-12-2007, 05:25 PM
I fixed my problem by suppressing the Finalize on the base stream after I opened the file

Here is the Line I added after opening the file
GC.SuppressFinalize(myLogStream.BaseStream);

Then at the class destructor I could Flush and Close the file



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum