Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Weird System.IO Related Problems

Weird System.IO Related Problems

Scheduled Pinned Locked Moved C#
sysadmindebugginghelptutorialquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ranjan Banerji
    wrote on last edited by
    #1

    I am having what appears to be a strange problem when I do File and or directory management using System.IO. For example if I have the following lines of code: Directory.Delete() File.Copy() Use the File If the directory to be deleted is very large, it appears that while the directory is being deleted, the code jumps to the next line which is copy a file and the following line which is use the File. But since the directory deletion is not complete the File Copy or use hte file fails. I cannot reproduce the problem in debug mode so am not sure what the hell is happening. Have also noticed the problem when I was doing server maintenance and was deleting a few gigs of files manually. At the same time I was running my code that was writing files to the drive. Since the drive was busy it was taking time to write the files. What was strange is that it attempted to use the file before it finished writing it. Which is the same problem as I mentioned above. It seems to jump over a line of code to the next without completeing teh first, implying that the File IO is asynchronous or that something else is very evil in there :-) Is Directory.delete asynchronous? Is there a global setting that makes it asynchronous? Any ideas? Thanks.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups