Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    [C#] help file.close unhandled exception

    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?

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    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.
    OracleGuy

  • #3
    New to the CF scene
    Join Date
    Nov 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •